Skip to main content

Rooftop Gateway Build (Pi + LoRa)

Rooftop Gateway Build (Pi + LoRa)

A rooftop gateway bridges your local LoRa mesh to the internet, enabling remote monitoring via meshmap.net, MQTT integration with Home Assistant, and APRS forwarding. This build uses a Raspberry Pi Zero 2W paired with a USB-connected LoRa node as the simplest, most maintainable approach.

Parts List

PartApprox. Cost
Raspberry Pi Zero 2W~$15
Heltec LoRa 32 V3 (SX1262, USB-C) - acts as the LoRa radio~$20
5V PoE splitter (802.3af to micro-USB/USB-C) or USB power supply~$10
MicroSD card, 16 GB (Class 10 / A1 or better)~$8
Weatherproof outdoor enclosure (IP65 or better, fits Pi + Heltec)~$25
Short USB-A to USB-C cable (internal, ~15 cm)~$3
Total~$81–81 - 100

Alternative radio option: For LoRaWAN instead of Meshtastic, substitute the Heltec with a RAK2287 Pi HAT (SX1302 8-channel concentrator, ~$80) and use the ChirpStack network server. This guide focuses on the Meshtastic MQTT gateway path.

Setup: Meshtastic MQTT Gateway

1. Prepare the Pi

Flash Raspberry Pi OS Lite (64-bit) to the microSD card using Raspberry Pi Imager. In the Imager advanced settings, pre-configure your Wi-Fi credentials, enable SSH, and set a hostname (e.g. mesh-gateway). This avoids needing a display or keyboard on first boot.

2. Connect the Heltec

Connect the Heltec LoRa 32 V3 to the Pi Zero 2W via the short USB-C cable. The Pi will enumerate the Heltec as a USB serial device at /dev/ttyUSB0 or /dev/ttyACM0. Confirm with:

ls /dev/tty{USB,ACM}*

3. Install Software

sudo apt update && sudo apt upgrade -y
pip install meshtastic
sudo apt install -y mosquitto mosquitto-clients

4. Configure the Heltec via Meshtastic CLI

Connect to the node over USB serial and enable MQTT:

# Set MQTT server to localhost (the Pi itself)
meshtastic --port /dev/ttyACM0 --set mqtt.address localhost
meshtastic --port /dev/ttyACM0 --set mqtt.enabled true
meshtastic --port /dev/ttyACM0 --set mqtt.uplink_enabled true
meshtastic --port /dev/ttyACM0 --set mqtt.downlink_enabled true
# Enable JSON output (optional, for Home Assistant compatibility)
meshtastic --port /dev/ttyACM0 --set mqtt.json_enabled true

5. Configure Mosquitto

Edit /etc/mosquitto/mosquitto.conf to add an anonymous local listener (or add username/password auth for security):

listener 1883
allow_anonymous true

Restart Mosquitto:

sudo systemctl restart mosquitto
sudo systemctl enable mosquitto

6. Network Connectivity

Options in order of preference:

  • PoE Ethernet: Use a PoE splitter to power the Pi over the same Ethernet cable that connects it to your router. Most reliable and simplest.
  • Wi-Fi: The Pi Zero 2W has 2.4 GHz Wi-Fi. Works well if the rooftop is within range of your router. Add a second 2.4 GHz AP if needed.
  • Ethernet-over-USB (USB gadget mode): Configure the Pi as a USB network adapter - plug a USB cable to a computer or router port. Useful when no other connectivity is available near the Pi.

7. Optional: Node-RED for Local Processing

bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)

Node-RED provides a visual flow editor for filtering, transforming, and routing mesh packets to Home Assistant, InfluxDB, or external webhooks without writing code.

8. Auto-Start on Boot (systemd)

Meshtastic's MQTT bridge runs automatically when the Heltec is plugged in and Mosquitto is running, so no custom service is usually needed. If you add a custom Python script (e.g. for APRS forwarding), create a systemd service:

# /etc/systemd/system/mesh-bridge.service
[Unit]
Description=Mesh MQTT Bridge
After=network.target mosquitto.service
Requires=mosquitto.service

[Service]
ExecStart=/usr/bin/python3 /home/pi/mesh_bridge.py
Restart=always
RestartSec=10
User=pi

[Install]
WantedBy=multi-user.target
sudo systemctl enable mesh-bridge
sudo systemctl start mesh-bridge

9. Verify Packet Flow

Subscribe to all Meshtastic topics on the local broker and confirm packets are arriving:

mosquitto_sub -h localhost -t 'msh/#' -v

You should see JSON or binary payloads appearing whenever a node in range transmits. If nothing appears, check USB serial connectivity and MQTT settings on the Heltec.

Use Cases

  • meshmap.net visibility: Configure Mosquitto to bridge to the public meshmap MQTT server so your nodes appear on the community map. See the meshmap.net documentation for bridge configuration details.
  • Home Assistant integration: Use the Mosquitto add-on in Home Assistant and subscribe to msh/2/json/# for parsed telemetry and position data. Create automations triggered by mesh events.
  • APRS gateway: Run aprx or a custom script to re-encode position packets as APRS-IS frames and upload to aprs.fi for interoperability with the ham radio APRS network (requires amateur license).
  • Remote node monitoring: Query node telemetry via MQTT from anywhere on the internet to check battery voltage, SNR, and uptime of your remote repeaters.