433MHz RF communication to a Raspberry Pi

433MHz RF communication to a Raspberry Pi

This post will explain how to get up and running with the 433MHz RF Transmitter Receiver modules to send radio frequency (RF) signal-codes from a transmitter device to a Raspberry Pi.


This post will show how to connect a Raspberry Pi to a 433MHz RF Receiver module through its GPIO pins. which will enable it to receive radio frequency (RF) signals from a 433MHz RF Transmitter module. In this case, the transmitter module will be connected to an Arduino, but other devices can also be used. Communication takes place using specific RF signal-codes generated using Python.


Because the Raspberry Pi is quite fragile or should be considered that, I was looking for a way to use the GPIO pins without having to open up the case all the time. I ultimately developed a little RF box connected to the Raspberry Pi which can both send and receive signal-codes. This allowed me to do the initial and additional programming without interfering with the hardware. See the Related Topics for related posts.


I would like to thank Vincent Damay from Homeautomation.org for his 433Mhtz RF communication between Arduino and Raspberry Pi: Raspberry Pi as a receiver article. He saved me a lot of long hours’ research for writing this one. At the time of updating the original article has unfortunately been removed.

Requirements & assumptions

First of all, you need a fully functional Raspberry Pi with Raspbian installed. After the setup, we will need the command prompt to do some testing and receiving. If you don’t have a screen, keyboard and mouse you will need to be on a network and use PuTTY and/or WinSCP for the setup, coding and testing.

For this tutorial you will also need:

These were the parts that were used. Most are available from BangGood and Amazon.com. Some direct links to some of the parts are supplied lower down.

  • At least 2 pairs of 433 MHz Transmitter Receiver units
  • Running Raspberry Pi
  • 433 MHz spiral helical antennas
  • Solderless developing breadboard
  • Some additional breadboard wiring (Arduino and Raspberry Pi compatible)
  • Functional Arduino connected to a serial monitor. An Arduino Nano was used.

Setting up the Arduino to transmit RF signals

433MHz RF Transmitter moduleThis will set the Arduino up as the transmitter. To do so grab the square (vs. longer) module from your 433MHz RF Transmitter Receiver module pair.

First of all, very important, get that ‘thang’ antennaed. You can use the official 433 MHz Spiral Spring Helical Antennas or you can make one yourself by coiling a 25 cm 1 mm solid wire and soldering it into the antennae hole.

On the Arduino, the RC Switch library needs to be available in the Libraries directory. To add this library to the Arduino IDE, select the latest downloaded zip-file from Add .ZIP Library… from the Include Library option under the Sketch menu.

On a Linux system (including Raspbian) the following can be used to clone the latest version of the RC Switch library directly into the Arduino IDE libraries folder:

sudo apt-get install git
cd /home/pi/sketchbook/libraries
git clone https://github.com/sui77/rc-switch.git

To prevent Java errors, rename the rc-switch directory to rcswitch:

mv /home/pi/sketchbook/libraries/rc-switch /home/pi/sketchbook/libraries/rcswitch

The pins on the 433MHz RF Transmitter module is clearly marked. Connect the breadboard wiring as follows:

  • ATAD (DATA) to D10 pin of the Arduino
  • VCC (5 V) to 5 V pin of the Arduino
  • GND to the GND pin of the Arduino

Connect the Arduino to the Arduino IDE and upload the following sketch to it:

#include <RCSwitch.h>
RCSwitch mySwitch = RCSwitch();

