RadioHead Packet Radio library for embedded microprocessors - Fork for RFM22B and RFM69 support on Raspberry Pi, October 2020
This is a modification of the initial fork by Charles-Henri Hallard for Raspberry PI support of the original RadioHead Packet Radio library. The RadioHead Packet Radio library for embedded microprocessors by Mike McCauley provides a complete object-oriented library for sending and receiving packetized messages via a variety of common data radios and other transports on a range of embedded microprocessors.
Please read the full documentation and licensing for the original code by Mike McCauley. This fork has been merged with the orginal RadioHead Packet Radio library version 1.108
Compatible boards
- Kept compatibility with RF69 and RF95 based radio modules on Raspberry Pi from the original fork by Charles-Henri Hallard.
- RF95 NOT Tested!
- Custom RHutil code from original fork moved to RadioHead/RHutil_rf69_rf95.
- Added compatibility with HopeRF RFM22B and HopeRF RFM69HCW based radio modules on Raspberry Pi
- Based on sample code for RFM69HCW on Raspberry Pi by Charles-Henri Hallard and sample code for RF24 on Arduino by Mike McCauley
- Custom RHutil code available in RadioHead/RHutil_izk
- Code modifications:
- RadioHead.h (include RHutil_izk/RasPi.h when bcm2835.h is used)
- RHSPIDriver.cpp/h (define and use RPI_CE0_CE1_FIX)
- RHReliableDatagram.cpp and RH_RF22.cpp/h (several modifications)
- RH_RF69.cpp/h (small modifications in addition to original fork)
- Sample code can be found in the RadioHead/examples/raspi/rf22b_izk and RadioHead/examples/raspi/rf69_izk folders
Clone repository
git clone https://github.com/istvanzk/RadioHead
Note: the example scripts using the bcm2835_gpio_len/eds combination, work only if the boot/config.txt contains the line
dtoverlay=gpio-no-irq
For the explanations see conclusion, discussion, discussion.
Connection and pins definition
To connect a Raspberry Pi (V2) to a RFM22B module, connect the pins like this:
Raspberry PI RFM22B
P1_20,P1_25(GND)----------GND-\ (ground in)
SDN-/ (shutdown in)
VDD----------VCC (3.3V in)
P1_22 (GPIO25)----------NIRQ (interrupt request out)
P1_24 (CE0)----------NSEL (chip select in)
P1_23 (SCK)----------SCK (SPI clock in)
P1_19 (MOSI)----------SDI (SPI Data in)
P1_21 (MISO)----------SDO (SPI data out)
/--GPIO0 (GPIO0 out to control transmitter antenna TX_ANT)
\--TX_ANT (TX antenna control in) RFM22B only
/--GPIO1 (GPIO1 out to control receiver antenna RX_ANT)
\--RX_ANT (RX antenna control in) RFM22B only
To connect a Raspberry Pi (V2) to a RFM69HCW module, connect the pins like this:
Raspberry PI RFM69HCW
P1_20,P1_25(GND)----------GND (ground in)
VDD----------VCC (3.3V in)
P1_22 (GPIO25)----------DIO0 (interrupt request out)
P1_24 (CE0)----------NSS (chip select in)
P1_23 (SCK)----------SCK (SPI clock in)
P1_19 (MOSI)----------SDI (SPI Data in)
P1_21 (MISO)----------SDO (SPI data out)
Boards pins Chip Select and IRQ line (Reset and LED not used) definition for RFM22B and RFM69HCW can be set in your code like:
#define RF_CS_PIN RPI_V2_GPIO_P1_24 // Slave Select on CE0 so P1 connector pin #24
#define RF_IRQ_PIN RPI_V2_GPIO_P1_22 // IRQ on GPIO25 so P1 connector pin #22
#define RF_LED_PIN NOT_A_PIN // No onboard led to drive
#define RF_RST_PIN NOT_A_PIN // No onboard reset