loading

Hello everyone ! in this artical i will try to update my older artical about RF ASK 315MHz and 433MHz ,with more application and update the library i used before

First it might be good to check my older artical about RF433/315MHZ from here

with many feedback arrived me about it, i decided to fix many issue like:

  1. Using Radio head Library , more better and a comprehensive library .
  2. Using a module from Seeedstudio comes with antenna to see if it will increase the range of Tx and Rx.
  3. add more codes and video for this RF.

let's start with component we need

Step 1: Components and Software

  1. Arduino Board x 2 pcs "You can choose any 2 board type you want
    I used Uno and Nano to do this experiment.
  2. RF315/433 module, You can buy it from
    Seeedstudio I used This one
    Aliexpress
    amazon

  3. Breadboard
  4. Jumper wire
  5. if you choosed seeedstudio grove module, you need this type of wires with them too
  6. Power source"you can use power bank or 9V battery or even your PC usb port , it's up to you

You need to have an arduino IDE , you can download it from here.

I tested it on arduino 1.5.2 , 1.5.5 and newer 1.6.9 and worked well on them all.

you need also to download Radio head library and install it inside arduino library folder

Step 2: Simple Code- Blink Rx Led

first i will write a simple code, sending from RF Tx a signal each 2 second to turn on-off led attached to D13

connection is very simple , you can see the Tx and Rx connection.

I powered my circuits from power bank to test the maximum range of this module.

The transmitter code

<p>/*<br>RF433 MHz Tx code
this code for turn on and LED on receiver side
every 2 seconds
connect the Data pin to pin 12
written By: Mohannad Rawashdeh
13 Feb 2017
visit my instructables profile for more information
<a href="https://www.instructables.com/member/Mohannad%20Rawashdeh/?publicView=true</p">
https://www.instructables.com/member/Mohannad%20R...</a>><p>*/
#include <rh_ask.h>
#include <spi.h> // Not actually used but needed to compile
RH_ASK Rawashdeh;
const int LEDpin=13;// indicator pin
const int delayTime = 2000;
const char *On_command = "1";
const char *Off_command = "0";
void setup()
{
  pinMode(LEDpin,OUTPUT);
    while (!Rawashdeh.init())
    {
  // no RF connected ! or error on initi
      digitalWrite(LEDpin,1);
      delay(100);
      digitalWrite(LEDpin,0);
      delay(100);      
    }
}</spi.h></rh_ask.h></p><p>void loop()
{
 Rawashdeh.send((uint8_t *)On_command, strlen(On_command));
 Rawashdeh.waitPacketSent();
 delay(delayTime);
 Rawashdeh.send((uint8_t *)Off_command, strlen(Off_command));
 Rawashdeh.waitPacketSent();
 delay(delayTime); 
}</p>

the receiver code

<p>/*<br>RF433 MHz Rx code
this code for turn on and LED on receiver side
every 2 seconds
connect the Data pin to pin 11
written By: Mohannad Rawashdeh
13 Feb 2017
visit my instructables profile for more information
<a href="https://www.instructables.com/member/Mohannad%20Rawashdeh/?publicView=true</p">
https://www.instructables.com/member/Mohannad%20R...</a>><p>*/
#include <rh_ask.h>
#include <spi.h> // Not actually used but needed to compile
RH_ASK Rawashdeh;
const int LEDpin=13;// indicator pin
const int delayTime = 2000;
const char *On_command = "1";
const char *Off_command = "0";
void setup()
{
//  RH_ASK(2000,11,12,10,false);
  pinMode(LEDpin,OUTPUT);
  if (!Rawashdeh.init())
  {
  // no RF connected ! or error on initi    
  digitalWrite(LEDpin,1);
  delay(100);
  digitalWrite(LEDpin,0);
  delay(100);          
  }
}</spi.h></rh_ask.h></p><p>void loop()
{
    uint8_t buf[RH_ASK_MAX_MESSAGE_LEN];
    uint8_t buflen = sizeof(buf);</p><p>    if (Rawashdeh.recv(buf, &buflen)) // Non-blocking
    {
      if(buf[0]=='1')
      {
  digitalWrite(LEDpin,1);        
      }
      if(buf[0]=='0')
      {
  digitalWrite(LEDpin,0);        
      }      
    }
}</p>

Step 3: Add Button on Transmitter Side to Gain More Control

if you want to send the signal to receiver and control when the led must turn on, we can add button to transmitter circuit and connect it to pin D2

Rather than using LED you can connect Relay , Servo motor , DC motor and control it from transmitter side.

