Let's Make Robots!

Arduino RF Communication using RX & TX link Modules

RF communication link between two Arduinos
  • Control method:

This Tip/Walk-Through will guide you through a simple one way communication link between two Arduinos.

The Project uses these RX/TX Radio Frequency (RF) Link Modules.

Edit :- Links updated - old ones where retired .Boooooo

(Thanks to Fritsl for bringing these cool babies to my attention ,i just had to try them out on my arduino and i am well impressed with thier performance )

Both Transmitter and Receiver together cost less than two tin cans with a piece of long string connected between !!!!!!!

You will have to download the Virtualwire.h library and install it to your arduinos  hardware/libraries folder

More info on the Virtualwire communications library can be found http://www.open.com.au as pdf file

Receiver :- Basic link Arduino Mega using a  RF Link Receiver - 315Mhz

Only Four wires are required, i have used a audio cable from a cd drive which i rewired to accept the cables (neat).

Yellow is the Antenna - approx 30cm long (other end connected to thin air)

Red is connected to 5 Volts

White is the Received data (in my case connected to pin 23 on the mega - can be easily assigned to another pin)

Black is Ground (it has three separate ground pins all connected together!!!!!!)

 // Receiver Code     (as the code is very short i post direct here, its adapted from Mike McCauleys pdf file above)

// RF Link using VirtualWire to receive messages
// simplex (one-way) receiver with a 315MHz RF Link Receiver module
// rx pin 23 on mega

#include <VirtualWire.h>  // you must download and install the VirtualWire.h to your hardware/libraries folder
#undef int
#undef abs
#undef double
#undef float
#undef round
void setup()

// Initialise the IO and ISR
    vw_set_ptt_inverted(true);    // Required for RX Link Module
    vw_setup(2000);                   // Bits per sec
    vw_set_rx_pin(23);           // We will be receiving on pin 23 (Mega) ie the RX pin from the module connects to this pin.
    vw_rx_start();                      // Start the receiver

void loop()
    uint8_t buf[VW_MAX_MESSAGE_LEN];
    uint8_t buflen = VW_MAX_MESSAGE_LEN;

    if (vw_get_message(buf, &buflen)) // check to see if anything has been received
    int i;
     // Message with a good checksum received.
    for (i = 0; i < buflen; i++)
        Serial.print(buf[i]);  // the received data is stored in buffer




 Transmitter :- Basic link using an  Arduino Duemilanova and a  RF Link Transmitter - 315Mhz


This also has 4 wires and the same trick with the cd audio socket to make neat connection.

Black connected to Ground

White is the transmit data cable connected to pin 3 on the Arduino (however this is easy to re-assign to suit your needs)

Red is the power supply connected to 5 Volt pin on Arduino (actually you can apply anywhere between 2 Volts and 12 Volts - the higher the voltage the stronger the RF signal)

Grey (sticking out of the Top is the Antenna - around 30cm long

// Transmitter Code


// RF Link using VirtualWire to Transmit messages
// simplex (one-way) receiver with a 315MHz RF Link Transmitter module
// tx pin 3 on Duemilanova (arduino)

#include <VirtualWire.h>  // you must download and install the VirtualWire.h to your hardware/libraries folder
#undef int
#undef abs
#undef double
#undef float
#undef round
void setup()
     // Initialise the IO and ISR
    vw_set_ptt_inverted(true); // Required for RF Link module
    vw_setup(2000);                 // Bits per sec
    vw_set_tx_pin(3);                // pin 3 is used as the transmit data out into the TX Link module, change this to suit your needs.

void loop()
    const char *msg = "LMR-II Rocks";       // this is your message to send

   vw_send((uint8_t *)msg, strlen(msg));
   vw_wait_tx();                                          // Wait for message to finish


Power them both up and switch on the Serial monitor to 2400 Baud on the receiving Arduino (mega in our case)


Then Hey Presto Communication link established......... up to 152.4 Meters (thats 500 feet in old currency)

I tested (Tx at 5 Volts) from my Basement to roof (5 stories) no problem ( Mega impressed)

Ending Side Mystery :- Why did i use pin 23 as the Rx pin on the Arduino Mega ?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

hey the problem is that i have an uno and an atmega328 chip with the bootloader (not uno's) so i wanna communicat the chip with the uno see the problem is that...

when the arduino ide18 was created the uno was not invented so in the board section u wont see it !!

but then i downloaded the latest ide (22) and checked and the code worked!!!for both uno and the chip !!!!

and does this receiver receieve digital data or serial data???

wen i bought it they said it worked for digital data and mine is three pin receiver and transmiiter!!but there is no deference between urs and mine coz the fourth pin on urs is the antenna and ,mine has an antenna build on to it!!

but mine is NOT receiving any data !!!could ya help me i dont know if its the problem of the arduino or the receiver!!

mine is 21 IDE and i just copied the same code u pasted above and it showed


vw_set_ptt_inverted(true); // Required for RF Link module

as an error and few other errors!!!!!!!!!!!

Looks like you have cracked it........ in the comments below (somewhere)....

hey i got an error while i compiled right here


    vw_set_ptt_inverted(true); // Required for RF Link module

and few other errors !!wats the prob ??????? and this same problem came while i compiled other codes like urs 

and i got the vietual wire installed!

Please supply more information about your project and connections ......most importantly which version of VirtualWire and Arduino IDE are you using......what do you want to achieve with your set up etcetcetc

(the code supplied above was compiled using IDE 18)

hey one more question will this receiver code only work with mega????

and will this code only work with a 315MHz receiver??? wat abt 415??


i new to this and im only 13 so could ya help????

Neat that you have started so early with electronics....... its a very rewarding direction :-)

The RF frequency does not really play a role in the code_ing  (as this is fixed on the small RF circuit boards ie 315 or 415Mhz - its just a carrier signal that changes the data you send to it into a high frequency radiation that radiates out of the Antenna   .......

Only thing to be aware of is the Baud rate ...... some inexpensive RF-Link boards max out at 2400 Baud and others at 4800 Baud. Baud rate is the speed at which you send the data to the RF module (slower is better as sometimes these link module tend to pick up electrical noise, on occasions mine have been swamped by cars (with dodgy distributor caps) passing outside ).

Yes it is confirmed as woring on my Mega board

hey it woked thanks!

Hey ..... i am glad you stuck at it..... will we see your project in action ?

  1. Just tested with IDE19 and it gave same result as you :-)
  2. Test the code using IDE 18 and tell me what hapens on your system.

The biggest problem with Arduino IDEs is they have a tendance to fix somethings and break others.........