NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Project Help and Ideas » RF sniffer

April 16, 2011
by Hexorg
Hexorg's Avatar

Hey guys, while working on my rf-remote control project, I realized that rf-sniffer which I can hook to my computer would be really useful. I'm using "HOPE RF"'s digital transceivers, that have 3 different usable bands, and can tune to a good range of frequencies in each of those bands. I'm connecting that to a nerdkit, since it already has UART cable in it. However before I start writing the code, I wanted to ask a few things.

First of all, the transmitter needs 3.3V. I have a LDO 3.3v regulator, so that's not the problem. I was planning to connect the ATmega168 to the 3.3v Vcc as well, to avoid the need for regulating the lines between transmitter and the nerdkit. But then I realized that the UART cable will have 5v in the data lines when they send 1s... So is it safe to leave those lines unregulated? Nerdkit can definately work with 5v input when Vcc is 5v, but can it use that when Vcc is 3.3v?

April 16, 2011
by Noter
Noter's Avatar

Take a look at "Absolute Maximum Ratings" in the data sheet. It says says -0.5V to VCC+0.5V is the max on any pin other than reset.

April 16, 2011
by Noter
Noter's Avatar

I've been working on my FT232 USB IC this morning and I just read that it will handle your voltage needs for you. Here's what it says:

Integrated Level Converter on UART Interface and Control Signals - VCCIO pin supply can be from 1.8V to 5V. Connecting the VCCIO pin to 1.8V, 2.8V, or 3.3V allows the device to directly interface to 1.8V, 2.8V or 3.3V and other logic families without the need for external level converter I.C. devices.

April 16, 2011
by Hexorg
Hexorg's Avatar

Well, I just realized that I wont need to receive anything from the PC, so I can leave the yellow wire of the UART cable unplugged, right?

April 16, 2011
by Hexorg
Hexorg's Avatar

Strange... if I do uart_write('l'); then minicom gets filled with "l"s fast... but if I do printf_P(PSTR("TEST")); ... nothing.

Uart init:

    uart_init();
FILE uart_stream = FDEV_SETUP_STREAM(uart_putchar, uart_getchar, _FDEV_SETUP_RW);
stdin = stdout = &uart_stream;

and the uart.c and uart.h are from libnerdkits

April 16, 2011
by 6ofhalfdozen
6ofhalfdozen's Avatar

Heya Hexorg,

I have that same issues on both the LCD and the uart with my NK's. Somehow, the stream versions compile ok but nothing ever happens. No voltage out or anything.. nada zip.. The straight write commands work fine every time though.. I tried using code the NK guys put in some of their tutorials without any mods and it doesn't work. Itried some of the code posted by other folks, it never works for the streams.. dunno why. I always assumed it was my magnetic personality or bad karma messing with the NK's. hehehe Anyhow, my NK's have the same issue, dunno why, so I just live with the write commands for the uart and the lcd. doubt that helps any, but you aren't alone with that issue.

April 16, 2011
by Hexorg
Hexorg's Avatar

6ofhalfdozen, well before I cleared the boot-loader of the nerdkit uC, the streams worked fine. This is the first time I'm dealing with streams without the bootloader... Maybe that's what's wrong with it

April 17, 2011
by BobaMosfet
BobaMosfet's Avatar

The NK guys put a bootloader on the chip to handle their communication on pins 2 & 3; without their bootloader, you need to write your own to do that for you.

BM

April 17, 2011
by Hexorg
Hexorg's Avatar

BobaMosfet, I've looked through the foodloader code, and it seems that it does exactly the same as the libnerdkit's uart.c does.

April 17, 2011
by bretm
bretm's Avatar

Can you post a complete but minimal program that reproduces the problem?

April 17, 2011
by Hexorg
Hexorg's Avatar

bretm, sure. Here we go - program

April 17, 2011
by Noter
Noter's Avatar

Have you tried

printf_P(PSTR("TEST"));
April 17, 2011
by Hexorg
Hexorg's Avatar

Yea, tried that too, same result. In makefile, I DO include the .data section, so my string-arrays should work just as wells as PSTR.

April 17, 2011
by Noter
Noter's Avatar

This works -

FILE uart_stream;

void setup()
{
    uart_init();
    fdev_setup_stream(&uart_stream, uart_putchar, uart_getchar, _FDEV_SETUP_RW); 
    stdin = stdout = &uart_stream;

}
April 17, 2011
by Hexorg
Hexorg's Avatar

*face palm* global variables... Thank you Noter!

6ofhalfdozen, Noter's solution worked for me. try it too :)

April 17, 2011
by 6ofhalfdozen
6ofhalfdozen's Avatar

Hexorg and Noter,

I will give your code a try tomorrow when I have time to work on my NK some. I haven't messed with the bootloader or anything on my NK's. I definately am not that advanced yet, so if it was a bootloader issue it was an unintentional screw up on my part. I am still a little baffled why code right from the NK tutorials won't work for the streams.. but I will see what I get when I try this code tomorrow. thanks guys!!

April 26, 2011
by xodin
xodin's Avatar

Regarding the 3.3V problem, there is an easy solution. Use your 3.3V voltage regulator to power the HOPE RF txcvr. But as for the data lines, you can just use a resistor voltage divider network on the Din line (data coming from the MCU to the HOPE RF txcvr). 5v at the top, ~3.3v at the split. 10k on the bottom and 4.7k on the top should work. You should probably do the same thing for all other lines coming from the MCU to the txcvr, such as CLK and SEL. For the Dout line (data coming from the transceiver to the MCU), just plug it straight in. 3.3V should be enough to drive the high line for the MCU.

P.S. I just ordered two RFM12B HOPE RF txcvr's as well, can't wait to play with them :)

April 26, 2011
by Hexorg
Hexorg's Avatar

xodin, I saw people online saying connecting 5V straight to the txcvrs was working even better (longer range), but I decided not to try my luck. Besides this chip, I have a few other chips that need 3.3v though, so instead of buying a bunch of resistors, I just decided to use 3.3v as VCC.

Something I need to nemtion though is do NOT follow their programming guide. It doesn't work. Use the datasheet the the IC used in the RFM12B. IC is called RF12B and the datasheet can be found on the same hope rf website.

Something else I stumbled upon was that at least 2 of the ICs i got (out of ten), didn't work. I'm not sure if I broke them or they came broken.

Post a Reply

Please log in to post a reply.

Did you know that an analog comparator can tell when one voltage input crosses another? Learn more...