mqopen: One configurable firmware for an MQTT sensor network

MQTT, ESP8266, sensors

This is the read-only HTML version. For the full Visual Space experience, open the app.

ESP8266, sensor network — Imag

ESP8266, sensor network — Imag
ESP8266, sensor network — Imag

Source: mqopen on Hackaday.io · Ivo Slanina

IoT firmware, data logging

A pool-temperature probe shows mqopen’s sensor-to-dashboard path in action. Its 2016 development logs also tackle the less visible work of running an IoT network: reporting initial state, identifying old firmware and keeping one silent sensor from blocking every update.

👍 1

Building another sensor node is easy enough—until each one needs its own firmware branch. Ivo Slanina’s mqopen project on Hackaday.io tackles that maintenance problem with configurable firmware, MQTT messaging and tools for collecting and checking the resulting data. The interesting part is how those pieces handle both ordinary measurements and the awkward moments when devices restart or stop reporting.

The project page was created on August 19, 2015; the supplied development logs run from March through December 2016. They capture working sensor applications alongside unfinished diagnostics and control features, rather than a fully completed automation platform.

Configuration instead of another code branch

In an April 27, 2016 log, Slanina described the problem plainly: adding a device with a new sensor meant creating another source branch and patching it. Network settings, device names, sensor choices and MQTT configuration all had to live somewhere, but duplicating firmware made fixes harder to maintain.

His answer was to bring the Linux kernel’s Kconfig configuration tool into the project. By May 24, he reported that the ESP8266 firmware supported DHT22, DHT11, DS18B20, BH1750FVI and BMP180 sensors, plus experimental interrupt-driven button inputs. Configuration happened through make menuconfig, rather than edits to header files.

The distinction matters: a new combination of supported hardware becomes a configuration task, not a separate firmware project. Adding an entirely new sensor function still requires development, but ordinary node variations needn’t become independent copies of the code.

Measurements and events need different treatment

mqopen’s proposed network uses a local MQTT broker at each location, with those brokers connected to a central one. A Raspberry Pi appears in the component list as the local broker host, while a publicly reachable virtual server is listed for the central broker and OpenVPN. Encrypted broker links are part of the design; the overview’s security ambitions aren’t evidence of a security audit.

The more revealing details are at the endpoints. In the June 10 firmware update, Slanina separated periodic sensors from asynchronous inputs. A temperature sensor can publish on a schedule. A door contact can report only when its state changes, using MQTT’s retain feature so the broker holds the latest state.

That creates a startup question: what happens if the door never moves after the node boots? Slanina reported adding an initial state publication when a node comes online, where that state is relevant. Change-only messaging then saves traffic without requiring the first physical change to establish a reading.

The same update added service topics published at connection time, intended to help identify hardware and firmware versions and find outdated nodes. It also distinguished sensors from “reactors”—devices that act on incoming data—but reactor code was still a prototype under development.

A pool probe puts the data path to work

The June 16 swimming-pool log provides a concrete deployment. Slanina reported building a DS18B20 probe with a water-resistant cable joint, placing it at the pool bottom and connecting it to an ESP8266 node sheltered from rain.

The node periodically sent temperature readings into his MQTT network. His mqspeak software then collected those readings and updated a ThingSpeak channel. That is a useful division of labor: the endpoint handles measurement and messaging, while another program handles the external logging service.

The July 12 mqspeak release notes address a failure that becomes more likely as a network grows. When a channel update combines several sensors, waiting for all of them can stall updates indefinitely if one stops sending. The new optional “update waiting” behavior imposed a configurable timeout, then sent an incomplete update rather than waiting forever.

That release also added an on-change updater for events such as button presses and door transitions, buffering updates when the remote service couldn’t yet accept another one. Logging moved to syslog. Slanina supplied a mqspeak repository link, though these historical release notes don’t establish its present compatibility or maintenance status.

Where measurement becomes control

Other parts remained in progress. A March 23 log described an unreleased mqguard diagnostics prototype that checked MQTT traffic for conditions such as invalid values, timeouts and flooding, with a web interface for live data.

In the latest supplied log, dated December 5, 2016, Slanina returned after a development pause with plans for an insect incubator. Temperature and humidity sensing, a heater relay, a 12 V fan output, alarms and network configuration were proposed features—not demonstrated results.

That proposed step makes the project’s quieter software work especially relevant. A missing pool reading leaves a gap in a chart; missing or stale data in a heater controller has different consequences. The useful lesson from mqopen is to design for restarts, silent sensors and partial updates early. Before taking its monitoring architecture into control, the next question is how an actuator behaves when fresh data or the network disappears.

Source: mqopen

Hardware

3 Followers

A workshop for electronics and physical computing. Share circuits, boards, tools and prototypes; work through measurement and debugging, compare components, and document the choices that turn an idea into working hardware.

Visual Space is built for projects like this—where creators collaborate, organize goals, and grow communities around real work.