Step 4: Send a Command From Serial Monitor

If you looking for upgrade the way you want to control RF module by,you can send a command from serial monitor.

no need to change the receiver code , all you need is to upload this code to transmitter arduino board and open a serial monitor

set the buad rate to 19200

Send X character to turn on the LED on the receiver

Send Y character to turn on the LED on the receiver

You can design an application on PC or MAC with interface to control this module for more advance project.

Finally:

I powered my circuits from power bank to test the maximum range of this module.
actually it was not that much of improvement as i expected,even with antenna the range in open area was around 44 meter , and inside my home it was about 20m max.

I noticed something from my experience :

  • the range will be less if you put the Tx and Rx near WiFi router.
  • the range will be less if you put the Tx and Rx near electricity transmission line "High voltage".
  • if you touch the antenna the data might be lost
  • the range will be less if you put the Tx and Rx near Microwave oven.

  • the Transmitter will be more better if you install it on higher level "altitude"than the receiver

hope to hear your questions and suggestions about this artical in the comment below or on my facebook page from here

Step 5: Video to Summarize Everything

in this video you can see the connection and short demo for the code.

see the video from Here

<p>Hello Mohannad</p><p>I need some help to work out what arduino requirments I need for the following.<br><br>I have designed a machine a in my home workshop that I now want to add an RF transmitter and RF receiver to, thereby controlling the machine by remote radio control. The machine in it's present form is controlled by the user pressing either one of two single axis joysticks that power each individual 24v dc motor thereby driving a single wheel. So I've designed a remote control box using the same joysticks ( there are 2 joysticks used on the remote ) and all I need is someone to describe the type of reliable RF transmitter and RF receiver and associated parts that I need to add to the machine to convert from user controlled to radio remote control. The joysticks operate on 5volts ( 5.1 - 4.9 tolerance ).<br><br>I'm guessing here but based on my research I need to convert the electrical signal from either or both joysticks ( on the remote unit ) then encode that data, then transmit to the receiver (machine) then decode then send to the variable speed controllers as if this data was directly from the machine joysticks.<br><br>So what exactly would I require in parts to complete this project. FWIW, I have good programming skills and reasonable basic understanding of electronics.<br><br>Are there any quality tutorials on this subject of arduino radio control? <br><br>Any all help is much appreciated. <br><br></p><p>Thanks</p><p>Dazzy</p>
<p>for your project , you can use this RF , connect the joystick to Tx and you need to read the joystick axis voltage and on the receiver side you need MCU+RF receiver and if you want to control the motor on/off , use the realy , otherwise if you want to control the speed of the motor , you need a motor driver , something like this <a href="https://goo.gl/SNqub3" style="">https://goo.gl/SNqub3<br></a></p>
<p>Hello, can you tell me how much distance the transmitter can cover? I.E. 1 mile?</p>
<p>Hello there ! <br>about the distance it's not more than 100m with the antenna.<br>do you need something with long range ? use this module , the range is 2KM.</p><p><br><a href="https://goo.gl/HMvEue">https://goo.gl/HMvEue</a></p>
<p>Hi! Nice tutorial, well explained and more important it works very well. I'm using this modules on a project were one arduino uno(TX) communicate with arduino mega 2560(RX) but the pin D11 is used by adafruit motor shield l293d. How can i change the pin for receiver?? Thank you!</p>
<p>my pleasure </p><p>for the receiver i thinks you can change the pin using:</p><table><tbody><tr><td><a href="http://www.airspayce.com/mikem/arduino/RadioHead/classRH__ASK.html#af56e19d316152a0ca97c9e9fbee4191e">RH_ASK</a> (uint16_t <a href="http://www.airspayce.com/mikem/arduino/RadioHead/classRH__ASK.html#ad8fe587d5651b972ffe1b35b701305b8">speed</a>=2000, uint8_t rxPin=11, uint8_t txPin=12, uint8_t pttPin=10, bool pttInverted=false)<br></td></tr></tbody></table><p>so inside it you can set the speed and tx , rx pin as well</p>

About This Instructable

6,152views

69favorites

License:

Bio: Maker, PCB designer , electronics instructor from Jordan just one word ! I Adore electronics follow me on FB https://www.facebook.com/Mohannad-Rawashdeh-Raw-774983565988641/
More by Mohannad Rawashdeh:TTP224 Digital Touch Sensor Applications Using Arduino RF 315MHz/433MHz Wireless and Arduino...again! Motor Driver BTS7960 43A 
Add instructable to: