An IoT Temperature and Humidity Monitor built using the ESP8266 board. The device shows the data on an LCD screen and also transmits the data through WiFi to a server.
On August 1st 2021, I embarked on a journey to design and build an IoT Temperature and Humidity Monitor. It was my last month before I started university in the fall, so I decided to try and learn a new concept by building a project. After brainstorming, I decided to use the ubiquitous ESP8266 board with the DHT22 sensor ( I had a couple of these lying around in my electronics drawer).
With all the hardware ready, it was time to map out what I needed the device to do. In simple terms, I needed the device to send the sensor data to a website for visualisation while also storing that data in a database for future viewing.
Having no previous experience with building IoT devices, trying to implement my idea was daunting at first. The first week, I spent time researching ways to send the data through WiFi to a server. After debating between the WebSockets protocol and the MQTT protocol, I decided to go for the latter, mainly because I believed its publish-subscribe model would make it easier for me to implement choosing between multiple IoT devices in the long run.
I spent most of that August writing code, testing, failing and rewriting code until I finally had a project with most of the main features completely working. The features of the project are as follows:
Once I had tested the breadboard prototype, I designed a plastic enclosure using FreeCad and 3D printed the case. The device is powered by a 9V rechargeable NiCd battery. The final prototype pictures are shown below in the Picture Gallery
The software for my project was a server application made using NodeJS and the technologies mentioned above. However, I needed to find a way to make it easier for an end-user to use without going through the hassle of downloading NodeJS and using command-line tools. After spending some time on every programmer’s best tool ( Google ;) ), I decided to try and convert my NodeJs application into an executable file for the user to click and run. I used the ‘pkg’ node module to convert my code files. I was also frustrated during this time because I couldn’t change the executable logo without corrupting it. However, I got it to work after trial and error and using an older version of the pkg module.
Version 1.0.0 of my software used MongoDB Atlas as the database, implying that my application would need to connect to a cloud database. While this solution was good for the first version, I decided that for increased security and faster speeds (v1.0.0 takes time to start up as it has to connect to the cloud database), I needed a way to store the data locally on the user computer without connecting to the cloud. This led to the making of Version 2.0.0.
Initially, I thought that for Version 2.0.0, I would be able to use the local version of MongoDB. However, it dawned upon me that I wouldn’t be able to package it along with my executable. This would mean the end-user will have to download and set up a local MongoDB database on their own, resulting in a non-user friendly device. After searching online for potential replacements for MongoDB, I came across LinvoDB3, which had similar features to MongoDB but gave me the ability to package it with the executable. So far version 2.0.0 along with the hardware is complete working IoT device that stores data locally, and I look forward to making more improvements to it in the future.



This project helped improve my knowledge in networking, software and hardware. It felt exhilarating to have been able to develop a complete IoT product from idea to a fully working prototype. I look forward to making more IoT devices in the future.
~ Ushan Fernando😀💻