loading
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" .

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.

Advertisement

<p>Cool project so I did a test variation to sync LED's on the Transmitter and receiver for blinking pendants. For the most part they sync up almost all the time when in close enough proximity. I'm going to put more matching LED routines on both the Arduinos'; the receiver and the transmitter, later when it is working in full. What I'm missing in the code, on the receiver side, is for it to continue blinking in sync. after the receiver and transmitter are out of range. I know there will be some drift and they will become more out of sync as time passes and that's ok. I need some help with the code and suggestions of how to accomplish this task. Here is what I have:</p><p>// simple Tx on pin D12</p><p>//<br>Written By : Mohannad Rawashdeh</p><p>//<br>3:00pm , 13/6/2013</p><p>//..................................</p><p>#include &lt;VirtualWire.h&gt;</p><p>void setup()</p><p>{</p><p>Serial.begin(9600); //Make sure the serial monitor is activated</p><p>//<br>or the program will remain idle</p><p>Serial.println(&quot;Device is ready&quot;);</p><p>//<br>Initialize the IO and ISR</p><p>vw_set_ptt_inverted(true); // Required for DR3100</p><p>vw_set_rx_pin(12); // setup pin 12 for dats reception from transmitter</p><p>vw_setup(4000);// Bits per sec</p><p>pinMode(13, OUTPUT); /* LED comes on when unit receives first signal</p><p>which is &quot;01&quot; from transmitter, and turns off when it receives<br>&quot;00&quot; from transmitter</p><p>*/</p><p>pinMode(5, OUTPUT);</p><p>pinMode(6, OUTPUT);</p><p>pinMode(7, OUTPUT);</p><p>vw_rx_start();// Start the<br>receiver PLL running</p><p>}</p><p>void loop()</p><p>{</p><p>uint8_t buf[VW_MAX_MESSAGE_LEN];</p><p>uint8_t buflen = VW_MAX_MESSAGE_LEN;</p><p>if (vw_get_message(buf, &amp;buflen)) // Non-blocking</p><p>{</p><p>if(buf[0]=='1'){</p><p>digitalWrite(13,1);</p><p>Serial.print(&quot;First Number =&quot;);</p><p>Serial.println( buf[0]-'0' );</p><p>digitalWrite(5,1); // Turn LEDs on for .5 of a second</p><p>delay (500);</p><p>digitalWrite(5,0);</p><p>delay (500);</p><p>digitalWrite(6,1);</p><p>delay (500);</p><p>digitalWrite(6,0);</p><p>delay (500);</p><p>digitalWrite(7,1);</p><p>delay (500);</p><p>digitalWrite(7,0);</p><p>delay (500);</p><p>digitalWrite(5,1); // Turn LEDs on for .5 of a second</p><p>delay (200);</p><p>digitalWrite(5,0);</p><p>delay (200);</p><p>digitalWrite(6,1);</p><p>delay (200);</p><p>digitalWrite(6,0);</p><p>delay (200);</p><p>digitalWrite(7,1);</p><p>delay (200);</p><p>digitalWrite(7,0);</p><p>delay (200);</p><p>Serial.println(&quot;&quot;);</p><p>}</p><p>if(buf[0]=='0'){</p><p>digitalWrite(13,0);</p><p>// delay(1000);</p><p>Serial.print(&quot;Second Number =&quot;);</p><p>Serial.println( buf[0]-'0' );</p><p>Serial.println(&quot;&quot;);</p><p>}</p><p>}</p><p>}</p>
<p>I noticed, that some of the comment outs &quot; // &quot; some how moved a line when I copy/pasted it above....</p>
<p>Can I have the Transmitter work without an Arduino or micro-controller? What I have in mind is to power the transmitter with a 5V battery, then have a switch connected to ATAD so that the switch will tell the transmitter to send a signal or not depending on the state of the switch. The receiver unit would be connected to a micro-controller.</p>
<p>i am making a gesture based robot using rf transmitter and reciever with arduino do i need encoder and decoder ??</p>
<p>You shall use RadioHead, the library that supersedes &amp; replaces the obsolete Virtual Wire.</p><p>Same functionalities plus a lot more:</p><p>- takes all the advantage of all available radio modules (not only ASK, incl. bi-directional transceivers as well, different coding/modulation...)</p><p>- includes client-server, security....</p><p>- able to work on TIMER2, if you need TIMER1 for something else...</p><p> http://www.airspayce.com/mikem/arduino/RadioHead/classRH__ASK.html </p>
<p>can you make this library work with Attiny13 ? </p>
<p>Hey, Its works well with Radiohead. But when I try to power my transmitter with 9V battery (see if Tx goes further) but leave datapin in 12, I have no transmission anymore ?????? Anybody knows why ??</p>
<p>Not sure I get your point. </p><p>Do you mean it works with 5V, but not anymore when you power the transmitter with 9V?</p><p>One important thing here is to make sure both power sources have the same (GND) reference, e.g. both grounds are connected.</p><p>If they are not connected, both circuits are &quot;floating&quot;, it means there is no reference for the DATA pin on the transmitter</p><p>In basic words, when there is a 0v/5v signal on arduino pin 12, it's 0v/5v relative to arduino ground. If arduino ground and transmitter ground are not connected, there is no way for the transmitter to guess the reference, hence to read the data coming from arduino.</p><p>See second schematics bellow.</p>
<p>Hey Thanks, indeed a common ground solves it ! Thank you very much for your reply !</p><p>Tkx, Leo</p>
<p>can you make it work with ATtiny13a chip ? <br>I tried all three libraries (VirtualWire, Manchester, RadioHead) but got no luck. all of them works fine with UNO (or any other standard Arduino) or with 8MHz or 16MHz clock but not with ATtiny13 which has 9.6 , 4.8 and 12 MHz internal watchdog oscillator. <br>with Virtual wire I got this and many other error messages like this one : </p><p><strong>'TCCR1A' was not declared in this scope</strong></p><p><strong>Manchester lib </strong>works with 8MHz, 16MHz or with 328P Processor.(shows as error when begin compiled with board selected &quot;Attiny13&quot;)</p><p>and RadioHead also gives error like &quot; XXXX not declare in the scope&quot;<br></p><p>any help will be appreciated ! :) <br>Thanks.</p>
<p>Before I buy this set, has anyone that has played with these looked on the transmitter and been able to see the quartz chrystal? I am trying to control a remote control car by arduino. I have already done experiments where I tear the car apart and equip it with the correct hardware and get remote control that way. But now I want to leave the car completely untouched and create a new controller for it using arduino. I after doing some reading I see that changing the quartz chrystal on the transmitter to match the receiving frequency of the car might get me in the right direction. In the pictures above, is the quartz chrystal located in the silver cylinder that I see on the transmitter? Or is that an antenna?</p>
<p>hi,can voice transmission be done with these?</p>
<p>Probably not. </p><p>A review on amazon showed that it didn't work for real-time voice transmission. </p>
<p>Hi I`m a Engineering Student fro Philippines <br>i`m looking for a shop where i can buy this 433Mhz Transmitter and receiver<br>:) <br>hope you can give me some<br><br>thank you in advance</p>
EBay
<p>www.aliexpress.com</p>
<p>http://www.ebay.com/itm/351552385074?_trksid=p2057872.m2749.l2649&amp;ssPageName=STRK%3AMEBIDX%3AIT</p>
<p>Hi,</p><p>I can connect to a signal amplifier?</p><p>What kind of amplifier?</p>
hi,<br><br>can this be use for 1-2km range?
<p>use Xbee module.... It can give more range...upto 50Kms if used highest power module.</p>
<p>I need to use the RF module to control 4wheel drive motor control with L293D IC. Where can i get the code? Please give a link...! </p>
<p>write it yourself... this is instructables, meaning that someone has probably done a 'how to code' page</p>
<p>Can the transmitter be configured to transmit exactly at 433.68 MHZ?</p>
It's a good question. I also would like to change the frequency of the modules.
<p>I want to use this modules to monitor some sensor, but I want to make each one a transmitter, and do one arduino MEGA as a central unit which receives the data of many of these modules.</p><p>How many signals can a receiver have before it stops working?</p>
<p>It works! Thank you...This really helps with my project. Now I have to implement a photosensor and PIR into these programs. </p>
<p>Why using a another library instead of the SoftwareSerial library?</p>
<p>Those modules works pretty well with this easy to use domotic system: <a href="https://github.com/roccomuso/iot-433mhz" rel="nofollow">https://github.com/roccomuso/iot-433mhz</a></p><p>Totally open source and easy customizable :)</p>
<p>download this file for the code to work completely. once downloaded extract and put it in this location </p><p>C:\Program Files (x86)\Arduino\libraries</p><p>The link..</p><p><a href="https://www.pjrc.com/teensy/arduino_libraries/VirtualWire.zip" rel="nofollow">https://www.pjrc.com/teensy/arduino_libraries/Virt...</a></p>
<p>This helped me to get rid of wiring.h was missing.</p><p>Thanks</p>
<p>still have wiring.h missing </p><p>can not compile the sketch</p>
<p>thank you SuryaK8.</p><p>This .zip file works perfectly.</p><p>I added the .zip file directly from the IDE.</p><p>Can you suggest me a method to send a PWM signal over rf 433Mhz Transmitter Receiver Module? I am trying to run a ESC via the receiver of the RF combo.</p>
<p>Had a small problem with library but downloaded</p><p> <a href="https://www.pjrc.com/teensy/arduino_libraries/VirtualWire.zip" rel="nofollow">https://www.pjrc.com/teensy/arduino_libraries/Virt...</a></p><p>And all works ok.</p>
<p>Thanks for sharing this solution</p>
<p>cheers mate had the same problem</p>
I was wondering if this can be programmed for length and i wanted to know how
<p>Keeps saying some functions are not defined in scope. what does this mean? how do i fix this???</p>
<p>Hi, I need transmit 1 KM, what should I change to get more gain? Thank you!</p>
<p>Thanks for this. After a long time after searching the internet I've actually got my RF module to working.</p><p><strong>Question</strong>: How do I access the string that it receives, what's the variable called? I want to <em>serial.println</em> to my computer but don't know what to have as the argument of the function.</p>
<p>I think it's stored in buf[0]. However, the values received in the serial monitor are 48 and 49 - these are decimal for ascii 0 and 1 respectively. See my question I posted here: <a href="http://www.instructables.com/answers/Arduino-How-do-I-convert-a-decimal-to-ASCII/" rel="nofollow">Arduino: How do I convert a decimal to ASCII?</a></p>
<p>It is stored in buf[0]. However, if you want to serial.print(buf[0]);, you'll get 48 &amp; 49 in your serial monitor. This is decimal for 0 and 1 in ASCII. To solve this, you need to say Serial.println( buf[0]-'0' ). Thanks to <a href="http://www.instructables.com/member/steveastrouk/" rel="nofollow">steveastrouk</a> for pointing this out.</p>
so can i use the receiver to recieve radio stations if i hook up power and speaker.?
<p>Can I control servo using MPU6050 wirelessly using this?</p>
<p>Thanks for this!</p><p>I just have a question, I am trying to implement certain code when no signal is received. For example, when my receiver is out of range. Does anyone have any ideas for checking the status and determining when there is no message?</p>
If I put else statement to do another work when signal is not receiving it doesnt work..what should I do..I m using arduino uno..
<p>here is my code</p><p>#include &lt;VirtualWire.h&gt;</p><p> int leftmotorforward =11;</p><p> int leftmotor2forward=3;</p><p> int rightmotorforward=6;</p><p> int rightmotor2forward=5;</p><p>void setup()</p><p>{</p><p> Serial.begin(9600); // Debugging only</p><p> Serial.println(&quot;setup&quot;);</p><p> pinMode(13,OUTPUT);</p><p> pinMode(leftmotorforward,OUTPUT);</p><p> pinMode(leftmotor2forward,OUTPUT);</p><p> pinMode(rightmotorforward,OUTPUT);</p><p> pinMode(rightmotor2forward,OUTPUT); </p><p> vw_set_rx_pin(8);</p><p> // Initialise the IO and ISR</p><p> vw_setup(2000); // Bits per sec</p><p> vw_rx_start(); // Start the receiver PLL running</p><p>}</p><p>void loop()</p><p>{</p><p> uint8_t buf[VW_MAX_MESSAGE_LEN];</p><p> uint8_t buflen = VW_MAX_MESSAGE_LEN;</p><p> if (vw_get_message(buf, &amp;buflen)) // Non-blocking</p><p> {</p><p> int i;</p><p> digitalWrite(13, true); // Flash a light to show received good message</p><p> // Message with a good checksum received, dump it.</p><p> Serial.print(&quot;Got: &quot;);</p><p> for (i = 0; i &lt; buflen; i++)</p><p> {</p><p> Serial.print(buf[i]);</p><p> Serial.print(&quot; &quot;);</p><p> if (buf[i]=='1'){</p><p> speedcontrol();}</p><p> if( buf[i]=='2'){</p><p> off();}</p><p> }</p><p> Serial.println(&quot;&quot;);</p><p> digitalWrite(13, false);</p><p> }</p><p> else {</p><p> driveforward();}</p><p>}</p><p> void speedcontrol()</p><p>{</p><p> analogWrite(leftmotorforward,100);</p><p> analogWrite(leftmotor2forward,100);</p><p> analogWrite(rightmotorforward,100);</p><p> analogWrite(rightmotor2forward,100);</p><p> delay(2000);</p><p> analogWrite(leftmotorforward,0);</p><p> analogWrite(leftmotor2forward,0);</p><p> analogWrite(rightmotorforward,0);</p><p> analogWrite(rightmotor2forward,0);</p><p>}</p><p>void driveforward()</p><p>{ </p><p> analogWrite(leftmotorforward,200);</p><p> analogWrite(leftmotor2forward,200);</p><p> analogWrite(rightmotorforward,200);</p><p> analogWrite(rightmotor2forward,200);</p><p> delay(50);</p><p> analogWrite(leftmotorforward,0);</p><p> analogWrite(leftmotor2forward,0);</p><p> analogWrite(rightmotorforward,0);</p><p> analogWrite(rightmotor2forward,0);</p><p>}</p><p>void off()</p><p>{ </p><p> digitalWrite(leftmotorforward,LOW);</p><p> digitalWrite(leftmotor2forward,LOW);</p><p> digitalWrite(rightmotorforward,LOW);</p><p> digitalWrite(rightmotor2forward,LOW);</p><p>}</p>
<p>Never mind, I figured it out. If anyone else needs to do the same thing, I used the vw_wait_rx_max(time) function and set the time in milliseconds. This function from the library allows for the Arduino to wait for a character and if nothing is received within the set amount of time it will return false, if a character was receive, it will return true.</p>
<p>how to connect the rf with just one arduino board? or must be two?</p>
<p>It may be possible to write a rx_tx code that will transmit and receive to the same board but it would be extremely unusual and would serve no real purpose. I would just buy another clone arduino for $5 so you can have one running the TX code and one receiving it</p>
<p>How do I increase the transmission range? I got regular breadboard wire as antennas about 20cm long. I tried powering the transmitter with a 9v battery. Also, I tried to lower the bps rate to 1000. It didn't increase the range at all and worse it wasn't able to transmit. </p>

About This Instructable

858,390views

639favorites

License:

More by Mohannad Rawashdeh:Motor Driver BTS7960 43A BYJ48 Stepper Motor RF 315/433 MHz Transmitter-receiver Module and Arduino 
Add instructable to: