SX1278 LoRa on Raspberry Pi
This guide is based on the tutorial from CircuitDigest here with a few modifications I made to get it working on my Raspberry Pi Zero 2 W.
Hardware
- SX1278 LoRa Module Ra-02 433MHZ
- Raspberry Pi (ested on a Raspberry Pi Zero 2 W)
Software
- Raspberry Pi OS (tested on Raspberry Pi OS Lite 64-bit)
Circuit Diagram
| Raspberry Pi | LoRa – SX1278 Module |
|---|---|
| 3.3V | 3.3V |
| Ground | Ground |
| GPIO 10 | MOSI |
| GPIO 9 | MISO |
| GPIO 11 | SCK |
| GPIO 8 | Nss / Enable |
| GPIO 4 | DIO 0 |
| GPIO 17 | DIO 1 |
| GPIO 18 | DIO 2 |
| GPIO 27 | DIO 3 |
| GPIO 22 | RST |

Update and Upgrade
sudo apt update && sudo apt upgrade -yInstall Required Packages
sudo apt-get install python3-pip python3-dev python3-rpi.gpio python3-spidev git -yReplace GPIO Library
sudo apt-get remove python3-rpi.gpio
sudo apt-get install python3-rpi-lgpioEnable SPI Interfaces
sudo raspi-configNavigate to Interfacing Options

Select SPI and enable it.

Enable SPI Interface

Success Message

Now exit raspi-config and reboot the Raspberry Pi:
sudo rebootDownload LoRa Library
git clone https://github.com/rpsreal/pySX127x.gitNavigate to Library Directory
cd pySX127xRun a sample script
python3 tx_beacon.pyIf you see the following output, the module should be ready to go:
