Instructables

RF 315/433 MHz Transmitter-receiver Module and Arduino

Picture of RF 315/433 MHz Transmitter-receiver Module and Arduino
RF_315Mhz_Transmitter_Receiver-500x500.jpg
RF Module 017.JPG
Hi every body , I searched on Instructables about a simple RF Transmitter-receiver module , Which is used in Remote control for cars , or to control simple tasks , like control relay on/off unfortunately I didn't find What I need   , So i decided to write a simple artical about this transceiver and How we can connect it with arduino  and program it .

Materials: 

at first let's take a look for what we need :

1)  2 Arduino Board "I used Uno" 

2) RF 315MHz or 433MHz transmitter-receiver module .

3) jumper wire .

4) BreadBoard .

5)External Power supply (9V Battery *2) "Optional" .

 
Remove these adsRemove these ads by Signing Up

Step 1: Module Specification

This module has a specification for :

Transmitter : 

Working voltage: 3V - 12V  fo max. power use 12V
Working current: max  Less than 40mA max , and min 9mA
Resonance mode: (SAW)
Modulation mode: ASK
Working frequency: Eve 315MHz  Or  433MHz 
Transmission power: 25mW (315MHz at 12V)
Frequency error: +150kHz (max)
Velocity :  less than 10Kbps

So this module will transmit up to 90m in open area .

Receiver :

Working voltage: 5.0VDC +0.5V
Working current:≤5.5mA max
Working method: OOK/ASK
Working frequency: 315MHz-433.92MHz
Bandwidth: 2MHz
Sensitivity: excel –100dBm (50Ω)
Transmitting velocity: <9.6Kbps (at 315MHz and -95dBm)

 the use of an optional antenna will increase the effectiveness of your wireless communication. A simple wire will do the trick.

Step 2: Schematics

Picture of schematics
TX.png
the connection for this module is very easy .

for Transmitter :

Vcc >>>>5V
ATAD>>>D12"You can change it as you like from Software" .
Gnd >>> Gnd

Receiver :

Vcc>>>>5V
Data>>>D12
Gnd>>>Gnd
c0love9 days ago

I am looking to see if one of these transmitter modules can be used to replace an RF remote (for a remote controlled power outlet). Is it possible for these types of transmitter modules to receive any RF signal and capture what the RF code is so you can then use that RF code in the Arduino code to transmit it?

There are learning RF power outlets that can be programmed to any RF code and I would like to be able to control more receivers than the RF remote has buttons to control.

Thanks for the Instructable!

c0love9 days ago

Here is a direct link to the VirtualWire 1.14 library

http://www.open.com.au/mikem/arduino/VirtualWire/VirtualWire-1.14.zip

Raphango made it!9 days ago

Yay! \o/

Thank you! Got this working for myself!

IMG_20140410_211112.jpg
Alaa inv2 months ago

sketch_feb19e.ino: In function 'void setup()':

