Decode 433 MHz signals w/ Raspberry Pi & 433 MHz Receiver

This post will show you how to read 433 MHz codes using a Raspberry Pi. This tutorial was made to complement the Voice Controlling project which needed 433 MHz Unit Code Values to control the wireless switches. If you want to know how to read 433 MHz codes using an Arduino, go to this post!

I learned how to do this by reading this post. So credit goes to Paul Pinault for making this project a reality.

Hardware Requirements

  • Raspberry Pi(I used a Raspberry Pi Rev.2)
  • 433 MHz receiver(Any type of 433 Mhz receiver should work, but for this tutorial I used a 4 pin variant)
  • A breadboard
  • Some jumper wires
  • A 433 MHz transmitter(I used a 4 channel 433 MHz transmitter Remote)

Installing WiringPi

WiringPi is needed to control the pins on the Raspberry Pi. Which will be connected to the 433 MHz Receiver.

To install WiringPi, SSH into your Raspberry Pi or open up a console, then run these commands:

cd ~/
git clone git://git.drogon.net/wiringPi
cd wiringPi
./build

After running the last command, WiringPi should be installed!

Installing 433Utils

433Utils is made by GitHub user wolfeidau. He gathered a bunch of code and wrote some himself, all about 433 MHz Radio Transmissions, then made a repo of it.

To install 433Utils, run these commands:

cd ~/
git clone –recursive git://github.com/ninjablocks/433Utils.git
cd 433Utils/RPi_utils
make

Now 433Utils should be installed!

Connecting the 433 MHz receiver

receiver

As you can see in the picture, my 433 MHz receiver actually has two Data-pins. Why it has two pins I don’t exactly know, but a possibility is it is used to easily connect two output-sources, or two different Arduinos. In this project however we will only need to use one of the pins. I used the one closest to the GND-pin. If anybody knows why it has two Data-pins, let me know in the comments!

The code we will be running will be speaking out to the GPIO2 pin, according to this site, GPIO2 is GPIO pin 21 on Rev.1, or GPIO pin 27 on Rev.2

Here is an image of the P1 pin header on the Raspberry Pi Rev.1. GPIO pin 21 and 27 should be on the same pin on both versions.

GPIO-Pins-Layout

Basically the connection between the receiver and Raspberry Pi can be described with a table.

Raspberry Pi Pin  433 MHz Receiver Pins
GND GND
5V VCC
GPIO 21/27 Data

Here is how the connection looks like to me, I’m using a breakout board and a breadboard.

rpi433Sniffer

Running the code

To start listening for the 433 MHz codes, start the RFSniffer program we got from 433Utils, using this command.

~/433Utils/RPi_utils/RFSniffer

I used a simple 4 channel 433 MHz Remote to send some 433 MHz codes to my receiver.

remote

Now bring your 433 MHz transmitter remote VERY close to your receiver, and press some buttons. The range of the receiver is not very far on the Raspberry Pi, so make sure you bring the remote as close as you can.

The received codes should print out as you press the buttons on the remote. I’m using terminal and for me it looks like this:

RFSniffer

 

Pressing the buttons on my transmitter prints out values ranging between 16738081- 16738088.

Congrats, you now know how to print out 433 MHz codes using your Raspberry Pi & 433 MHz Receiver!

If you have any questions feel free to ask me by using the Contact page or by commenting below.

Prince

A second year computer engineering student at Malmö University in Sweden just having some fun with this blog. Computer Engineering and Mobile IT: Bachelor of Science in engineering

You may also like...

