Complete Guide for RF 433MHz Transmitter/Receiver Module With Arduino

This post is a guide for the popular RF 433MHz Transmitter/Receiver modules with Arduino. We’ll explain how they work and share an Arduino project example that you can apply to use in your own projects. 

We have other tutorials about the 433MHz transmitter/receiver that you may found useful:

Description

Throughout this tutorial we’ll be using the FS1000A transmitter and corresponding receiver, but the instructions provided also work with other 433MHz transmitter/receiver modules that work in a similar fashion. These RF modules are very popular among the Arduino tinkerers and are used on a wide variety of applications that require wireless control.

These modules are very cheap and you can use them with any microcontroller, whether it’s an Arduino, ESP8266, or ESP32.

Specifications RF 433MHz Receiver

  • Frequency Range: 433.92 MHz
  • Modulation: ASK
  • Input Voltage: 5V
  • Price: $1 to $2

Specifications RF 433MHz Transmitter

  • Frequency Range: 433.92MHz
  • Input Voltage: 3-12V
  • Price: $1 to $2

Where to buy?

You can purchase these modules for just a few dollars. Click here to compare the RF 433MHz transmitter/receiver on several stores and find the best price.

Arduino with RF 433MHz Transmitter/Receiver Modules

In this section, we’ll build a simple example that sends a message from an Arduino to another Arduino board using 433 MHz. An Arduino board will be connected to a 433 MHz transmitter and will send the “Hello World!” message. The other Arduino board will be connected to a 433 MHz receiver to receive the messages.

Parts Required

You need the following components for this example:

You can use the preceding links or go directly to MakerAdvisor.com/tools to find all the parts for your projects at the best price!

Installing the RadioHead Library

The RadioHead library provides an easy way to work with the 433 MHz transmitter/receiver with the Arduino. Follow the next steps to install that library in the Arduino IDE:

  1. Click here to download the RadioHead library. You should have a .zip folder in your Downloads folder.
  2. Unzip the RadioHead library.
  3. Move the RadioHead library folder to the Arduino IDE installation libraries folder.
  4. Restart your Arduino IDE

The RadioHead library is great and it works with almost all RF modules in the market. You can read more about the RadioHead library here.

Transmitter Circuit

Wire the transmitter module to the Arduino by following the next schematic diagram.

Important: always check the pinout for the transmitter module you’re using. Usually, there are labels next to the pins. Alternatively, you can also take a look at your module’s datasheet.

Transmitter Sketch

Upload the following code to the Arduino board that will act as a transmitter.

#include <RH_ASK.h>
#include <SPI.h> // Not actually used but needed to compile

RH_ASK driver;

void setup()
{
    Serial.begin(9600);	  // Debugging only
    if (!driver.init())
         Serial.println("init failed");
}

void loop()
{
    const char *msg = "Hello World!";
    driver.send((uint8_t *)msg, strlen(msg));
    driver.waitPacketSent();
    delay(1000);
}

View raw code

How the transmitter sketch works

First, include the RadioHead ASK library.

#include <RH_ASK.h>

This library needs the SPI library to work. So, you also need to include the SPI library.

#include <SPI.h>

After that, create a RH_ASK object called driver.

In the setup(), initialize the RH_ASK object by using the init() method.

Serial.begin(9600); // Debugging only
if (!driver.init())
    Serial.println("init failed");

In the loop(), we write and send our message. The message is saved on the msg variable. Please note that the message needs to be of type char.

const char *msg = "Hello World!";

This message contains the “Hello World!” message, but you can send anything you want as long as it is in char format.

Finally, we send our message as follows:

driver.send((uint8_t *)msg, strlen(msg));
driver.waitPacketSent();

The message is being sent every second, but you can adjust this delay time.

delay(1000);

Receiver Circuit

Wire the receiver module to another Arduino by following the next schematic diagram.

Important: always check the pinout for the transmitter module you’re using. Usually, there are labels next to the pins. Alternatively, you can also take a look at your module’s datasheet.

Receiver Sketch

Upload the code below to the Arduino connected to the receiver.

#include <RH_ASK.h>
#include <SPI.h> // Not actualy used but needed to compile

RH_ASK driver;

