Guide · Intermediate · Raspberry Pi
Tool Review: Mosquitto as a Workshop MQTT Broker (Measured Lab Notes)
Review standard: see /review-standard. This page states a measurement protocol you should re-run on your Pi — do not invent latency numbers without a stopwatch/log. Versions & hardware under test ItemValue …
Review standard applies. This piece is held to versions, comparison/context, failure modes, and a verdict. Read the standard →
Project template
- Goal & materials
- Steps / firmware
- Troubleshooting
- AI assist notes
- Related gear & books
Review standard: see /review-standard. This page states a measurement protocol you should re-run on your Pi — do not invent latency numbers without a stopwatch/log.
Versions & hardware under test
| Item | Value |
|---|---|
| Broker | Eclipse Mosquitto (Debian/Ubuntu package class — pin mosquitto -h output in NOTES.md) |
| Host | Raspberry Pi 4/5 class, Ethernet preferred |
| Clients | mosquitto_pub / mosquitto_sub + one ESP32 node |
| Network | LAN only; WAN closed |
What we compared against
- Primary: Mosquitto on Pi for workshop labs
- Alternatives not required for v1: EMQX, HiveMQ, cloud MQTT — overkill until auth and LAN discipline are boring
Measurement protocol (fill on your bench)
| Test | Method | Pass | Your result |
|---|---|---|---|
| Local loop | pub/sub on localhost | Message appears immediately | |
| LAN RTT feel | ESP32 publish every 1s; sub timestamps | Stable 1 Hz stream, no multi-second gaps | |
| Broker reboot | restart mosquitto service | Clients reconnect ≤2 min with backoff | |
| Host reboot | reboot Pi | Broker + one node recover without laptop babysitting | |
| WAN closed | scan from outside / cloud VPS | 1883/8883 not open |
Security minimums (non-negotiable)
- Password auth before any non-lab exposure
- No anonymous WAN listener “for testing”
- Unique credentials when you pass three devices
What broke / confused
- ESP32 connects to Wi-Fi but not broker → wrong IP, wrong port, or AP isolation
- “It worked until reboot” → no systemd enable / no client reconnect
- Retained retained storms on command topics → simplify payloads; use TTL when ready
Export
Topic plan + payload examples: pi-esp32-mqtt-lab.zip
Review verdict
Mosquitto is the right default for a Pi workshop coordinator. It is not exciting — that is the point. Win reliability and closed ports before chasing clustering or cloud bridges.