Running MeshCore Repeater Natively on a Raspberry Pi
MeshCore is a lean, multi-hop LoRa mesh networking stack. It runs on the usual embedded devices: ESP32, nRF52, RP2040, etc., but the interesting use-case for Linux users is running it on a Raspberry Pi with an SX1262 LoRa HAT or similar hardware attached directly.
This post covers a native Linux target I have built, and how it works.
Why Linux native
The practical motivation is simple: a Raspberry Pi running a MeshCore repeater or companion is a natural home for bots, bridges, and integrations. I want to run a Python bot that speaks to the mesh, scheduling announcements or responding to questions: No problem if I can embed it directly as a Linux system service and use the entire toolbox that the operating system offers, no cables or bluetooth required.
The work currently lives in my fork at github.com/l5yth/meshcore-linux (branch linux) and is pending upstream review at meshcore-dev/MeshCore#2025. It is the continuation of previous work by Alex (#395) and Grzegorz (#1137).
What has been implemented
A single self-contained binary meshcored. Build with PlatformIO, copy to or compile on the Pi, point it at an INI config file. No Arduino framework install, no Portduino runtime, no package manager headaches beyond libgpiod and kernel SPI/GPIO headers.
Hardware abstraction via standard Linux interfaces. SPI is handled through /dev/spidev, GPIO through libgpiod v2, timing through clock_gettime. The SX1262 radio, a Waveshare LoRa HAT, a PoW HAT, or any wired equivalent, talks to the kernel the same way any other Linux SPI device does.
Full repeater functionality. The linux_repeater firmware is a direct build of the simple_repeater example: flood routing, direct routing, AES-128 encrypted packets, duty-cycle enforcement, neighbour tracking.
Runtime configuration. All radio parameters, GPIO pin assignments, node name, and admin password live in a plain INI file read on every startup. No reflashing to change frequency or spreading factor. The node identity and user-facing preferences (name, password, region) are persisted separately in a data directory and survive restarts. After first start, you can use this to also remotely manage the repeater.
systemd integration. A drop-in service unit is included. The binary runs as a dedicated meshcore user, logs to the journal, and restarts on failure.
How to install meshcored
Clone github.com/l5yth/meshcore-linux, install PlatformIO, then:
FIRMWARE_VERSION=1.14.1-linux ./build.sh build-firmware linux_repeater
The output binary can be found at .pio/build/linux_repeater/program. Copy it to /usr/bin/meshcored on the Pi.
Configure SPI and GPIO
Drop a meshcored.ini at /etc/meshcored/meshcored.ini. A minimal working config for a Waveshare SX1262 HAT (using UK/Narrow preset):
spidev = /dev/spidev0.0
gpiochip = /dev/gpiochip0
lora_irq_pin = 16
lora_reset_pin = 18
lora_nss_pin = 21
lora_busy_pin = 20
lora_freq = 869.618
lora_bw = 62.5
lora_sf = 8
lora_cr = 8
advert_name = MyRaspberryPi
admin_password = change,me,1234
For a PoW SX1262 HAT on a Zero 2W, swap in lora_irq_pin = 22 and lora_reset_pin = 13 and remove the NSS/BUSY lines (those pins are wired on the HAT but handled transparently).
On Raspberry Pi 5, the GPIO controller moved, set gpiochip = /dev/gpiochip4.
Run interactively or as system service
And then just run meshcored to test everything works, it should tell you about the radio settings, the public key, and logs about adverts and noise floor.
meshcored --fsdir /var/lib/meshcore
For production, create a meshcore user, install the udev rules from variants/linux/99-meshcore.rules, install the systemd unit from variants/linux/meshcored.service and enable it:
systemctl enable --now meshcored
journalctl -u meshcored -f
First Boot and CLI
On first boot the node generates a new ed25519 identity and writes it to --fsdir. The INI values for advert_name, admin_password, and radio parameters are applied as initial defaults, then saved to com_prefs. On subsequent boots, com_prefs takes precedence, so INI changes to those fields have no effect after first run.
To reset and re-apply the INI: remove com_prefs from the data directory and restart.
To change parameters at runtime without resetting, use the mesh CLI over a connected phone app or serial interface, set freq, set sf, set name, etc. Changes are persisted immediately.
And that's it. Let me know by email if you are also running MeshCore on a Raspberry Pi or similar Linux devices!
The fork at github.com/l5yth/meshcore-linux is the reference for the native Linux target while the upstream PR review is ongoing. Watch meshcore-dev/MeshCore#2025 for merge status.
Built and tested on Raspberry Pi Zero 2W and Pi 4 with Waveshare and PoW SX1262 HATs.