MQTT & Wi-Fi: the bench becomes a network
420-302-VA · WEEK 9 · FALL 2026

Stage 6 of 6 · Lab session · Monday, November 2

Lab & hand-in

Today's lab has a strict dependency order, broker before node before monitor, so the timeline matters more than usual: a station stuck at a wall should call for help early, not nurse it. By the exit, your bench is a networked system and A2's telemetry rows are demonstrated or scheduled.

The two-hour plan

MinutesBlockDone means
0–10Station up: both boards out, Pi booted, two SSH terminals open, repo pulledhostname -I noted; Week 8 node sanity-checked over USB
10–30The broker: install, service, both walls, UFW, loopback testmosquitto_sub prints what mosquitto_pub sends; wildcard seen working
30–50The node: config.py pattern, Wi-Fi up, umqtt in, publish loopThe terminal prints your station's light once a second; hand test passes
50–70The Pi listens: paho in the venv, minimal subscriber, then LightMonitorPython prints decoded percentages; callbacks are bound methods
70–105The ladder: status + will, dark alert, then the command channel and beyondRungs 1–2 demonstrated; rung 3 reached by most stations
105–115A2: demonstrate the brief's networking/telemetry rows; write docs/topics.mdVerification table rows checked off with the teacher, or scheduled
115–120Evidence committed and pushed; bench packedBoth boards and the kit travel home: A2 finishes this week

Evidence to hand in

Committed and pushed to your course repository by the end of the day:

  • Node code: net.py, lightnode.py, and the publishing main.py, with config_example.py committed and config.py git-ignored, the marker checks the .gitignore line as seriously as the code.
  • Pi code: lightmonitor.py plus whatever ladder rungs you reached, each runnable.
  • docs/topics.md: a short table of every topic your station uses, payload format, QoS, and retained yes/no, the namespace documented, Week 5's "write it down before it is folklore" applied to naming. If the A2 brief defines topics, record its scheme here and follow it.
  • Proof of flow: a screenshot or pasted transcript of mosquitto_sub showing live readings (the hand-shadow dip makes it unmistakable), in docs/.
  • Journal entry in station.txt: what wall you hit, how you read the failure (timeout vs refused counts), and the fix, this week's entries are precisely the midterm-log genre the final exam rewards.

Exit ticket

Say or write, without notes:

  1. The broker's job in one sentence, and why the node never addresses the Pi.
  2. Your station's three topics, and what bench/+/light matches that bench/s07/light does not.
  3. Why sudo ufw allow 1883 was necessary, in Week 3's own words.
  4. QoS 0 versus QoS 1, and which this week's telemetry uses, with the reason.
  5. Why config.py is git-ignored while config_example.py is committed.

Before next Monday

  • A2 finishes. The assignment is due Monday, November 9. Whatever remains of the brief's verification table after today, telemetry rows included, gets done at home against the three-week plan; the questions log travels with it.
  • Re-run the system at home if you can. A 2.4 GHz network, the Pi's new hostname -I address into config.py, and the whole bench reproduces; no home network, then the loopback half (broker + Pi subscriber + mosquitto_pub as a fake node) still exercises everything but the radio.
  • Journal while it is fresh: the wall you hit, the failure signature that named it, the fix.

Mind the calendar

The AE course-drop deadline is Tuesday, November 3, tomorrow after this class. And two weeks out, Week 11 (November 16) opens the LIA project phase with deliverable D1; arriving there with A2 closed and a working bench is the whole point of this fortnight.

Next week: closing the loop

Week 10 · Monday, November 9

Control: closing the loop

The PID lesson lands in full: error, the three terms, and tuning, then the bench closes its first real control loop, the controller's eyes being this week's telemetry and its hands Week 8's PWM. A2 is due at the start of class.

Why this week mattered

The infrastructure is permanent

Broker, topics, node, monitor: nothing built today is scaffolding. Week 10 subscribes to it, Week 11's Flask dashboard reads it, and the LIA project ships on it. You did not do an exercise this afternoon; you commissioned a system.