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 .


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.

<p>Will receiver work at 3.7 V? I want to operate it by Li-ion battery. </p>
<p>I am using FS1000A, it can operate from 2,5V to 12V, only tested at 5V. First time today to work with these RF parts</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>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>
Would it matter that I'm using an Arduino UNO and a dfRobot - duino?<br><br>My receive sketch is hanging: http://forum.arduino.cc/index.php?topic=350312.0
Please explain to me how to reduce the effective range to a few meters say (5m)... I am in a scenario that nearby car-key transmitters may trigger a relay switch I am working on!!
<p>it does not compile</p>
<p>Are you using the latest version of Arduino IDE? That might be the problem, the library files VirtualWire.cpp and VirtualWire.h aren't compatible with later versions of Arduino. The quick fix is get the updated version of the library virtualWire. The longer fix is to add the lines in the VirtualWire.cpp file<br>#if defined(ARDUINO)<br> #if (ARDUINO &lt; 100)</p><p>Before the line<br> #include &quot;WProgram.h&quot;</p><p>and</p><p>Adding the following in the VirtualWire.h file:</p><p>#include &lt;stdlib.h&gt;<br>#if defined(ARDUINO)<br> #if ARDUINO &gt;= 100<br> #include &lt;Arduino.h&gt;<br> #else</p><p>before </p><p>#include &lt;wiring.h&gt;</p>
Yes Im using 1.6.5 the latest version. <br>Possibly that's the problem.<br>Thanks
<p>it does not compile</p>
<p>If i put the RF receiver into a completely sealed box, will the receiver still be able to receive data? or should i put an antenna outside the box connecting the rf reciever inside? </p>
<p>completely sealed? Then No, but i doubt your are going to have it sealed against such small waves as 315 mhz. Yes antenna outside of box for a good range</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>
<p>those are 2 separate and unrelated issues, first make sure its working, then worry about increasing range</p>
<p>this code does not work</p>
<p>worked fine for me, what was your error?</p>
<p>Hello Mohanad,</p><p>Great instructable, thanks for sharing with us.</p><p>I wanted to ask is there a way to send raw bits?<br>For example if I wanted to send those bits &quot;0010110&quot; and receive them as is, is there a way to do that other than sending the stream as a string using VirtualWire library?</p>
<p>hello, i need help</p><p>I am designing a distance meter, but for that I will use (read) the signal strength value (the RSSI technique) sent by TX. I will can do with this RX and TX?</p>
<p>hello, i need help</p><p>I am designing a distance meter, but for that I will use (read) the signal strength value (the RSSI technique) sent by TX. I will can do with this RX and TX?</p>
<p>Hi. I am a lighting designer, trying to wirelessly turn on/off LED lights, wirelessly. I have a 4 channel transmitter/receiver (see images). The first channel would be an all on/off, for the other 3 channels, their loads 1amp, each. Does anyone have an idea of how I would complete this task? Thank you SO much, in advance.</p>
<p>I am not sure eaxactly what yr TxRx pair does but if you already have 4 channels then let yr arduino react to those 4 channels with the desired action.<br>Ofcourse you do not need 4 channels as you can just send codes through 1 channel and let your arduino switch the desired outputs for your lights. You can either do that with a relay or a Thyristor or Triac.<br>Without more info on what u exactly want it is hard to tell u more</p>
<p>How do I Make the antenna, and where do I attach?</p>
<p><a href="http://www.instructables.com/id/433-MHz-Coil-loaded-antenna/" rel="nofollow">http://www.instructables.com/id/433-MHz-Coil-loade...</a></p><p>attach to the little hole marked antenna</p>
<p>More on antenna theory, links to calculators for different antennas, and a cool project to try can be found here: <a href="http://www.whatisacnc.com/pages/Antenna-Radio.PHP" rel="nofollow">http://www.whatisacnc.com/pages/Antenna-Radio.PHP </a> </p><p>An index to those calculators here: http://www.whatisacnc.com/pages/antenna </p>
<p>Interesting. I have used the Tx-Rx modules as shown here quite frequently.<br>You are right, asimple wire antenna (17.3 cm makes a difference, but in my experience 90 m is highly overrated.<br>With the 17.3 wire antenna maybe i came to 6 meters. The Transmitter module is pretty good, but the receiver is crap.<br><br>What does make a difference though is the antenna. I have used the straight wire antenna but found the following simple antenna makes a BIG difference</p><p><a href="http://www.instructables.com/id/433-MHz-Coil-loaded-antenna/" rel="nofollow">http://www.instructables.com/id/433-MHz-Coil-loade...</a></p>
<p>Is it possible to send and read analog signals? (maybe without the library?)</p><p>I've tried plugging 5V into the receiver and grounded it, then tested the data pins with leds connected from them to GND and they shine/flicker. However if I try analogRead it reads a constant value of 15 (even when unplugged).</p>
<p>Arduino: 1.5.7 (Windows 8), Board: &quot;Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)&quot;</p><p>In file included from transmitter.pde:6:0: <br>C:\Program Files (x86)\Arduino\libraries\VirtualWire/VirtualWire.h:14:20: fatal error: wiring.h: No such file or directory <br> #include <br> ^ <br>compilation terminated.</p><p> This report would have more information with <br> &quot;Show verbose output during compilation&quot; <br> enabled in File &gt; Preferences.</p><p>i was trying to compile trasmitter example aaaaand this error appeared</p>
<p>same issue i have faced.Do you have any solution for it</p>
<p><a href="https://www.pjrc.com/teensy/td_libs_VirtualWire.html" rel="nofollow">https://www.pjrc.com/teensy/td_libs_VirtualWire.ht...</a></p><p>dowload this library :) it works for me</p>
<p>Hi spudz.</p><p>I'm using Arudino 1.6.3, and had the same problem that you dit. This is how I fixed it...</p><p>You have to edit some files in VirtualWire library:</p><p>- in VirtualWire.h change:</p><blockquote>#include &lt;wiring.h&gt; to #include &lt;Arduino.h&gt;</blockquote><p>- in VirtualWire.cpp change:</p><blockquote>#include &quot;WProgram.h&quot; to #include &quot;Arduino.h&quot;<br></blockquote><p>After that restart Arduino studio and compile the program again.</p><p>Hope it helps you to.</p>
it helped, thanks!
<p>I am not sure if the missing library in your listing is an html problem or that you do not have it included in yr program, but that could be yr problem</p>
<p>You must install the VirtualWire library before compile the code, you can download it from the article where it says: &quot;<a href="http://www.seeedstudio.com/depot/images/product/VirtualWire.rar" rel="nofollow"><strong>First Download the library from Here .</strong></a>&quot;. Afterwards, uncompress it to your arduino library folder which is in this case: &quot;C:\Program Files (x86)\Arduino\libraries\&quot;<br>After doing this, close all arduino compiler interfaces and you should see a new set of examples. The code is now able to run. Good luck ;) </p><p>.</p>
<p>i install the VirtualWire library but i face a lot of errors.i have paste all the errors below.please give me the solution asap.</p><p>In file included from transmitter.cpp:11:</p><p>C:\Users\decent\Documents\Arduino\libraries\VirtualWire/VirtualWire.h:54: error: variable or field 'vw_set_tx_pin' declared void</p><p>C:\Users\decent\Documents\Arduino\libraries\VirtualWire/VirtualWire.h:54: error: 'uint8_t' was not declared in this scope</p><p>C:\Users\decent\Documents\Arduino\libraries\VirtualWire/VirtualWire.h:58: error: variable or field 'vw_set_rx_pin' declared void</p><p>C:\Users\decent\Documents\Arduino\libraries\VirtualWire/VirtualWire.h:58: error: 'uint8_t' was not declared in this scope</p><p>C:\Users\decent\Documents\Arduino\libraries\VirtualWire/VirtualWire.h:62: error: variable or field 'vw_set_ptt_pin' declared void</p><p>C:\Users\decent\Documents\Arduino\libraries\VirtualWire/VirtualWire.h:62: error: 'uint8_t' was not declared in this scope</p><p>C:\Users\decent\Documents\Arduino\libraries\VirtualWire/VirtualWire.h:66: error: variable or field 'vw_set_ptt_inverted' declared void</p><p>C:\Users\decent\Documents\Arduino\libraries\VirtualWire/VirtualWire.h:66: error: 'uint8_t' was not declared in this scope</p><p>C:\Users\decent\Documents\Arduino\libraries\VirtualWire/VirtualWire.h:71: error: variable or field 'vw_setup' declared void</p><p>C:\Users\decent\Documents\Arduino\libraries\VirtualWire/VirtualWire.h:71: error: 'uint16_t' was not declared in this scope</p><p>C:\Users\decent\Documents\Arduino\libraries\VirtualWire/VirtualWire.h:90: error: 'uint8_t' does not name a type</p><p>C:\Users\decent\Documents\Arduino\libraries\VirtualWire/VirtualWire.h:96: error: 'uint8_t' does not name a type</p><p>C:\Users\decent\Documents\Arduino\libraries\VirtualWire/VirtualWire.h:99: error: 'uint8_t' does not name a type</p><p>C:\Users\decent\Documents\Arduino\libraries\VirtualWire/VirtualWire.h:104: error: 'uint8_t' does not name a type</p><p>transmitter.cpp: In function 'void setup()':</p><p>transmitter.pde:-1: error: 'vw_set_ptt_inverted' was not declared in this scope</p><p>transmitter.pde:-1: error: 'vw_setup' was not declared in this scope</p><p>transmitter.cpp: In function 'void loop()':</p><p>transmitter.pde:-1: error: 'vw_send' was not declared in this scope</p>
I installed the library but it doesn't matter now cause i fixed it myself by downgrading from 1.5.6. Ide to 1.0.6.ide and it worked
<p>Pls I need help to rectify this errors </p><p>Arduino: 1.5.8 (Windows 8), Board: &quot;Arduino Uno&quot;</p><p>Build options changed, rebuilding all</p><p>Using library VirtualWire in folder: C:\Users\Documents\Arduino\libraries\VirtualWire (legacy)</p><p>C:\Program Files (x86)\Arduino/hardware/tools/avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=158 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard -IC:\Users\Documents\Arduino\libraries\VirtualWire C:\Users\AppData\Local\Temp\build8942404980792644047.tmp\Receiver_rx.cpp -o C:\Users\AppData\Local\Temp\build8942404980792644047.tmp\Receiver_rx.cpp.o </p><p>Receiver_rx.ino: In function 'void setup()':</p><p>Receiver_rx.ino:18:17: error: 'recieve_pin' was not declared in this scope</p><p>Receiver_rx.ino: In function 'void loop()':</p><p>Receiver_rx.ino:32:3: error: 'unit8_t' was not declared in this scope</p><p>Receiver_rx.ino:32:11: error: expected ';' before 'buf'</p><p>Receiver_rx.ino:37:22: error: 'buf' was not declared in this scope</p><p>Receiver_rx.ino:37:28: error: 'buflen' was not declared in this scope</p><p>Error compiling.</p>
<p>Doesn't complile.</p><p>VirtualWire.h:14:20: fatal error: wiring.h: No such file or directory</p><p>Where does this file come from?</p>
<p>better into (and newer versions) of the VirtualWire library are here:</p><p>https://www.pjrc.com/teensy/td_libs_VirtualWire.html</p>
<p>Great! This new library solve the problem! Awesome! Thanks!</p>
<p>good to know. Mind you though that virtualWire is at the end of its lifespan and is being replaced by 'radiohead' <a href="http://www.airspayce.com/mikem/arduino/VirtualWire/" rel="nofollow">http://www.airspayce.com/mikem/arduino/VirtualWire...</a><br>there is ofcourse also 'Manchester code'</p>
<p>It is a very good tutorial.First time rf worked for me!</p>
<p>i've got these modules and i was using them with HT12E and HT12D ICs without micro controller and they work, but they don't work without an antenna. any ideas about how to make the best antenna for that module?</p>
<p>How would one handle interference with multiple TX/RX? </p>
<p>Awesome tutorial! I was wondering. Does controller have to be integer? or can it be a string ??</p>
<p>I seem to remember that vw cannot send strings</p>
<p>I am using RF module of 434MHz.I am sending small text from transmitter to receiver ,for that i am using virtual wire library.After receiving the text at receiver site I want to play small audio file.I am using PCM library for playing sound file on arduino ,because my audio file is very small and i don't want to use external memory.but the problem is when I import virtual wire and PCM in same code at receiver it is throwing error.I am beginner in arduino so I am not getting why it is not allowing both library together. <br>I am using arduino leonardo at transmitter site and Uno as receiver. <br>Is their any solution through which I can play my audio file at receiver without using sd card?</p>

About This Instructable


442 favorites


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