void setup()
{
    Serial.begin(9600);	// Debugging only
    if (!driver.init())
         Serial.println("init failed");
}

void loop()
{
    uint8_t buf[12];
    uint8_t buflen = sizeof(buf);
    if (driver.recv(buf, &buflen)) // Non-blocking
    {
      int i;
      // Message with a good checksum received, dump it.
      Serial.print("Message: ");
      Serial.println((char*)buf);         
    }
}

View raw code

How the receiver sketch works

Similarly to the previous sketch, you start by including the necessary libraries:

#include <RH_ASK.h>
#include <SPI.h>

You create a RH_ASK object called driver:

RH_ASK driver;

In the setup(), initialize the RH_ASKobject.

void setup(){
    Serial.begin(9600); // Debugging only
    if (!driver.init())
    Serial.println("init failed");
}

In the loop(), we need to set a buffer that matches the size of the message we’ll receive. “Hello World!” has 12 characters. You should adjust the buffer size accordingly to the message you’ll receive (spaces and punctuation also count).

uint8_t buf[12];
uint8_t buflen = sizeof(buf);

Then, check if you’ve received a valid message. If you receive a valid message, print it in the serial monitor.

if (driver.recv(buf, &buflen)) {
    int i;
    // Message with a good checksum received, dump it.
    Serial.print("Message: ");
    Serial.println((char*)buf);
}

Demonstration

In this project the transmitter is sending a message “Hello World!” to the receiver via RF. Those messages are being displayed in receiver’s serial monitor. The following figure shows what you should see in your Arduino IDE serial monitor.

receiver serial monitor

Wrapping Up

You need to have some realistic expectations when using this module. They work very well when the receiver and transmitter are close to each other. If you separate them too far apart you’ll lose the communication. The communication range will vary. It depends on how much voltage you’re supplying to your transmitter module, RF noise in your environment, and if you’re using an external antenna.

If you want to use 433 MHz remote controls to communicate with your Arduino, follow this tutorial: Decode and Send 433 MHz RF Signals with Arduino.

If you are an Arduino beginner, we recommend following our Arduino Mini Course. It will help you quickly getting started with this amazing board (and it is free!).

You may also like the following resources:

You can find all our Arduino projects and tutorials here.

Share this post with a friend that also likes electronics!

If you like this post probably you might like my next ones, so please support me by subscribing our blog.

Thanks for reading.

January 19, 2019


Learn how to program and build projects with the ESP32 and ESP8266 using MicroPython firmware DOWNLOAD »

Learn how to program and build projects with the ESP32 and ESP8266 using MicroPython firmware DOWNLOAD »


Enjoyed this project? Stay updated by subscribing our weekly newsletter!

