Exploring Meshtastic Decoding with GNU Radio on a Raspberry Pi 5

gnu-radio-meshtastic-decode-fail


Originally by Jeff Geerling – jeffgeerling.com


Meshtastic, an open-source project that enables long-range mesh communication over LoRa radios, has gained a loyal following in the amateur radio and DIY communities. One enthusiast, Jeff Geerling, has recently documented his efforts to decode Meshtastic traffic using GNU Radio on a Raspberry Pi 5. This project showcases the power of software-defined radio (SDR) and open-source tools to visualize and understand wireless protocols.

The Goal: Portable Meshtastic Decoder

Jeff’s goal was to create a portable Meshtastic monitor using a Raspberry Pi 5, a HackRF SDR, and a 7.84″ DeskPi touchscreen mounted in a compact Rackmate TT rack. This setup would allow for real-time visualization of Meshtastic signals at events like Open Sauce, helping educate attendees about the power and accessibility of SDR.

To monitor Meshtastic communications, he centered his setup on the LongFast frequency—902.125 MHz in the U.S.—and built a GNU Radio Companion (GRC) flowgraph to decode and visualize the transmissions.


Setting Up GNU Radio on Raspberry Pi

Installation

Installing GNU Radio on Raspberry Pi OS is straightforward:

sudo apt install -y gnuradio cmake

For those using a HackRF One:

sudo apt install -y hackrf libhackrf-dev soapysdr-module-hackrf

GNU Radio Companion can be launched from the Pi menu under Programming.

If errors occur, such as ModuleNotFoundError: Cannot import gnuradio, it may be necessary to adjust your environment variables or downgrade NumPy:

pip install numpy==1.26.4

Integrating Meshtastic Support

To decode Meshtastic packets, Jeff used the Meshtastic_SDR project by Josh Conway.

Clone the project:

cd ~/Downloads
git clone https://gitlab.com/crankylinuxuser/meshtastic_sdr.git

Install dependencies:

pip3 install meshtastic --break-system-packages

Install the GNU Radio LoRa SDR plugin:

sudo apt install -y cmake
git clone https://github.com/tapparelj/gr-lora_sdr
cd gr-lora_sdr
mkdir build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local
sudo make install -j$(nproc)
sudo ldconfig

This installs the LoRa transceiver blocks for use in GNU Radio Companion.


Visualizing the Data

With everything installed, Jeff loaded a GRC file from the Meshtastic_SDR project:

~/Downloads/meshtastic_sdr/gnuradio scripts/RX/Meshtastic_US_allPresets.grc

Or, for RTL-SDR users with narrower bandwidth:

~/Downloads/meshtastic_sdr/gnuradio scripts/RX/Meshtastic_US_62KHz_RTLSDR.grc

He used filters and a Rational Resampler to narrow in on the LongFast channel and displayed the signal using a QT GUI Waterfall Sink. This allowed clearer visualization of signal activity over time.

To eliminate the DC spike in the center of the waterfall, you can:

  1. Install gr-correctiq
  2. Slightly shift the tuning off-center

Troubleshooting RX Scripts

While the GNU Radio flowgraphs worked well for visualization, decoding actual Meshtastic messages via the provided Python scripts proved problematic. Running:

cd ~/Downloads/meshtastic_sdr/python\ scripts
python3 meshtastic_gnuradio_RX.py -n 127.0.0.1 -p 20004

…resulted in repeated “OsO” messages and no usable output. Jeff filed an issue on the Meshtastic_SDR GitLab repository and is continuing to debug.

He also shared two modified GRC files—focused on a single channel to reduce CPU load:

  • Meshtastic-US-LongFast.grc
  • Meshtastic-US-ShortTurbo.grc

(Rename from .grc_.txt to .grc to open in GNU Radio Companion.)


Common Errors and Fixes

If you encounter errors like:

ImportError: libgnuradio-lora_sdr.so.1.0.0git: cannot open shared object file

…you may need to uninstall and reinstall the LoRa SDR plugin properly:

cd ~/Downloads/gr-lora_sdr/build
sudo make uninstall
sudo make clean
cd ..
sudo rm -rf build
# Then repeat cmake and make install steps

If your HackRF is not detected:

  1. Confirm it’s visible via lsusb
  2. Run:
SoapySDRUtil --probe="driver=hackrf"

If root access is needed, try sudo SoapySDRUtil ... and reboot afterwards.


Final Thoughts

Despite some hiccups decoding messages, the project demonstrates the flexibility of GNU Radio and Raspberry Pi for protocol exploration. Jeff’s build serves as a great educational tool and stepping stone for anyone interested in SDR, LoRa, or mesh networking.

For those diving in, expect a learning curve with dependencies, Python environments, and signal debugging—but the result is a powerful custom SDR monitoring setup.


Sources:

Post Comment

You May Have Missed