← Projects
raspberry-pi intermediate 7 days ago ◯ 5 min read

Building a Raspberry Pi Meshtastic MQTT Gateway and Map Server

Build time: 2-3 hours
Tools needed: Computer for flashing firmware, USB cable, basic Linux command line familiarity
Parts List
raspberry pimeshtasticmqttloramesh networkmosquittohome laboff-grid messaging

An ESP32-based Meshtastic node (covered elsewhere on this site as a standalone LoRa sensor/messaging build) gives you one radio on the mesh. What it doesn't give you on its own is a way to see the whole mesh from a browser, log message and position history over time, or bridge your local mesh traffic out to the wider Meshtastic MQTT network so distant nodes and gateways can see each other. That's a job better suited to a small always-on server than to a battery-powered field node, and a Raspberry Pi sitting on shop or home WiFi is exactly the right amount of hardware for it.

What This Build Actually Does

The Pi runs an MQTT broker (Mosquitto) and the Meshtastic Python tooling, connected to a dedicated Meshtastic-flashed radio over USB serial. That radio acts purely as the gateway's connection into your LoRa mesh โ€” it isn't meant to be carried around. Meshtastic's built-in MQTT module, once configured on your mesh nodes, publishes mesh traffic (positions, text messages, telemetry) to your broker, and the Pi also hosts a simple web map interface so you can see node positions and recent activity from any browser on your network, instead of only through the phone app connected directly to one radio.

Parts List

Build and Setup Steps

  1. Flash the gateway radio with current Meshtastic firmware using the web flasher or CLI, exactly as you would for a normal node, but don't configure it with a human-carried role โ€” give it a clear, recognizable short name like "GATE" so it's identifiable on the mesh as infrastructure rather than a person.
  2. Set up the Raspberry Pi with Raspberry Pi OS Lite (headless is fine โ€” this is a background service, not a desktop), connected via wired Ethernet with a static IP or DHCP reservation so the rest of your setup can rely on a stable address.
  3. Install Mosquitto as the local MQTT broker, with authentication enabled (don't run an open, unauthenticated broker even on a local network) and TLS if you plan to allow any remote access to it later.
  4. Connect the gateway radio to the Pi over USB and install the Meshtastic Python CLI (`pip install meshtastic`) to confirm the Pi can see and communicate with the node over serial before moving on.
  5. Enable the MQTT module on your mesh nodes (the gateway node and, optionally, any others you want bridged) via the Meshtastic app or CLI, pointing them at the Pi's Mosquitto broker address, username, and password. This is what causes mesh traffic to start flowing into the broker as structured MQTT topics.
  6. Stand up a map/dashboard view. The simplest path is Meshtastic's own web client pointed at the gateway node's serial/network connection; a more capable path is a small Node-RED flow or a Grafana dashboard reading from the MQTT broker, plotting node positions on a map panel and logging telemetry and message counts over time. Either approach turns "what's happening on the mesh right now" from a phone-app-only question into something anyone on your network can check from a browser.
  7. Optionally bridge to the public Meshtastic MQTT network if you want your mesh visible to and from the wider community network rather than staying fully local โ€” this is a deliberate choice with real range/discoverability trade-offs and is not required for a private shop or family mesh to work.
  8. Set Mosquitto and your map/dashboard service to start on boot (systemd units or Docker restart policies) so the gateway comes back online automatically after a power loss without manual intervention.

Why a Separate Pi Instead of Doing This on the Node Itself

A battery or solar-powered field node is optimized for low power draw and physical portability โ€” it is a poor place to also run a database, a web server, and a broker that you want available 24/7. Splitting the roles keeps your portable nodes simple and power-efficient while giving the always-plugged-in Pi the job it's actually suited for: staying on, logging history, and serving a web interface.

Difficulty, Time, and Tools

This is an intermediate build โ€” nothing here requires soldering, but it does require comfort with Linux service configuration, MQTT basics, and flashing firmware onto a microcontroller. Budget an evening for the initial setup and another session if you build out a Node-RED or Grafana dashboard rather than using the stock web client.

Safety

LoRa radios at this power level are low-risk from an RF exposure standpoint, but confirm your region's permitted frequency band and transmit power before deploying โ€” Meshtastic firmware regions settings exist specifically to keep you compliant with local radio regulations, and running the wrong region profile can put you outside legal transmit parameters even though the hardware itself will happily do it. Keep the broker's authentication enabled; an open MQTT broker on your network is a soft target that exposes your mesh's message and position history to anything else on that network segment.

Once running, this turns a single ESP32 Meshtastic node from an isolated radio into the entry point for a logged, browsable, always-available view of your whole mesh โ€” the difference between glancing at a phone app and having an actual shop or home dashboard that shows where every node on the network is and what it's been reporting.