sketch_feb19e:10: error: expected `(' before 'vw_set_rx_pin'

sketch_feb19e:11: error: 'vw_setup' was not declared in this scope

sketch_feb19e:14: error: 'vw_rx_start' was not declared in this scope

sketch_feb19e.ino: In function 'void loop()':

sketch_feb19e:18: error: 'VW_MAX_MESSAGE_LEN' was not declared in this scope

sketch_feb19e:21: error: 'buf' was not declared in this scope

sketch_feb19e:21: error: 'vw_get_message' was not declared in this scope

mpring Alaa inv1 month ago

I've encountered that same problem too. Then I figured that there is a problem in the current VirtualWire. You have to download the old virtual wire and replace the one you have. It will work as soon as you put it in the library and restart arduino. I forgot the link but the name of the file is, "VirtualWire-1.14.zip". Just search it if you want.

Library is probably not installed correctly. see here for more details: https://groups.google.com/forum/#!topic/tronixstuff/JFvspcw6vIc
Alaa inv Alaa inv2 months ago

vw_set_ptt_inverted(true); // Required for DR3100

vw_set_rx_pin(12);
vw_setup(4000); // Bits per sec




Error

Alaa inv Alaa inv2 months ago

vw_set_ptt_inverted(true); // Required for DR3100

vw_set_rx_pin(12);
vw_setup(4000); // Bits per sec




Error

Alaa inv Alaa inv2 months ago

vw_set_ptt_inverted(true); // Required for DR3100

vw_set_rx_pin(12);
vw_setup(4000); // Bits per sec




Error

mnc1 month ago

question: how many modules can work at the same time without interference?

Druv1 month ago

Hi everyone

Actually I am doing a small project by using arduino. I want to measure the water level by using the ultrasonic sensor HCSR 04. Then I want to transmit the data via rf 433 MHz transmitter to a receiver. Can anybody help me to write the code for the transmitter and receiver? Thanks you

sekarganesh932 months ago

i wanna send different kind of text message through rf like "wanna meet you' & "please come to my office" , by using receiver side lcd (2*16) how to do that help me mohannad

karti2 months ago

can you control 2-4 Led's with only one set of rf 350 mhz transmitter and receiver modules?

ya it's possible by using of simple encoder and decoder circuits .....

palatis karti2 months ago

sure why not. you can send a byte number instead of character '0' and '1', and turn led on/off.

digitalWrite(D13, buf[0] & 0b00000001 ? HIGH : LOW);
digitalWrite(D12, buf[0] & 0b00000010 ? HIGH : LOW);
digitalWrite(D11, buf[0] & 0b00000100 ? HIGH : LOW);
digitalWrite(D10, buf[0] & 0b00001000 ? HIGH : LOW);
digitalWrite(D9, buf[0] & 0b00010000 ? HIGH : LOW);
digitalWrite(D8, buf[0] & 0b00100000 ? HIGH : LOW);
digitalWrite(D7, buf[0] & 0b01000000 ? HIGH : LOW);
digitalWrite(D6, buf[0] & 0b10000000 ? HIGH : LOW);

control up to 8 leds in 1 single byte.

karti palatis2 months ago
Oh, I did't know that, just a request could you send me the code, PLEASE. I can save up to 1000 on my project!!
PLEASE, thanks a LOT
karti2 months ago
maybe on my email: kartikeyagarwal06@gmail.com
karti2 months ago

hi guys, you know that you don't need such a complicated code,

if you just had something like the blinking LED code and you don't put the recover into input and you don't need to tell the Arduino that you are using transmitters and you connect the transmitters and recivers to the output pin you are useing, IT WORKS!!

Rowdyrobs made it!2 months ago

Thank you!

Trans_Re.jpg
Mohannad Rawashdeh (author)  Rowdyrobs2 months ago

So nice , You are welcome

penang14 months ago
hey help i got error in compile

transmitter:23: error: 'vw_set_ptt_inverted' was not declared in this scope
what should i do,help please.....
Rowdyrobs penang12 months ago

I had the same problem! But I found a good library that worked! Download this library and drop it off in the Arduino Library folder - good luck

http://www.airspayce.com/mikem/arduino/VirtualWire/

Mohannad Rawashdeh (author)  penang12 months ago

Library must be downloded and put the files of the library in the Libraries folder on the arduino Program file

this error refers to a library called "Virtual Library". vw_set_ptt_inverted is a declaration in this library. To get rid of this error download the arduino VirtualWire library.
Iberzokna2 months ago

Hi,

Thanks for the great instructable, I've made two simple temperature/humidity/pressure sensor devices, connected them with these RF modules and connected one of them to an LCD and to net.... It all works great with one problem: very short range.

Without antennas on receiver and transmitter, the range is only 1-2 cm, when I soldered 17cm (found somewhere that's the optimal length) wires on both of them, the range is 2-3m. That range is unusable for the purpose so please help... Is there anything I did wrong or the modules I ordered from ebay are bad (they look almost the same as those in photos in this instructable)?

Uploaded photo of the remote board. Although there are more modules currently connected, I had the same issue (range under 3m) when there was only the RF transmitter connected to the arduino and only receiver connected to the other arduino.

Thanks for any help..

Instructables.png
Mohannad Rawashdeh (author)  Iberzokna2 months ago

mmm I don't understand why ?! the range is about 40-80m experimentally ,are you check the RF Range alone at first ? Can you change the RF with another ? Power of the circuit ... can you Feed your circuit by enough power source "Example 5V-1A"

Thanks for the reply. The initial setup were 2 Arduinos, one with RF RX and the other one with RF TX, powered by a regulated supply set to 5V-2A. The range was 1-2cm without antennas.

In the mean time, I've found a forum thread where someone had the same issue, but only with 433MHz set, he ordered both 433 and 315 sets and the 315MHz set worked as supposed...

I've ordered the 315MHz set from the same supplier on ebay, I'll post here my findings.

mitell232 months ago

is there a way to have multiple transmitters send to one receiver? and to have the receivers do other things with data besides blink a light as a 1 or 0?

and can this be done with only one arduino (at the receiver)? and have another microcontroller of some sort sending the signal through the transmitter?

vineed2 months ago

please guys help me with this!!! Is their any possible way of controlling brushless motor connected via esc with this rf transmitter and receiver i am trying to make a wireless rf controller.

zx lee6 months ago
You didn't use any antenna on your RF module?

What is the benefits of using VirtualWire?
Mohannad Rawashdeh (author)  zx lee6 months ago
Yes , it's optional , without antenna you can send command up to 60m .with it it will be reach to 90m "not tested yet" .

VirtualWire is a lovely library that reduce too long code into just 5 commands ! so it's easy to use .
es, virtualwire is amazing
Mohannad Rawashdeh (author)  capacitor992 months ago

yes it's

capacitor994 months ago
So I have been using these types of RF transmitters and receivers to do simple stuff like when i press a button on one arduino it turns a LED on on another arduino (through the RF transmitter and receiver). However for a long time I have been struggling to send multiple messages in order for an arduino (e.g. Button 1 press -> sends button1 true, Button 2 press -> sends button2 true) but I can't figure out how to do this. Can you help, or is this even possible (which I'm pretty sure it is).
can you tell me how to glow the led on another arduino by pressing button on this arduino??
thanks in advance
Yashaswy Yashaswy3 months ago
dear friend,
I am struck with the circuit part..can u mail the circuit diagram to
yashaswyaln@yahoo.com ??
thanks
First you need to download the arduino VirtualWire library. After you do that, make sure you have the rf transmitter and receiver hooked up correctly (triple check this, for it is very easy to mess up and will destroy you transmitter and receiver if you have it wrong). Then upload this code to the arduino that has the transmitter hooked to it:

// TRANSMITTER CODE

//NOTE :- THIS TRANSMITTER CODE IS USED WHEN YOU WANT TO CONTROL THE ROBOT VIA THE BREADBOARD REMOTE
#include

//Assigning controller buttons to Digital Pins


const int buttonPin = 2;


int buttonState = 0;

void setup()
{
Serial.begin(9600); // Debugging only
Serial.println("setup");
// Initialise the IO and ISR
vw_setup(2000); // Bits per sec
vw_set_tx_pin(3); //Transmitter Data Pin to Digital Pin 3



pinMode(buttonPin, INPUT);
/*
This is what the loop above does :-
pinMode(8, INPUT);
pinMode(9, INPUT);
pinMode(10, INPUT);
pinMode(11, INPUT);
pinMode(12, INPUT);

digitalWrite(8, HIGH);
digitalWrite(9, HIGH);
digitalWrite(10, HIGH);
digitalWrite(11, HIGH);
digitalWrite(12, HIGH);*/
}//close setup

void loop()
{

buttonState = digitalRead(buttonPin);




char *msg2;

if (buttonState == HIGH) {
char *msg2 = "1";//send 1 to the receiver
digitalWrite(13, true); // Flash a light to show transmitting
vw_send((uint8_t *)msg2, strlen(msg2));//send the byte to the receiver
vw_wait_tx(); // Wait until the whole message is gone
digitalWrite(13, false);
}


}//close loop

// End Of Code

-------------------------------------------------------

Then upload this code to the arduino with the receiver hooked to it:

// RECIEVER CODE

//NOTE :- THIS CODE IS USED WHEN CONTROLLING THE ROBOT VIA THE BREADBORD REMOTE

#include

//declaring pin nos to FIRST L293D
int ledPin = 13;

void setup()
{
Serial.begin(9600); // Debugging only
Serial.println("setup");

// Initialise the IO and ISR
vw_setup(2000); // Bits per sec
vw_set_rx_pin(2); //Rx Data pin to Digital Pin 2
vw_rx_start(); // Start the receiver PLL running

pinMode(ledPin, OUTPUT);

}//close setup

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

if (vw_get_message(buf, &buflen)) // Non-blocking
{
int i;

digitalWrite(13, true); // Flash a light to show received good message
// Message with a good checksum received, dump it.
for (i = 0; i < buflen; i++)
{
Serial.print(buf[i]);//print received command
if(buf[i] == '1')//if button 1 is pressed.... i.e.forward buton
{
digitalWrite(ledPin, HIGH);
delay(1000);
}
digitalWrite(ledPin, LOW);
}//close if
}//close loop


---------------------------------------------------------------------
You can change the pins as needed :)
Also for those wondering this same question, I found another great tutorial that explains this (Use example code in tutorial):
http://www.instructables.com/files/orig/FG5/UK2M/HMVJ9L83/FG5UK2MHMVJ9L83.txt
tester4 months ago
Does it matter how long external antenna I will connect to Transmitter? Should it be 30cm or 25cm, straight or curve - does it really matters? thanks
The antenna depends on the strength of the transmitter, if its to long, it wont do anything, if its to short, no noticeable effect will be seen.
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!