Projects / Ideas / MQTT heartbeat and last will

MQTT heartbeat and last will

IntermediateIndustrialIdeaReviewed
In short

How do you build an MQTT heartbeat and last will?

An ESP32 publishes a heartbeat to a small MQTT broker on your own computer, and sets a last-will message so the broker tells everyone when the board drops off. Switch the board off and watch the status change to offline. It shows how real IoT systems notice a dead device. You need ESP32 DevKit V1, LED 5 mm red, Resistor 220 Ω, Breadboard 830 Tie Points and Jumper wires male to male (40 pcs, 20 cm).

Level
Intermediate
Time
About 80 min
Parts
5
An idea, not a guided build yet. Goal, parts and steps; no wiring, code or tests. Copy it to My Garage to plan it.
Goal

Make an IoT board announce when it goes offline.

Parts list

How to build it

  1. Run a Mosquitto broker on a computer
  2. Connect the board with placeholder Wi-Fi details
  3. Publish a heartbeat every ten seconds
  4. Set a last-will message
  5. Pull the power and watch the status flip

Related projects

Common questions

What parts do I need for the MQTT heartbeat and last will?

ESP32 DevKit V1, LED 5 mm red, Resistor 220 Ω, Breadboard 830 Tie Points and Jumper wires male to male (40 pcs, 20 cm).

How long does the MQTT heartbeat and last will take to build?

About 80 minutes for a intermediate maker.