index

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

Software

  • Raspberry Pi OS (tested on Raspberry Pi OS Lite 64-bit)

Circuit Diagram

Raspberry PiLoRa – SX1278 Module
3.3V3.3V
GroundGround
GPIO 10MOSI
GPIO 9MISO
GPIO 11SCK
GPIO 8Nss / Enable
GPIO 4DIO 0
GPIO 17DIO 1
GPIO 18DIO 2
GPIO 27DIO 3
GPIO 22RST
Circuit Diagram
Circuit Diagram

Update and Upgrade

sudo apt update && sudo apt upgrade -y

Install Required Packages

sudo apt-get install python3-pip python3-dev python3-rpi.gpio python3-spidev git -y

Replace GPIO Library

sudo apt-get remove python3-rpi.gpio
sudo apt-get install python3-rpi-lgpio

Enable SPI Interfaces

sudo raspi-config

Navigate to Interfacing Options Interfacing Options Menu

Select SPI and enable it. Select SPI

Enable SPI Interface Enable SPI

Success Message SPI Enabled

Now exit raspi-config and reboot the Raspberry Pi:

sudo reboot

Download LoRa Library

git clone https://github.com/rpsreal/pySX127x.git
cd pySX127x

Run a sample script

python3 tx_beacon.py

If you see the following output, the module should be ready to go: TX Beacon Script Output