Building a Meshtastic Internet Gateway
A Meshtastic internet gateway bridges local LoRa radio traffic to the internet and can serve as a powerful community infrastructure node. This guide covers setting up a dedicated gateway on a Raspberry Pi.
Gateway hardware options
| Option | Hardware | Pros | Cons |
|---|---|---|---|
| ESP32 node (simplest) | Heltec V3/V4, T-Beam | Single device, no Pi needed, compact | Single-channel, limited processing |
| Pi + LoRa hat | Raspberry Pi 4 + RAK2287/RAK5146 | Multi-channel gateway possible, full Linux environment | More complex setup |
| Pi + USB LoRa node | Raspberry Pi + RAK4631 USB | Easy setup, use standard Meshtastic firmware | Single channel only |
Option 1: Dedicated ESP32 gateway node
The simplest approach: configure a Heltec V3/V4 or T-Beam as a dedicated gateway. This node doesn't need to be a router/repeater — its primary job is bridging radio and MQTT.
- Flash with Meshtastic firmware (standard)
- Connect to your home or community WiFi:
meshtastic --set network.wifi_ssid "YourSSID" --set network.wifi_psk "YourPassword" - Configure MQTT as described in the MQTT Setup page
- Set role:
meshtastic --set device.role ROUTER(so it actively forwards radio packets) - Mount at a good location with LoRa antenna and reliable WiFi
Option 2: Raspberry Pi + USB LoRa node
Connect an nRF52840-based device (RAK4631, T-Echo) via USB to a Raspberry Pi. The Pi handles internet connectivity while the LoRa node handles radio.
Setup the LoRa node
# Flash with Meshtastic firmware
# Set role to ROUTER
meshtastic --port /dev/ttyUSB0 --set device.role ROUTER
Install meshtasticd (Meshtastic daemon)
pip3 install meshtastic
pip3 install meshtasticd # If available for your platform
Configure MQTT bridging via Python
import meshtastic
import meshtastic.serial_interface
import paho.mqtt.client as mqtt
import json
# Connect to the LoRa node
iface = meshtastic.serial_interface.SerialInterface("/dev/ttyUSB0")
# Connect to MQTT broker
mq = mqtt.Client()
mq.username_pw_set("meshdev", "large4cats")
mq.tls_set()
mq.connect("mqtt.meshtastic.org", 8883)
# Forward all received packets to MQTT
def on_receive(packet, interface):
topic = f"msh/US/LongFast/2/json/{packet.get('decoded', {}).get('portnum', 'unknown')}/{packet.get('from', '?')}"
mq.publish(topic, json.dumps(packet))
iface.on_receive = on_receive
mq.loop_forever()
Monitoring your gateway
A healthy gateway should be publishing to MQTT continuously. Monitor with:
# Subscribe to your node's traffic (replace !abcd1234 with your node ID)
mosquitto_sub -h mqtt.meshtastic.org -p 8883 -t "msh/US/#" -u meshdev -P large4cats --tls-use-os-certs | grep abcd1234
You should see JSON packets appearing whenever your node hears a packet on the mesh. If the stream is silent for more than a few minutes in an active network, your WiFi or MQTT connection may have dropped.
Adding your gateway to the community map
With map_reporting_enabled true and a valid GPS position set on your node, your gateway will automatically appear on meshmap.net within a few minutes of first connecting. Verify at meshmap.net by searching for your node name.
No comments to display
No comments to display