433 MHz RF transmitter/receiver for Raspberry Pi using gpiod (Pi 3/4/5)
Project description
rpi-rf-gpiod
Modern 433 MHz RF library for Raspberry Pi using gpiod — works on Pi 3B, 4, and 5.
Drop-in replacement for rpi-rf with:
- ✅ Pi 5 support (RP1 chip,
/dev/gpiochip4) - ✅ Kernel 6.12+ compatible (gpiod edge detection works where lgpio/RPi.GPIO don't)
- ✅ Interrupt-based RX (kernel edge events with nanosecond timestamps, ~0% CPU idle)
- ✅ No GIL contention between TX and RX
- ✅ No daemon required (unlike pigpio)
Installation
pip install rpi-rf-gpiod
Prerequisites: gpiod Python bindings (usually pre-installed on Raspberry Pi OS Bookworm):
sudo apt install python3-libgpiod
Quick Start
Send a code
from rpi_rf_gpiod import RFTransmitter
with RFTransmitter(gpio=17) as tx:
tx.send(code=4539729, protocol=1, repeat=10)
Receive codes
from rpi_rf_gpiod import RFReceiver
def on_code(code, protocol, pulselength):
print(f"Received: {code} (proto={protocol}, pl={pulselength}µs)")
with RFReceiver(gpio=16, callback=on_code) as rx:
import time
while True:
time.sleep(1)
CLI Tools
# Send
rf_send 4539729 --gpio 17 --protocol 1 --repeat 10
# Receive
rf_receive --gpio 16
API Reference
RFTransmitter(gpio=17, chip=None)
| Method | Description |
|---|---|
enable() |
Open GPIO and claim pin as output |
disable() |
Release GPIO resources |
send(code, protocol=1, pulselength=None, repeat=10, length=24) |
Transmit an RF code |
RFReceiver(gpio=16, chip=None, callback=None)
| Method | Description |
|---|---|
enable() |
Start edge detection |
disable() |
Stop and release GPIO |
register_callback(cb) |
Add a (code, proto, pl) -> None callback |
unregister_callback(cb) |
Remove a callback |
set_tx_guard(duration=1.0) |
Ignore codes for N seconds (anti self-reception) |
clear_tx_guard(cooldown=0.5) |
Resume receiving after TX |
start_capture() |
Begin buffering codes (for learn mode) |
stop_capture() |
Stop and return buffered [(code, proto, pl), ...] |
get_capture_snapshot() |
Get buffer copy without stopping |
Supported Protocols
| # | Pulse (µs) | Typical Use |
|---|---|---|
| 1 | 350 | PT2262, most common outlets |
| 2 | 650 | — |
| 3 | 100 | — |
| 4 | 380 | — |
| 5 | 500 | — |
| 6 | 200 | HT6P20B |
Why not rpi-rf?
| Feature | rpi-rf | rpi-rf-gpiod |
|---|---|---|
| GPIO backend | RPi.GPIO (unmaintained) | gpiod (active, kernel-supported) |
| Pi 5 | ❌ | ✅ |
| RX method | GPIO.add_event_detect (broken 6.12+) | gpiod edge events (works on 6.12+) |
| CPU usage (RX idle) | ~15% (polling workaround) | ~0% |
| GIL contention | Yes (TX vs RX fight for GIL) | No (edge events are lightweight) |
Why gpiod over lgpio?
Both lgpio and RPi.GPIO edge detection are broken on kernel 6.12+. We tested all available GPIO libraries on a Pi 1B+ with kernel 6.12.47:
| Library | Edge Detection |
|---|---|
| lgpio 0.2.2 | ❌ Broken |
| RPi.GPIO | ❌ Broken |
| gpiod 2.2 | ✅ Works |
| gpiozero 2.0 | ✅ Works (uses gpiod internally) |
| pigpio | ✅ Works (requires daemon) |
Hardware
Connect a 433 MHz transmitter/receiver module:
TX Module: RX Module:
VCC → 5V VCC → 5V
GND → GND GND → GND
DATA → GPIO 17 DATA → GPIO 16
(+ antenna) (+ antenna)
License
BSD 3-Clause. Based on protocol definitions from rc-switch and rpi-rf.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rpi_rf_gpiod2-1.0.1.tar.gz.
File metadata
- Download URL: rpi_rf_gpiod2-1.0.1.tar.gz
- Upload date:
- Size: 11.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ba3576776e47f3f6e31b4228a4320398696fd53e69ddeb623054316cb00dbf41
|
|
| MD5 |
a56ff4ae80fb3f67af79bcfbe754b37d
|
|
| BLAKE2b-256 |
39d827ccd3839339ca3f74fa608ca955e8f882470eb668ddf805d0e72421d38d
|
File details
Details for the file rpi_rf_gpiod2-1.0.1-py3-none-any.whl.
File metadata
- Download URL: rpi_rf_gpiod2-1.0.1-py3-none-any.whl
- Upload date:
- Size: 11.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
556fe662fb3cad93f3315a7e75160d75db6d9cb822db29c94227fa94a6785e9d
|
|
| MD5 |
53cf0b8114156bf7f92cdd03d7294206
|
|
| BLAKE2b-256 |
367a3b66582c4705b96e9199af9f2f0a17f895920e8dfa310f267ba0e00406d9
|