I had been tinkering with using an ESP8266 and a temperature/humidity sensor to record environmental data within my home. I hadn't really moved forward with it until near the end of December 2017. And what really prompted me to move forward with the project was the brutally cold temperatures we experienced in Chicago. I was concerned about water pipes freezing, or my furnace breaking down. So the completion of this project (sensors, server, database, and web client) became very important. Fortunately no pipes froze, and my furnace continued working! I was luckier than some of my neighbors!

Components & Technologies :
  • Sensor Devices :
    • ESP-01S
    • DHT22
    • WiFi/UDP
    The sensor devices communicate a JSON packet via UDP over WiFi to the server. Status messages are broadcast and data messages are targeted at the server. The status message broadcast will allow future devices on the network to monitor and manage the status of the sensor devices.

  • Server : The Node.js application listens for UDP packets from the sensors. Before writing the contents to the database a time stamp is added to the packet. The time stamp is stored as an epoch value and used as an index. After a new row (status or data) has been written to the database the contents are broadcast to all connected web clients via Socket.io.

  • Web Clients :
    • HTML/CSS
    • JavaScript/JQuery
    • Socket.io
    • C3.js - A D3.js based chart library
    This page is a web client. I developed two different clients where one uses Google Gauges and this one which uses C3.js. However both clients are configurable and utilize Socket.io for communication with the server. However this client displays more information such as status messages, and the time & date as passed along in the messages.

Features :
  • Open Source - For this project I learned about git sub-modules and how to keep them updated within a parent repository. You can view this repository here.
  • Data Management - The total number of rows in the status and data tables is managed. This was one my requirements to keep the tables from growing to an unmanageable size. This feature is implemented as a configurable timer that removes rows based on time.
  • Configuration - The sensor devices, server, and clients are configurable in a number of aspects. For example, the sensor devices can have their reporting interval configured and the server is configurable in regards to its network connection and database type.
  • Server Run-Time Event Logging - The server uses a log file module to record internal events to a text file where each event is time stamped. Configuration settings can be used to manage the log file name & extenstion, maximum file size, and other aspects.
  • Sensor Device Error Detection & Automatic Recovery - The sensor devices can detect start up and run time errors and report them via UDP multi-cast. And if possible the devices can attempt to recover from some errors. All status messages are broadcasted and saved in the database by the server, and forwarded to the clients.
  • Immediate Client Updates - Web clients receive updates via Socket.io. The status and data updates are broadcast to all clients, and are received nearly immediately. Since the updates are transmitted when the database is updated there was an issue where clients would have to wait for the next update of sensor before it could be displayed. The work-around was to modify the server to remember the last update for the sensors and then transmit their status & data when a client connects.
  • Low Build Cost - I was able to keep the cost of the sensor devices under $20. You might be able to get the cost even lower if the parts are sourced overseas.
  • Low Build Cost - The items listed below can be sourced from other vendors, however I chose one that was the most convenient for me.

    (prices are approximate, and reflect the cost of a single item.)
    Sensor Hardware Prices :
    ESP-01 Breakout$1.40
    170 point breadboard$1.20
    DHT22 Sensor$5.00
    Micro-USB Connector$0.70
    5v to 3.3v Regulator$1.80
    Push Button (for breadboards)$0.70
    5v Supply with usb$3.00
    Micro USB Cable$1.33
    Misc 22ga Solid Wire$0.25
    TOTAL (approximate) - $19.13


Device :
Update :
Status :

Master Bedroom

Device :
Update :
Status :

Living Room

Device :
Update :
Status :


Device :
Update :
Status :

Data & Icons provided by: 

,  °F with  %RH
The dew point is  °F and the heat index is  °F
Winds are  MPH from the and gusting to  MPH.

  • Temperature °F :
  • = 25 to 60
  • = 60 to 90
  • = 90 to 120
  • % Relative Humidity :
  • = 0 to 40
  • = 40 to 70
  • = 70 to 100
Last Purge Event :