ASK RF Link
Created 12/1/11 by Glyn Hudson
Xbees are great, but they are expensive. If all you require is a one-way link between two Arduinos, low cost RF transmission is the way to go.
Hardware
There are several types of RF transmitters and receivers
I have been using the MO-SAWR-A transmitter module and the MO-RX3400-A receiver module. These are available in 434Mhz and 315Mhz from coolcomponents at a very reasonable £8.80 for a pair (12/1/11). They are also available from Sparkfun.
The modules use ASK (amplitude shift keying), they have a maximum bit rate of 4800 bps and a very impressive range of about 150 metres in open air.
The modules are wired as follows:
The antenna should be 30cm long. Don't be tempted to coil the antenna, as it reduces performance.
Software
The VirtualWire Arduino library is used to package data to be transmitted into a data frame. A sync preamble is prepended, and a checksum appended, to the data. The library was written by Mike McCauley.
http://www.pjrc.com/teensy/td_libs_VirtualWire.html
Documentation for VirtualWire library
The library contains a simple string transmitting example.
Additional example code:
Range Tester - by Suneil Tagore
The range test transmitter code transmits the integers 1-9 in order repeatedly. The receiver code checks to see if the integers were received in order. If a transmission is dropped it is flagged. The number of dropped transmissions can be counted over a period of time to determine the transmission reliability rate.
Multiple value transmission (four values) - by Trystan Lea
It is often useful to transmit multiple values such as power, temperature etc. I have used this code to make a wireless home energy monitor display. The code works by adding a letter such as 'A', 'B', 'C' or 'D' before each value. The transmission can then be separated into the individual values at the receiver.
Future development
A more advanced library is being developed by Miles Burton here
Re: ASK RF Link
FYI, I've found that the 4800bps receivers require a buffer to work properly, ie: directly connecting the data line to an Arduino or an AVR IC will not work. The modules can't source enough current to pull the data line low, so all you get is a solid 5v out of the data line once wired to your micro. Using a buffer or two logic inverters in series will resolve this however (two gates in series from a 4049 hex inverter works great for this). The 2400bps receivers don't seem to have this problem, they can directly drive an Arduino or AVR input. This applies to both the 315MHz and 434MHz versions, I hope this helps anyone having problems.
Re: ASK RF Link
Good work! Thanks for the information. I'm sure it will save someone many hours. Cheers, Glyn.
Re: ASK RF Link
Trystan,
Great work as usual!
I have had my 'Open Energy Monitor' running for some time now, and have an i2c lcd [16 x 2] attached locally for displaying values (I also have an i2c Real Time Clock attached so that I can display cumulative values). In addition I have the Ethernet Shield (old one) on pins 10, 11, 12, 13 sending real time values (Power, Voltage & Temperature) to webservices which then log the realtime values and cummulative data for historical analysis. I would like to exand my set up to use these and have a remote display, but am getting confused looking at the specs - would I have any issues with pin assignments? Obviously all my Analogue pins are in use and so are 10, 11, 12, 13 digital pins.
Re: ASK RF Link
Hi David,
Nice work, sounds like you have a tidy setup going on.
These RF trasnsmitters and receivers only require one digital pin. This is set by the line vw_set_tx_pin(6); in the void setup() section of the code. So you could easily add an RF transmitter to your setup.
As for the receiver you would need another arduino. I used the Nokia 3310 shield from Nuelectronics to display the data (see http://openenergymonitor.org/emon/node/119). You wont be able to use this shield stright on to your current setup. The pins conflict with the Ethernet shield. See this great website for checking Arduino shield pin assignments: http://shieldlist.org/nuelectronics/nokia-lcd
Good luck, let me know how you get on.
All the best, Glyn.
Re: ASK RF Link
Many thanks for the quick reply Glyn,
Just have to order one now and get some spare time to play!!