T&L Node Firmware


Firmware for the T&L Node. Temperature and light level are reported periodically.

Started: Feb 15, 2015
Updated: Nov 8, 2015
Repository: GitHub

Categories: Firmware



The T&L Node Firmware (firmware) runs on the ESP-8266 processor. The firmware periodically measures temperature, light, and battery voltage which are then reported to a MQTT broker.

The firmware has been developed in an interative process on multiple ESP-8266 platforms rather than by a detailed up-front design. This approach allowed for learning and experimenation with libraries, sensors and the ESP-8266 opertational modes.


In keeping with the experimental process, the requirements have been flexible and not very specific:

  • Measure and report:
    • Temperature to the resolution and range of the sensor
    • Light levels to the resolution and range of the sensor
    • Battery voltage
    • Processing time
  • Extend battery life by using the ESP-8266 sleep mode.
  • Shutdown to prevent over-discharge of batteries.
  • Watchdog timer to prevent battery drain when network connection fails.

Design Trade-offs

  • Measurements are combined into one message to minimize communications time.
  • Sleep time is a trade-off between time-domain resolution and battery life.
  • The network configuration is hard-coded in order to avoid initial setup. Configuration is a tough problem. It requires network discovery, a source of network specific information, non-volatile storage routines, and some sort of user interaction or at least confirmation. Then there are security issues…

    Since this is an experimental setup and since I will be loading firmware individually on each node, a hard coded approach is much easier. The biggest concern with this method that specific, private network information must kept out of committed source code.

  • Initial implementations (through at least December 2015) did not include code to shutdown under low battery conditions. Such a shutdown was not implemented so that the battery curves could be measured and the empirical operating voltages of the sensors determined.


This firmware is written in C using the esp-open-sdk toolchain. The MQTT functionality is provided by the esp_mqtt library.

The source code is available on GitHub. See the README file in the source code for build instructions.


Related Posts

CC BY-SA 4.0

Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-ShareAlike 4.0 International license.

Social Links


3720 Benton St.
Santa Clara, CA 95051
United States.