This second screenshot is after I connect the data wire to the transmimtter, but it not showing the byte 65, which in ASCII would be “a”. What am I doing wrong wrong?
Try attaching 30-35 cm of wire to the antenna terminals. Also, in the product comments people said that the receiver AGC will cause noise to be output if you don’t transmit something at least every 10ms. Try reducing your delay to an amount less than that.
Not to hijack your thread, but I’m having a similar problem with the same RF links (315MHz version). The only difference with my situation is that I’m not getting ANY data from the receiver at all. I’ve been trying a simple loopback test, and I get absolutely nothing unless I run a direct line from rx to tx. Do you think one of the units could be defective?
Any luck/progress with this? I am able to get the the VirtualWire library working (I think…) - the serial monitor reads "Got: 68 65 6C 6C 6F
" which I think is the hex equivalent of ‘hello’.
However, I’m struggling because what I really want to do is have an LED on the receiver Arduino light up when a button on the transmitting Arduino is pushed. It’s not clear to me how I can use the VirtualWire to accomplish that. I’ve searched around for examples with no luck. Can anyone assist?
tikka308:
However, I’m struggling because what I really want to do is have an LED on the receiver Arduino light up when a button on the transmitting Arduino is pushed. … Can anyone assist?
A pair of Digi XBees can do this without writing any code.
Yep, that’s the hex codes for “hello” so you have the pair working.
Read the “KLP walk through” on the transmitter’s SparkFun page. There is some info and ideas for reliable communication.
Then do some google searches on ASK data transmission, and Manchester encoding. There is a ton of good, easy to understand info.
The biggest down side of on ASK transmitter is that there is no RF on data ‘0’ only on data ‘1’. Next is the simple receiver design, it is just an RF detector that does not discriminate whether the RF is from the desired transmitter or just random RF noise. To over come the hardware simplicity one needs to do a little more in software.
erickingston:
Not to hijack your thread, but I’m having a similar problem with the same RF links (315MHz version). The only difference with my situation is that I’m not getting ANY data from the receiver at all. I’ve been trying a simple loopback test, and I get absolutely nothing unless I run a direct line from rx to tx. Do you think one of the units could be defective?
If you are using a single Arduino, your program really isn’t loopback program. The rfSerial.print() function is going to send ALL of the data string, THEN your receiving routine is going to look for the data, which will be gone by the time you get ready to look for it. The first step to make this work is to put the receive routine in an interrupt handler. That way, your code can send the data without missing data.
Furthermore, again assuming a single Arduino is in use, the transmitter is going to completely swamp the receiver causing more problems. There are a number of strategies to get these devices to work together. The key is to set up a situation where the average data stream of 0/1 bits is balanced. One way is to use Manchester encoding as waltr said. You can also get pretty close by sending a data byte followed immediately by its complement. In all cases, the receiver needs some framing data to give it time to adjust its automatic gain control (AGC) circuitry for the incoming data. I use a short string like 0xE5, 0xAA, 0xE5 followed by my data packet (a byte followed by its complement).