75 Responses

  1. Matzz says:

    I tried your tutorial with Rasberrypi2 but RSSniffer don’t receive any signal. I just read on other page that connecting 5V to GPIO may damage PI. Are you sure that 5V not 3.3V should be connected to receiver?

    • Mattti0 says:

      Hi,
      Many of these receivers works only 5V or higher voltage. So to use receiver safely, you should use logic level converter to connect it to Raspberry GPIO

    • Jamen says:

      If you check the output on sensor for the PIN that connects to the data out GPIO PIN on the PI you will see only very small voltage…1 – 2 volts are sent. Just because the chip is powered by 5v doesn’t mean its sends out 5V to the PI board.

  2. AzureDominus says:

    What’s the range on the transmitter? Because mine is really short even with an antenna.

  3. Jaron says:

    I’m curious to know what the range is of your receiver? I have a similar setup that works but, even with an antenna on the receiver, I still have to be within a couple of feet for it to work reliably!

    • Rusty P says:

      check the specs on you transmitter, but increasing the voltage on your transmitter will give you more range.

  4. soroush says:

    Thank You for your help . I can do what you write over and It works On raspberry pi 2B with GPIO27 for reciver.
    the reciver get and show the code when I press my remote control.
    But my question is how to creat program for runnig “function 1” when I press A key on my remote control? how about B C D …. keys…?
    I want one out put then I want to put it into variable…
    PLZ give me an example

  5. BigSmooth says:

    Hello,
    it looks very nice example. Unfortunately, it does not work.
    I see some strange behavior: the process is going at 100% CPU usage and does not really do anything. For example, it does not show any of the debug message I have added in the code.
    strace output does not give any clue.

  6. yantronica says:

    Didn’t work for me. When running RFSniffer, i got nothing. Process runs at 62% CPU. I’m using a basic EtekCity RC outlet switch: http://amzn.com/B0087EIDRS, and these Rx Tx: http://amzn.com/B00M2CUALS. I’ve triple checked the wiring following these instructions. The only thing I haven’t tried is adding an antenna, but i held the remote literally half inch from the Rx when pressing the buttons. Anything else I should try?

  7. Maxi says:

    Is it possible to let the pi Executive a programm when it receives a special Signal ?

    • Rusty P says:

      yes. If you are willing to write some code, then look into programming interrupts. I am not sure how to go about this on ras pi, but I do know that it does have some interrupts designed into it. Although I do believe that there is a specific library you have to call to be able to use them. See my post below. I discussed interrupts in a bit more detail, as I think that is what the second “data” pin on the OP’s receiver is meant for.

  8. Hi, thank you very much for this great guide. Just wonder if there is code for 315MHz?

    Regards,
    Michael

  9. Raymond van Asperen says:

    I believe there is a small step missing from your tutorial, before the ‘make’ command on the 433utils. I think you should change the file codesend.cpp. PIN should be changed to ‘2’ there. Or am I mistaken?
    I’m waiting for the components, so I’m starting with this soon. Just trying to figure this out in advance…

  10. SchoJo says:

    What is the typical purpose / use case of this set up when the distance between sender and receiver must be very short? What needs to be done to support larger distances?
    Regards
    Joachim

    • Rusty P says:

      You would need to look at the tech specs of the transmitter/receiver pair that you bought or are looking at buying. I just bought a 433 Mhz pair off ebay. The way you extend range with mine is twofold.

      1) You add an external antenna to the transmitter. My transmitter has a solder tab on it labeled “ext ant”. There is a specific length the antenna needs to be based on the wavelength (or frequency) of the tx/rx pair. It is usually related in terms of quarter wave and half wave antenna length, with quarter wave usually being better option, just because the half wave antenna is pretty long at this frequency. You could also add an external antenna to the receiver, but I don’t think my receiver has this option designed in. Also, don’t think that you can coax more range out of it by adding a half wave antenna and coiling it up or something to that effect. Coiling or folding the antenna can cause induction in the wire that will have the opposite of desired effects.
      2) You increase the transmitter power. In the technical specifications or datasheet for the transmitter, you will be given an input voltage range for the transmitter. Higher voltage means more power = more range. My transmitter voltage range is 5V – 12V, and according to the datasheet, supplying 12V to the transmitter will give it up to 300ft range. For my application, 150-200ft will be acceptable, so if it get 300 that’s just icing on the cake.

      Hope this helped.

  11. Rusty P says:

    I may be wrong, but I think the fourth “data” pin on your receiver is so that you can program interrupts through your microcontroller. I don’t know how effective this would be on a pi, since it is more or less a psuedo-microcontroller, in that the processor is not designed for that purpose, but the folks that designed the pi set up basic microntroller functionality. I unfortunately haven’t had much time to play with my pi (busy with school and related projects), but traditional microcontrollers allow you to set up an interrupt on pin ‘x’ that when a state change occurs (from 1 to 0 or 0 to 1 depending on how you code it), your microcontroller then activates a subroutine that would perform a specific action. For instance say you want your microcontroller to only read from your data port when data is actually received, then you would write your code so that the interrupt directs to a subroutine that reads the data in when the interrupt is triggered. This is useful, because you are able to reduce processor overhead by only reading data when necessary rather than continually checking to see if data is being received on that channel. It also frees up the processor to do other tasks when the interrupt is not triggered. Once the subroutine has completed its task (in this case received it’s data packet), then it resumes its programmed tasks from the point where the interrupt occurred. I just got my 433 Mhz receiver/transmitter pair in the mail today, so I don’t know all of this for certain, but that is what makes sense to me.

  12. jeremy says:

    great tutorial
    can you please help me ajust it to livolo brand switches?
    like in this link
    https://github.com/rafflesgun/smarthome
    thank you!!
    (i will be glad to contact you by email faljeremy@gmail.com

  13. Ekan says:

    Great tutorial. Manage to listen to my old Nexa remote and the using the code i got to control my Nexa power relay. BUT it only works with the old Nexa devices. These uses a 24-bit code. The new Nexa use 74-bit code (I think), so that wan’t fit into an integer. So if you get nothing when you listen to your remotes/devices this may be the reason.

  14. Kai says:

    Do you think if its possible to record the digital pattern coming from an weather station transmitter? I have a “froggit” F007TH sending at 433 MHz. I’ve testet your setup with a remote control of power sockets – works great!
    If I put a piezzo buzzer between Data and GND I can here something like a “modem-sound” in both cases – remote control and ws-transmitter but only the remote control gives a number with RFSniffer – do you have a hint what to do ?

    Great job ! thanks a lot!

  15. Hotze says:

    I have installed the XD-RF-5V on my breadboard and run RFSniffer.
    I can see signals form an Action remote. But the signal from the KaKu remote is not seen. Also the signal from an outdoor temperature sensor is not seen neither my car key remote.
    Do you have any idea why those signals are not seen?
    What must I do to see these signals also?

    • DPahlevi says:

      i got the same problem here , my rf sensor apparently equip with combination of 4 digit and 8 digit, a home code and the area code, it seems that the rfsniffer isn’t showing anything. I pretty sure that both the sensor and the rf modul is working.

  16. Marcin says:

    Hey dude i connected as is written here and it does not work – but i also connected LED to data and it stops blinking when i press button on remote, any idea why?

  17. Patrick says:

    Hi,
    Thank you for this!

    Just sharing an issue I had while downloading, installing and compiling 433Utils. You might wanna add the recursive parameter, or else you’ll get the error

    make: *** No rule to make target ‘../rc-switch/RCSwitch.o’, needed by ‘send’. Stop.

    Here : git clone –recursive git://github.com/ninjablocks/433Utils.git

    • David says:

      I had the same issue as you Patrick until i added in recursive parameter, also I can’t seem to run RFSniffer, I get the error:

      -bash: RFSniffer: command not found

    • Gavin says:

      Struggling to get this to work. I also get the ‘No rule to make target…’ message. I tried adding the recursive parameter and I get an error message: fatal: repository ‘–recursive’ does not exist

      Any tips? Apologies but I am a total noob!

      • Ray Haque says:

        This is a little late I suppose. But the command you need to execute is:
        git clone git://github.com/ninjablocks/433Utils.git –recursive

      • Adam says:

        This worked for me:

        go to the root folder of your project. do a
        $ git submodule init
        and
        $ git submodule update
        Run the make again

  18. Ain't nobody got time for that says:

    Would a different MHz transmitter and receiver work. For example I have a 35 MHz transmitter and receiver.

  19. tom says:

    hello i tried this instruiction but when im by the make command i get a error : No rule to make target ‘../rc-switch/RCSwitch.o’, needed by ‘send’. Stop.
    what can i do ?

  20. Gibs says:

    Hello,
    Thank you so much for your post.
    I have an issue I can send a code with my transmitter and I received it with my receiver. So my receiver and transmitter works.
    But I don’t understand when I try why the key of my portal it doesn’t work.
    Any idea ?

  21. Nitin Gauatam says:

    This is working for me fine, now I want to send a email once i receive data on receiver saying Sensor A is activated etc. I have SSMTP setup separately how to integrate?

  22. julien says:

    Hello all,

    First sorry for my english. Thanks for the tutorial. Everything works fine since I installed 433Utils with the recursive link. I know that the communication between my receiver and my transmitter is ok. The only issue I have is that I don’t catch any signal from external device (remote chacon)
    Here is my setup : Raspberry Pi 3 / receiver-transmitter 433MHZ + antenna / WiringPi / 433Utils (installed with recursive) / Remote chacon 433,92MHZ

    Thanks in advance for your help.

  23. Nini says:

    Hello

    Thank you for this tutorial. I tried to sniff the IT 1500 codes from my Intertechno switch but I could not catch one bit.
    With Wring pi from this tutorial https://www.sweetpi.de/blog/119/funksteckdosen-mit-dem-raspberry-pi-schalten
    I’m only receiving ELRO codes from my neighbour (I guess). Well at least I know now that my transmitter and my receiver are correctly connected to my raspi 3.

    I’ve been searching for tutorials describing the usage and remote control of IT 1500 for a few hours now. The only sources I’ve found are FHEM or pilight howtos.
    What I need is a shell script or a Python script that outputs the IT 1500 codes from my switches and enables sending on/off codes to them.
    Later I would like to intergrate the script into Home Assistant.

    If there is anybody who can help me, please contact me.
    Best regards
    Nini
    nini.josic@gmail.com

  24. MICHAEL says:

    Hello there. I have a usb cp210x device which seems to be installed correctly at USB0 and I tried to follow your directions for raspberry pi.

    All software is installed, but I am not very sure on how to proceed.
    It seems that rfsniffer only works with the pins.

  25. Michael Mogensen says:

    Hi Guys,

    Can I tweak this 433 MHz receiver to 868 MHz? I want to intercept a 868MHz-alarm signal to be able to hack into its packets and make it go on my wifi in the end.

  26. 97Ronnie says:

    I must say you have high quality content here.
    Your page can go viral. You need initial boost only.
    How to get it? Search for; Etorofer’s strategies

  27. Dani says:

    The 433Utils RFSniffer has some issues. Because it doesn’t cater for all protocols, you might find it also gets some of the codes wrong. It assumes that all protocols have blocks that are regular ie multiples of the same time length which isn’t the case. I’m far from being over critical as the code helped me a lot with my project which developed out of this and can be found here. https://danicymru.wordpress.com/2016/12/15/433mhz-rf-nexa-sockets-and-the-blyss-wireless-doorbell/. Hope this will help someone.

  28. I´v been trying a bit with this tool as well and am fairly happy.
    With a 17cm antenna, my remote control can send commands from ca. 10m.
    The issue with 100% CPU of RFScanner was resolved by using a callback in the interrupt routine instead of busy waiting loop. I also have quite some noise on the line resulting in up to 7000 interrupts per second. I added a little print statement when that should grow bigger. That should also be the reason why not all button presses are correctly registered.

  29. Nicolas Singh says:

    Hi!,

    Where it says:

    git clone git://github.com/ninjablocks/433Utils.git

    I think it should be:

    git clone –recursive git://github.com/ninjablocks/433Utils.git

    Because of the submodules required to compile.

    Cheers

  30. Dren says:

    I have no data sheet about these modules. IS the TX module active high or active low ? My Rx module received that tx signal but it is SWAMPED with noise and unusable.. I tired running the Rx module at 3v3 ,that made no difference to the noise problem. Did your Rx sit there spitting out spurious data the whole time ?

  31. Teiby says:

    Works with https://www.amazon.de/gp/product/B01GQFJVC0/
    Receive range is <1cm.
    Also send codesend works and has much more range.

  32. Tim says:

    you really need to clarify that you will blow up your RPI if you wire it as you show. dumping 5V into the GPIO is destructive.

    Most cheap 433 RF devices work with 3.3v for power. Please PLEASE fix your article so you dont cost someone money with your major error showing 5V for power.

  33. liran says:

    it is possible to make it print the signal to a file?
    and make the program run on background at raspberry start?

    • Paolo says:

      Yes, it’s possible but you need to modify RFSniffer.cpp adding this line:
      fflush(stdout);
      inside the while(1) loop before the command
      mySwitch.resetAvailable();
      and rebuild the executable with:
      make RFSniffer

      For printing to file it’s enough to type:
      RFSniffer > output.txt
      and to have it in background it’s enough to add & after the command

      For running it at startup it’s enough to add the line:
      RFSniffer > output.txt &
      in /etc/rc.local file.

      Enjoy

  34. Pawel says:

    Hi!
    I’m using PIR sensor on 433 and I have data like this:
    Received 26
    Received 19
    Received 26
    Received 29
    Received 29
    Received 26
    Received 16
    Received 1
    Received 9
    Received 20
    Received 9

    But for me it’s little random. What do you think? How to check it?

    • Shannon McMillen says:

      Could be change in Strong to weak signal for movement IR…
      If 0 NO Movement… Variation of Number is Movement and from Weak to Strong….

  35. Amilcar Aponte says:

    Well done! It works perfectly!

  36. Achille says:

    Hi All
    I wonder if the sniffer (RFsniffer) available here for 433Mhz can also read data from a 868 Mhz receiver

  37. Scott B. says:

    RPI 3B+ with latest Raspian: the ‘-recursive’ option to git clone barfs for me every time. Adam’s comment above fixed it for me:

    Adam 01/19/2017 at 14:12
    This worked for me: go to the root folder of your project. do a
    $ git submodule init
    and
    $ git submodule update
    Run the make again

  38. S says:

    Hello There

  39. Shannon McMillen says:

    It works perfect for me received Door Bell Button Press and changed code 1234 and sound 123 pins , on or off to get different numbers. All numbers all the same all the time… NO Random….
    Thank You ……

  40. SolusFan says:

    Thanks for the tutorial!
    Unfortunately, git://git.drogon.net/wiringPi is no longer accessible.
    The author has stopped to support it in Aug. 19.
    See http://wiringpi.com/wiringpi-deprecated/.
    The way to install it on a Raspberry Pi is simply:
    sudo apt install wiringpi

  41. jon says:

    Thanks for the tutorial. Now I know my receiver works with a wireless outlet switch, I can progress to getting it to receive weather sensor data.

    Just a note for anyone who may run into an issue I had.

    In cutting and pasting the “git clone” commands from the web page to a putty terminal, I found that the dashes preceding “recursive” were being transformed into some other character that caused the “git clone” command to not get all of the required code (specifically rc-switch). To fix the problem, remove the character that looks like a dash, and actually type in two dashes before “recursive”.

  42. Ulrich says:

    As the receiver is connected to 5 V supply voltage, the data output will be 5 V too.
    Is that not too much for a Raspberry input pin?
    Somewhere else (https://forum.pimatic.org/topic/202/4-homeduino-433-mhz-sending-receiving-and-even-more/2) was claimed that one has to reduce the output voltage by a 10k/20k voltage divider to 3.3 V.
    This seems reasonable, but does not work for me:
    When I use 3.3 V as supply voltage and connect directly data output andRaspberry gpio, it works fine, but with 5 V supply and voltage divider I receive no signals.
    The Receiver I use is a RXB6.
    Any ideas?

  43. Dmitry says:

    WARNING!!! WRONG VOLTAGE CONNECTION! YOU MAY BURN YOUR RPi GPIO EASLY!!!

    Dear colleagues, please note, never connect anything to GPIO input if you are using 5v power without voltage level checking. This is not mentioned in the article, but believe me, the weak input FET on IC pins will burn as soon as you supply 5 volt logic level to them. Accordingly, either use 3.3 volts for power, or don’t get lazy and make a simple two resistors divider.

    That’s it, now you are warned 🙂

  44. Mike Sandau says:

    Some helpful facts: Summary (April 2020) on configuring RFSniffer on Raspberry Pi

    Since I also have had difficulties in recieving my first telegrams from my 433 MHz remote, I fell the need to give some hints

    I had to collect all kind of partly outdated info from some forums. By writing this for you I want to save you some time to reach your today’s goal to see the “Received 123456” telegrams in a normal given time.

    Software:
    – there no need do install WiringPi as it is already present on modern hardware. Gordon’s website drogon.net won’t reply.

    -Installing 433Utils is still needed, don’t forget –recursive parameter

    – stick to the port number 2 in sourcecode, that’s correct for GPIO#27 That’s Pin 13 on modern Pi
    use ‘ gpio readall ‘ as help

    – no need to experiment with the pulselength parameter. It can be passed to RFSniffer. It had no effect on the quality of my results

    – setting GPOI port 2 to tristate is correct, the pullup resistor. Use shellcommand ‘gpio mode 2 tri’

    – in RFSniffer.cpp method myswitch.available()
    always return false IF NO MESSAGE IS BEEING recieved, which is true for 99.99999% of the time spent in the loop. So that’s O.K.

    Hardware:
    -connecting a reciever to +5Vcc that gives a +3.3V to port 2 doesn’t harm my Pi. Add a 1K resistor to fell better. (No warranty besides me to this!)

    -the reciever I used was absolutely deaf on both ears, even after I outfitted it with some loop antenna ~1 inch length: it still didn’t listen to my remote

    -actually I had to go sooo near to that thing to see first success: Really close, we’re talking of 2-3 inches max!

    -finetuning: after I tuned the reciever with a precision screwdriver I was able to extend the range to 3 meters !! That’s still not enough for most home application – but hey – the whole set costs €3

    -using your multimeter to measure the signal coming out of the identical datapins from the reciever is a good idea. So you can be sure wheter you have issues on HW -or SW. You don’t need an oscilloscope for that.

    My reciever showed some signal as I pressed the remote button:
    V~ (AC) was 1.0V. I added some driverchip to enhance it to 1.3V, but it will normally work. V~ will be 1.0V * 2 * sqrt(2) -> 2.8 Vpp (peak to peak). This would only be true for a sine wave, we dont have this here. But for comparison it might help.

    This V~ AC measurement strongly depends on your ASK (Amplitude Shift Keying) reciever and on how many “ones” it will recieve from the remote. The puselength of my remote is 1.2 ms

    I think that’s the latest info I’ve got for you today I wanted to share,
    enjoy, have fun and success

    Mike

    ——————————-
    equiment used:
    Raspberry Pi 3b running Raspbian 4.19.11
    433 module: MX-RM-5V 080408
    remote control set: brennenstuhl RCS 1000 N

    comments for 433 send
    ————————————–
    it was much easier to get the sending module running than the reciever. Most tutorials tell you to first set up the recieve module FIRST in order to get the codenumber sent by your remotedevice. This is afaik not the only solution – I did it the other way.You can use the manual of your remote control set to find the neccessary parameters for the send. I hacked into my own device by trying some codes and succeeded very fast. By examining the very good manual of brennenstuhl the homecode was quickly found by setting the DIP swiches all to on -> “11111” first parameter was found. Then 3 for the third wall plug and 1 for “on”. You hear “click” Heureka. And you’re done!
    example from above:
    433Utils/RPi_utils/send 1111 3 1

    PS: same article was posted in Arduinotread here too,pls delete the post there as it bongs to Raspberry. Thanks.

  45. Dragos says:

    i get the code for a simple remote but nothing from any other devices. Other devices that i’m intrested is a simple weather station with 3 room sensors.
    I know that the sensors use 433 mhz because i open one and see marked on a chip.
    Please advise, what i have to change

  46. DJ says:

    Hallo,
    is it possible to “ask” the ststus of the plug via a codesend command? It should return on or off or some value…

    And another question:
    How do I “convert” the raw codes from RFSniffer to unit codes

    Thanks…

  47. As always thank you for great article

  48. Pete says:

    I’ve installed this, but get no output. I happen to have a transmitter that looks exactly like the one used by the author. I have an oscilloscope and when I press a button, I can see a nice clean data signal, otherwise it is clearly random noise. Are there any options to diagnose why the software is unable to decode the data?

  1. 09/29/2014

    […] Decode 433 Mhz signal with Raspberry Pi and a 433 Mhz receiver […]

  2. 04/27/2015
  3. 05/06/2015

    […] how to get the unit code values, either using a Raspberry Pi, or Arduino: Raspberry Pi tutorial: http://www.princetronics.com/?p=596 Arduino […]

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.