97 thoughts on “Complete Guide for RF 433MHz Transmitter/Receiver Module With Arduino”

  1. This really needs some actual range capability data: line of sight, through one interior wall (drywall with wood studs), same with metal studs, through one concrete block wall, etc.

  2. Hi! Nice and simple tutorial! I was looking for different options for Wireless COMM, and 433 MHz is the frequency I am most interested in. I have two questions:

    – On the serial communication with the transmitter/receiver, does it work with different data rates other than 9600? (Up to 115200 , for example).

    – Does each module work as both transmitter and receiver? By the pictures it seems that they only perform transmitting or receiving but not both.

    Thank you very much!
    Javi

    • You’re welcome Javier.
      1) Yes, you can use any baudrate
      2) No, they only perform one task.

      If you’re looking for a module that offers both Transmit and receive, you should search for this module nrf24l01. (You can use that module with he RadioHead library)
      It’s a great module for wireless communication too. I’ll be posting a guide for that module in a couple of weeks.

  3. I picked up a couple of these on eBay a few months ago with a vague idea of testing their functionality, so this rather useful little guide is quite timely. Thank you.

    • Yes, that’s true. All modules communicate at the same radio frequency 433MHz. So they’ll interfere with each other. but you can add if statements and verify if that message makes sense or not. I hope this helps!

  4. Cool project, I have some RF 433MHz Modules lying around. May be I should give a short during the weekend 🙂

  5. Hi dear Rui,
    Really u r doing great job for those r new to arduino.
    And am preparing second arduino by myself on the bredboard , I think it should work well, send some gsm based project using arduino.
    Thanks,
    Ramesh, india

  6. Many thanks Rui,
    This is my first foray into RF transmition and found this instructable very useful.
    I made up my own prototype boards for the NANO and had this running inside an hour (after spending two days making the proto boards). I now have a basic understanding of RF data transfer and am now looking at working out how to send command instructions via RF.

    I am currently testing different length antenae for these units and shall see if there is a marked difference in length and cable type.

    Lance.

    • Hi Lance,
      Awesome! I’m glad you found this guide useful.
      It’s a great addition to those modules. Adding an antenna can increase greatly the distance that these modules can talk.

  7. Hi,
    Thanks for sharing these excellent tutorials.
    My experience with the receiver is to power it from 3.3 Volts , got better range. Maybe less noise ?
    Do you have any plans for a tutorial based on Arduino and GSM module ? Like SIM900 ?

  8. Greawork and thank you very much! Very useful! I have a question regarding the ports to be used. How does the arduino board know where you have connected the receiver or transmitter too?

    Thanks again!!

    • You can go to your device manager (if you’re on windows) and plug one of your Arduino boards. It will tell you which COM port it is using.
      Then connect the other Arduino board to also check its COM port

  9. Hi, I did everything in you guide but get nothing in serial. Did the exact same setup and copied and pasted the code and still nothing. What could be the issue? Ive spent over 1 week and im still stuck, please help

    • Hi Andrew,
      I know that it can be frustrating not finding the issue. I’m not sure what it is based on what you’ve said….
      It can be a problem with your Arduino, wire connections, copying and pasting the code.
      Or a problem with a component that is defective…

  10. Hi, great tutorial. But my RF module communication seems unreliable and slow. What can I do to increase the range of these buggers and also have reliable communication? (I’m using arduino uno and nano)
    thnx

      • Hello

        I used a DS18B20 to sense the temperature with Arduino
        I use a 433mhz transmitter to send the temperature on my raspberry
        the raspberry I have the receiver, and then I store the temperature in a database
        if Arduino and raspberry are close (20 cm), no problem, I get the temperature
        if I remove the raspberry Arduino, I get nothing
        the transmitter and receiver antenna
        can you help me ?
        best regards

        • Hello,
          Connect a 17 cm antenna to both transmitter and receiver. This will improve range. Remember the datarate is only about 2000 bits/sec

  11. Thanx alot for this great ‘to the point’ guide!
    A question:
    Will the receiver work for ‘any’ messages sent on this frequency? I installed a firealarm that sends messages between the detectors at this frequency and these messages are not read as I expected but maybe they are of a different type?

  12. Hi, is it possible to check the signal strength by sending I.e. 100 packets and checking how many was received, thus 100% would be the effective strength.

      • thank for your collaboration. I need to send one signal like sine or cosine wave. and receive it on a separate arduino. can you help me on a program to apload on Arduino (transmiter and receiver)

  13. Hi. great tutorial. I have two questions:
    1. Would this work if I used one arduino connected to the receiver and this usb to serial connector attached to the transmitter (arduino.cc/en/Main/USBSerial)
    2. Is there someway that I could make it work by connecting the receiver/transmitter modules to the RX/TX pins (pins0&1) on the arduino?

  14. So I will of course try to figure it out,, but maybe I will struggle over a very common desire. I want to transmit joystick values over the 433 mhz unit, How to send various sensor data and decode it to various output??

  15. Hello Ruy thanks for great tutorial!
    I have a question. I have two arduinos and I run the programs explained.
    The output is “Hello World!” plus some garbage charactecters at the end (e.g. #).
    I’ve tried to make the receiver buffer (uint8_t buf[12) smaller (or bigger), but the problem remains.
    Any idea how to solve this?
    Thanks

  16. Hi
    I’ve been trying to upload the receiver sketch and everytime it says “Stray /240 in program”
    I copied it straight from your website. Please help

  17. Dear Rui,

    My module works with 5V, so please ignore my first post. I have another question: why is the reciever module data on digital pin 11 of the arduino? I see no declaration of this pin as input in the code. Would it work on digital pin 9 as well? The reason is that I would like to write the data to an SD card so I need the pin 11 for that.

    thank you for your support

    Sebas

    Thank you

  18. Hello, i recieve

    Message: Hello World!
    Ď

    with D below, please could you help me where is problem? I have same code as u.

  19. That’s awesome work
    and I have one question to ask you about “Can they sending data in ‘float’ ?”
    Because I’m use RF 433 mhz module to sending voltage value from analog pin but
    they can’t receive it

  20. I read your Complete Guide for RF 433MHz Transmitter/Receiver Module With Arduino.

    In the Transmitter Circuit it advises to Then upload the code below. But I cannot see any code to upload. Please advise where to find this code.

    Thanks
    Rob

    • Hi Rob.
      The code is shown in the blog post.
      However, if you’re having trouble seeing that, you can get the code in this link raw.githubusercontent.com/RuiSantosdotme/Random-Nerd-Tutorials/master/Projects/433MHz/transmitter.ino
      I hope this helps 🙂

    • You can do that. But it is not recommended, since those pins are used by the Arduino when it uses serial communication (this means it uses those pins when you’re uploading code and when you use the serial monitor).

      If you really need to use those pins to receive data, you need to disconnect the connections on the TX and RX pins when you upload code.
      Additionally, the library doesn’t use those pins by default. So, you also need to make some changes to the library code (which we don’t recommend).

      I hope this helps.
      Regards,
      Sara

  21. Hello Rui,
    I couldn’t make it work. Receiver doesn’t get the messages. Do I need to do something
    with pttPin pin? The doc says – “The pin that is connected to the transmitter controller. It will be set HIGH to enable the transmitter (unless pttInverted is true).” Do I need to set it to HIGH to enable transmission. What are the steps to debug the problem? How can I check if it is broken module, circuit or code?

      • Thank you for prompt reply. I will test it with another module. Is there way to check if it is receiver’s or transceiver’s issue? Or I have to try all permutations :)? Also what about this pttPin? Should I do something with it? Is there a way to test communication in one Arduino – for example connect Tx and Rx pins?

  22. Thanks for a great tutorial. I am sending some binary code from the transmitter to the receiver and it is coming through fine and printing to the serial monitor.

    However, I am having trouble saving that binary code to a int variable so I can use it with a conditional statement like the if statement. What am I missing here. John

    • Hi John, I don’t have any examples on that exact subject, but if you search something like “convert binary to int Arduino”, you should be able to find an example similar to what you’re trying to do. Sorry I couldn’t offer much help for your specific problem. Regards,
      Rui

  23. I’m getting a “No such directory found” error when verifying the code. It seems to be coming from the #include
    #include libraries. I did add them like a usual… Any ideas where I messed up?? Thanks!

    • Hi Casey.
      Many of our readers have several versions of the Arduino IDE installed. If that is your case, please verify that you have the libraries installed in the right Arduino IDE version.
      Regards,
      Sara 🙂

  24. Hey I’m a noob in this… I’m using an arduino pro mini I wanna know what should be the connections for transmitter circuit in arduino pro mini

    • Hi Chinmoy.
      You can use the same connections.
      Connect the data pin of the transmitter to Pin 12, GND to GND, and the power pin to VCC. Here’s the pinout for the Arduino Pro Mini, it might help: cdn.sparkfun.com/datasheets/Dev/Arduino/Boards/ProMini8MHzv1.pdf
      Regards,
      Sara

  25. hello sir
    everything works fine but i am not receiving anything in my serial monitor
    help me please
    thanking you in advance

    • Hi.
      Are both Arduino boards running at the same time?
      They need to be close to each other so that the receiver can get the transmitter messages.
      Also, make sure that you have just the receiver board with the serial monitor opened.
      Regards,
      Sara

    • Hi Umar.
      The libray we use in this example, uses Pin 12 for the transceiver circuit and Pin 11 for the receiver circuit by default.
      You can change that on the library file, if needed.
      Regards,
      Sara

  26. i follow tutorial and work well, but I don’t see where you configure the pin 12 in transmitter and where you configure pin 11 in recever. it is because is already configure in radiohead libraries or something else

    thanks

Leave a Comment

Download our Free eBooks and Resources

Get instant access to our FREE eBooks, Resources, and Exclusive Electronics Projects by entering your email address below.