Skip to content
Free delivery, every order. Want a bulk deal or can't find what you need? Email support@pmdway.com now!
Free delivery, every order. Want a bulk deal or can't find what you need? Email support@pmdway.com now!
Use wireless data links to send data from one Arduino to another and also remote-control applications with this neat tutorial.

Tutorial - Using Long Range 315MHz RF Wireless Transceivers with Arduino

You can send data from one Arduino to another, or create a wireless remote-control system using our long-range 315MHz or 433MHz wireless data units.

We have provided this tutorial so you can quickly test and use your units, giving you the knowledge to build upon and make your own projects. So let's get started!

Testing the modules

Our first guide is to simply test that data can be sent and received from one module to another. This is also an ideal setup for testing the radio range of the units in your area.

You will need:

  • One set of 315MHz or 433MHz wireless data units
  • Two Arduino Uno or similar boards and USB cables
  • Two solderless breadboards
  • Some male to male jumper wires
  • One LED and a resistor of between 330 and 560 Ohms
  • An external power supply for one Arduino. This can be an AC-DC wall wart, USB power bank, anything to power it without using the PC that has the receiving Arduino connected to it.

You also need to install the VirtualWire Arduino library. To do this:

  • Download this .zip file into a temporary or your download directory. 
  • Open the Arduino IDE and select Sketch > Include Library > Add .zip Library...

  • Navigate to the library .zip download and click "Open"

After a few moments the library will be installed. You can check that this has completed by selecting Sketch > Include Library> then scroll down the long pop-up menu until you see "VirtualWire" as shown below:

Now - back to the hardware. Allocate one Arduino to be the transmitter, and one the receiver. Upload the following sketch to the transmitter board:

... and upload the following sketch to the receiver board:

Wiring the modules is very easy, they are labelled well and drop straight into a solderless breadboard:

Long Range 315MHz RF Wireless Transceiver Kit from PMD Way with free delivery worldwide

Now connect the transmitter module to your transmitter Arduino as such:

  • Arduino GND to transmitter GND
  • Arduino 5V to transmitter Vcc
  • Arduino digital pin 12 to transmitter SIG:

Long Range 315MHz RF Wireless Transceiver Kit from PMD Way with free delivery worldwide

Next, connect the receiver module to your transmitter Arduino as such:

  • Arduino GND to receiver GND
  • Arduino 5V to receiver Vcc
  • Arduino digital pin 11 to receiver SIG
  • LED and resistor in series between Arduino digital pin 2 and GND

Long Range 315MHz RF Wireless Transceiver Kit from PMD Way with free delivery worldwide

Now that you've assembled both circuits, and uploaded the transmitter and receiver sketches to each board - it's time to test. 

Connect the transmitter board to power, and connect the receiver board to the PC. If not already open, run the Arduino IDE and open the serial monitor. You should notice two things:

  1. The LED on your receiver circuit should blink around once per second. When the LED blinks, this indicates the receiver circuit has successfully received a complete message from the transmitter
  2. The data sent from the transmitter is displayed in the serial monitor.

You can see this in action through the following video:

Our camera had trouble capturing the LED blink in some moments, but that's ok.

You can also use this two Arduino setup to test the radio range - simply power the transmitter, and power the receiver circuit with a portable source of energy, such as a USB power bank - then walk away from the transmitter. The LED will stop blinking when you're out of radio range. 

You can increase the radio range by increasing the voltage to the transmitter unit - up to 12V DC. 

Wireless Remote Control

Now to do something useful - create a wireless digital output control. Our transmitter will have two buttons, and our receiver will control two LEDs via digital outputs. Naturally this is an example, you can use this as a base to control other devices if required. 

You will need:

  • One set of 315MHz or 433MHz wireless data units
  • Two Arduino Uno or similar boards and USB cables
  • Two solderless breadboards
  • Some male to male and male to female jumper wires
  • Two LEDs and two resistors of between 330 and 560 Ohms
  • Two tactile buttons and two 10k resistors OR two button breakouts
  • An external power supply for one Arduino. This can be an AC-DC wall wart, USB power bank, anything to power it without using the PC that has the receiving Arduino connected to it.

We will use two tactile buttons and 10k Ohm pull-down resistors for input. If you're not familiar with digital inputs and buttons, the building block for this is shown below.

The example diagram uses D12 as the input pin, however for this project your transmitter circuit will need two button circuits, using D8 and D7.

To save time we will use button breakout boards which combine the circuit into a neat unit ideal for prototyping:

Your receiver circuit is the same as the test circuit at the start of this tutorial, except that anothe LED circuit is added to digital pin 3.

Now for the sketches. Upload the following sketch to the transmitter (buttons) Arduino...

... and upload the following sketch to the receiver (LEDs) Arduino:

You can see a quick demonstration in the following video:

So how did that work? 

Review the transmitter sketch. A character is sent over the wireless link which determines the latest operation of the buttons - a, b, c or d (button one high/low, button two high/low).

Review the receiver sketch - on line 21 the switch-case function interrogates the incoming character from the wireless link and determines the action - in this case, controlling the digital outputs which have the two LEDs. 

The response speed may seem a little slow - this will be affected by the data speed (300 bps). You can experiment with data speed and radio range (and voltage to the transmitter unit)

You can then alter this for your own means. You may not want to continuously send data as our example does, depending on your needs. As always, have fun and experiment. 

Sending data wirelessly from one Arduino to another

Now we'll show how to send some data in the form of an integer over our wireless link. This is ideal for sending the values of analog inputs, or other data that can be represented as an integer.

The hardware is the same as before - one Arduino transmitting and one Arduino receiving - with the receiver unit connected to a PC so we can use the Serial Monitor to display the received data. 

Upload the following sketch to the transmitter Arduino...

... and the following sketch to the receiver Arduino.

Once operating and in radio range, the onboard LEDs will indicate successful transmission and reception of data. Open the serial monitor, and after a moment you will be presented with the data from analog pin 1 of the transmitter Arduino - for example:

So how did that work? 

Review the trasmitter sketch. We took a value from analog pin 1, and stored it into an integer variable on line 28. The VirtualWire library is geared to send data as characters so we convert the integer to a character array on line 31 - which is then sent as usual as shown in line 34.

Now review the receiver sketch. Nothing unusual, and the data from the receiver (in character form) is fed into the array at line 38. Once completed, we add "\0" to the end of the array to signify the end of the data. 

The array is then converted back to an integer on line 45, then sent to the Serial Monitor. So there you have it, we've sent integers across the airwaves. You can use your own "codes" with integers to mean all sorts of things and send them across. Ideal for temperature sensors, or anything really. 

 Thank you! 

If you have a problem with your wireless modules from PMD Way, please email support@pmdway.com for technical and order support.

And to keep up to date with interesting news, tutorials offers and new products - interact with us on facebook, instagram, and twitter.

Previous article Tutorial - Using the 0.49" 64 x 32 Graphic I2C OLED Display with Arduino
Next article Project - Fun with Arduino-controlled Traffic Lights