void setup() {
  // Transmitter is connected to Arduino Pin #10  

  // Optional set pulse length.
  // mySwitch.setPulseLength(320);

  // Optional set protocol (default is 1, will work for most outlets)
  // mySwitch.setProtocol(2);

  // Optional set number of transmission repetitions.
  // mySwitch.setRepeatTransmit(15);


void loop() {
  /* Using decimal code */
  mySwitch.send(1234, 24);
  Serial.print("Attempting to send 1234");
  mySwitch.send(4321, 24);
  Serial.print("Attempting to send 4321");

  /* Using binary code */

As is, this piece of coding makes the Arduino send the decimal code ‘1234’, wait for four seconds and then send ‘4321’. It will tun over and over until the Arduino is disconnected (switching it off). You can play a bit with the binary send options by removing the //’s. Don’t change this too much until your comfortable with Arduino code.

Other important things to notice here is the inclusion of the library and the setting up of the transmitter to pin D10.

Give your Arduino power and connect it to the Serial Monitor. The code should show that it is being send. That’s it from the Arduino for now – let it continue to run in the background…

Setting up the Raspberry Pi to receive RF signals

433MHz RF Receiver moduleIn this tutorial, we will set the Raspberry Pi up as the receiver. To do so grab the longer (vs. square) module from your 433MHz RF Transmitter Receiver module pair and get it antennaed again. We will be using wiringPi and a modified version of 433Utils.

When positioning your Raspberry Pi GPIO pins facing up and on the opposite side of you, i.e. with the USB and Ethernet port on the right, the physical GPIO pin numbering will be as follows:

Raspberry Pi GPIO Layout Model B Plus

The pins on the 433MHz RF Receiver module is clearly marked. The receiver module has two DATA pins. As a rule I like to always use the one closest to GND. Before plugging in the Raspberry Pi, connect the breadboard wiring as follows:

  • ATAD (DATA) to physical GPIO pin number 13 (i.e. GPIO27)
  • VCC (5 V) to physical GPIO pin number 2 or 4
  • GND to physical GPIO pin numbers 6, 9 or 14

To install wiringPi the git clone command will be used. The following commands can be used from the /home/pi directory:

sudo apt-get install git
git clone git://git.drogon.net/wiringPi
cd wiringPi

After wiringPi is installed, the build can be checked at any time with:

gpio readall

which, if correctly installed will give the state of each pin on the GPIO:

| wiringPi | GPIO | Phys | Name   | Mode | Value |
|      0   |  17  |  11  | GPIO 0 | OUT  | Low   |
|      1   |  18  |  12  | GPIO 1 | IN   | Low   |
|      2   |  21  |  13  | GPIO 2 | IN   | Low   |
|      3   |  22  |  15  | GPIO 3 | IN   | Low   |
|      4   |  23  |  16  | GPIO 4 | IN   | Low   |
|      5   |  24  |  18  | GPIO 5 | IN   | Low   |
|      6   |  25  |  22  | GPIO 6 | IN   | Low   |
|      7   |   4  |   7  | GPIO 7 | IN   | Low   |
|      8   |   0  |   3  | SDA    | IN   | High  |
|      9   |   1  |   5  | SCL    | IN   | High  |
|     10   |   8  |  24  | CE0    | IN   | Low   |
|     11   |   7  |  26  | CE1    | IN   | Low   |
|     12   |  10  |  19  | MOSI   | IN   | Low   |
|     13   |   9  |  21  | MISO   | IN   | Low   |
|     14   |  11  |  23  | SCLK   | IN   | Low   |
|     15   |  14  |   8  | TxD    | ALT0 | High  |
|     16   |  15  |  10  | RxD    | ALT0 | High  |

Note above how the physical GPIO pin numbers change. Physical GPIO pin number 11 for example becomes GPIO 0 with wiringPi. We used the physical GPIO pin 13, so it will become GPIO 2.

To install (clone) 433Utils onto the Raspberry Pi go to the /home/pi directory and use the following:

cd /home/pi
git clone --recursive git://github.com/ninjablocks/433Utils.git
cd 433Utils/RPi_utils

To receive RF signal-codes, we will be using RFSniffer.cpp. While in the 433Utils/RPi_utils directory, you can go and check it out by using:

sudo nano RFSniffer.cpp

Nothing should be changed for now. Because we connected the DATA pin of the 433MHz RF Receiver module we will stick to wiringPi’s GPIO 2. Just press Ctrl X to exit back to the terminal.

If the code was changed, in order to use the newest version of RFSniffer.cpp it needs to be compiled again:

make RFSniffer.cpp

Testing the communication

While the Arduino is still sending the code as set up above, the ‘sniffer’ can be activated on the Raspberry Pi. In the Pi’s terminal, go back to the /home/pi directory and type in the sniffer command:

sudo /home/pi/433Utils/RPi_utils/RFSniffer

The terminal will now be waiting for RF signals. If a signal is received it will be displayed on the terminal screen. There might be other random pieces of code in between, but it should mainly show ‘1234’ followed by ‘4321’.

About the author
Renier busies himself with improving his English writing, creative web design and his websites, photoshopping, micro-electronics, multiple genres of music, superhero movies and badass series.
Behind the Scenes is a free, informative website. If you find value in any of our content, please consider making a donation to our cause.
Donate via PayPal

Save, share & discuss

Your comment is important, but don't be a knob. Keep it constructive and polite.

3 thoughts on “433MHz RF communication to a Raspberry Pi”

  1. THank you for the post !!

    I succeeded to communicate between Arduino and RaspBerry.

    I have a litle trouble, when i receive on on the RaspBerry. The text Received 4321, appears one or two or three times …

    Have you a clue about this behavior ?

    Thank you for your help.

  2. Hi,
    Thank you for this article.
    Can you do the same with an RF remote and receiver?
    Thank you for your reply.

    Kind regards,

Leave a Reply

Your email address will not be published. Required fields are marked *

More Raspberry Pi related posts