Logging every packet a LoRa radio hears
I'm mapping the LoRa radios near me. LoRa is a long-range, low-power radio. Meshtastic is firmware that turns cheap LoRa boards into a text-messaging mesh with no Wi-Fi and no cell service. My board is a Heltec V4 on the US band with the LongFast preset.
Why a log
The radio keeps its own list of nodes it has heard, but that list can lose entries when the board is unplugged or restarts. I wanted a record on disk that doesn't forget.
The logger
lora-log is a Python service using the Meshtastic library. It runs under systemd on my travel laptop and restarts if it dies. It writes:
- one JSON line per received packet, to a file per day
- a snapshot of the radio's node list every time it connects
Two small lessons. Use the stable /dev/serial/by-id/... path for the board, not ttyUSB0, which can change between plugs. And the service holds the serial port, so it has to be stopped before the meshtastic command-line tool can talk to the radio.
Here's part of the log from a test with a second node a few meters away:
time from type snr dB rssi dBm
20:34:52 node B TEXT_MESSAGE 6.5 -5
20:34:54 node B ROUTING 5.75 -6
20:36:38 node B TRACEROUTE 5.75 -9
20:40:52 node B POSITION 6.25 -15
20:41:29 node B NODEINFO 5.75 -7
From the real log, October 15. The other node's ID and location are left out.
Next is plotting the positions on a map.
← All posts