Decode a 433 MHz weather sensor
Build it step by step
0 of 7 doneWire the receiver
Data to D2 and add the wire antenna.
Capture a frame
Run the sketch near the sensor.
Find the pulse widths
Look for two or three typical values.
Convert pulses to bits
Short gap is 0, long gap is 1.
Group the bits
Look for an ID, temperature and checksum.
Change the sensor's temperature
Warm it in your hand and see which bits change.
Decode and print
Show the temperature in degrees.
How do you build a decode a 433 MHz weather sensor?
A cheap 433 MHz receiver captures signals from wireless weather sensors and an Arduino decodes the temperature. You need Arduino Nano, 433 MHz RF transmitter and receiver pair, Breadboard 830 Tie Points and Jumper wires male to male (40 pcs, 20 cm). It takes 7 steps and about 180 minutes.
- Level
- Intermediate
- Time
- About 180 min
- Parts
- 4
Parts list
- Development BoardsBuyArduino Nano × 1
- WirelessBuy
- PrototypingBuy
- PrototypingBuy
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| Receiver VCC and GND | Nano 5V and GND | Power |
| Receiver DATA | Nano D2 | Pulse input (interrupt) |
| Receiver antenna pad | A 17 cm wire | Quarter-wave antenna |
| USB | Nano | Power and serial monitor |
Code
Many cheap weather sensors send the same frame several times with simple timing: a short pulse followed by a gap whose length says 0 or 1. The receiver outputs noise constantly when no sensor is sending, so the sketch looks for a long gap, counts the pulses after it and prints them when a frame ends. Read the timings, find the short and long values, turn the pairs into bits, and compare the bits with the temperature on the sensor's own display. Different temperatures reveal which bits change. Use a 17 cm wire as an antenna for a much better range. Only decode a sensor that you own and only listen with this receiver. Do not record and replay other people's signals to operate devices such as car keys, doorbells or garage openers, as that is illegal in many places and can be unsafe. Arduino IDE, board "Arduino Nano" (try the Old Bootloader option if the upload fails).
Runs on a virtual Arduino Nano in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).
// Capture the pulse widths of a 433 MHz sensor and print them. Board: Arduino Nano.
// Step 1: run this and read the timings. Step 2: work out the protocol and decode it (see the notes below).
const int PIN = 2;
const int MAX_PULSES = 200;
volatile unsigned int pulses[MAX_PULSES];
volatile int count = 0;
volatile bool ready = false;
volatile unsigned long lastEdge = 0;
void onEdge() {
unsigned long now = micros();
unsigned long width = now - lastEdge;
lastEdge = now;
if (ready) return;
if (width > 3500 && count > 40) { ready = true; return; } // a long gap marks the end of a frame
if (width > 3500) { count = 0; return; } // a long gap with too few pulses: start again
if (count < MAX_PULSES) pulses[count++] = (width > 65000) ? 65000 : width;
}
void setup() {
Serial.begin(115200);
pinMode(PIN, INPUT);
attachInterrupt(digitalPinToInterrupt(PIN), onEdge, CHANGE);
Serial.println("Waiting for a sensor frame...");
}
void loop() {
if (ready) {
noInterrupts(); int n = count; unsigned int copy[MAX_PULSES];
for (int i = 0; i < n; i++) copy[i] = pulses[i];
count = 0; ready = false; interrupts();
Serial.print("Frame of "); Serial.print(n); Serial.println(" pulses (microseconds):");
for (int i = 0; i < n; i++) { Serial.print(copy[i]); Serial.print(i % 16 == 15 ? "\n" : " "); }
Serial.println();
// Step 2 idea: many cheap sensors send a 0 as a short high plus a long low and a 1 as a short high plus a
// very long low. Compare the pairs: if the low is under 1500 us call it 0, otherwise 1, and print the bits.
}
}What the serial monitor should show
Open the serial monitor at the baud rate in the code. This is what our simulator prints for a virtual Arduino Nano with its sensors at their default values. Your numbers will follow your real readings, but the format should match.
Waiting for a sensor frame...
Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| Sensor sends | A frame of about 80 to 100 pulses appears |
| Repeated frames | Almost identical numbers |
| Warm the sensor | A group of bits changes |
| Decoded temperature | Within a degree of the display |
If it does not work
Only noise appears
Move the sensor closer and add the antenna.
No frames
Check the data pin and that the sensor is on 433 MHz.
Frames differ every time
Look at the noise; use the long-gap rule.
Cannot find the bit meaning
Capture several frames at different temperatures.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the decode a 433 MHz weather sensor?
Arduino Nano, 433 MHz RF transmitter and receiver pair, Breadboard 830 Tie Points and Jumper wires male to male (40 pcs, 20 cm).
How long does the decode a 433 MHz weather sensor take to build?
About 180 minutes for a intermediate maker, in 7 steps.
How do I know the decode a 433 MHz weather sensor works?
Sensor sends: A frame of about 80 to 100 pulses appears. Repeated frames: Almost identical numbers. Warm the sensor: A group of bits changes.
Only noise appears: what should I check?
Move the sensor closer and add the antenna.
No frames: what should I check?
Check the data pin and that the sensor is on 433 MHz.
Frames differ every time: what should I check?
Look at the noise; use the long-gap rule.
Cannot find the bit meaning: what should I check?
Capture several frames at different temperatures.
