In our family we have many discussions about the temperature of each room.
Often, we complain that one room is colder or hotter than another one. Or one room is warmer or colder than the previous day, so we decided to have a scientific approach in establishing the truth.
We decided to collect the temperature of each room then visualise and finally analysed.
After few days of collecting data, we could see the time series of the temperature for each room.
Then we calculated the delta of temperature for each room.
This way, it was easy to compare the temperature difference over time between the two rooms.
Then we decided to overlap the time series of each room to visualize the temperature dynamics in our home.
From those charts we could extract many insights:
- We could identify which room was the hotter one and the colder one at any time.
- We could see if/when the heating was not homogeneous among the rooms.
- We could see when a window was opened in the winter (quick drop of the temperature).
- We could see if the heating was switched off during the day while we were at work.
- We could see exactly, when our internet provider was disconnected (no data received from all the sensors).
The project is based on ESP8266 microcontrollers, we used one for each room.
Each esp8266 is connected to an HD11 temperature sensor and every 5 minutes it streams the room temperature to the ThingSpeak cloud platform.
Data are collected, analysed and visualised on the ThingSpeak cloud platform.
The ThingSpeak platform is based on a Matlab engine. At the beginning, if you are used to Python, R, or C is a bit strange but once you review a few examples is quite straightforward.
Implementation StepsCloud configuration:
1. Create an account on ThingSpeak.
2. Configure one channel and define two fields for each IoT device, in the current project we had 3 devices and we had to define 6 fields (one for the temperature and one for the humidity).
https://uk.mathworks.com/help/thingspeak/collect-data-in-a-new-channel.html
3. identify the "API key" and "Read API Keys" and take a note of them.
They will be used by the microcontroller to authenticate and protect the communications.
Hardware Implementation
The hardware side is quite straightforward, you have two options, either the microcontroller with just the temperature sensor or with the sensor and the LCD.
The LCD is used for troubleshooting and allow to see directly the room temperature, without having to connect to the cloud to read the temperature.
The option with LCD is shown on the circuit diagram below, the option without the LCD is the same diagram just without the LCD and its connections.
Below an overview of the option with the LCD once wired.
Software Implementation
Regarding the software, we need to program the esp8266 to read the sensor data and to stream it to the ThingSpeak cloud platform. Then we need to customize/code the analysis/visualizations on the ThingSpeak cloud platform.
For the ESP8266, the code can be seen on the link, the code first read the temperature and humidity, it shows the values on the LCD display (if it is attached).
Then based on the room where the device is positioned it streams the temperature on the associated channel.
Finally, the code force the system to wait for 5 minutes and then it starts again.
The code can be found here:
https://github.com/EnzoCalogero/Micro-Climatic-IOT/blob/master/src/main.cpp
For ThingSpeak, the code imports the Time Series to the three channels (one for each room) aligning them to the reference time, then replaces any missed value, and finally it calculates the two deltas and displays them.
The code can be seen on this links:
https://github.com/EnzoCalogero/Micro-Climatic-IOT/blob/master/matlab_code/Delta_Giulio_room.mat
https://github.com/EnzoCalogero/Micro-Climatic-IOT/blob/master/matlab_code/Delta%20living%20room.mat
3D Printing Enclosures
This is the easy part, just 3d print the required enclosures for each hardware elements, assemble them with the devices and connect all the wires.
All the enclosures.stl files are attached on the attachment section.
That is all, once the IoT sensors are in place and connected, you can watch and analyse the temperatures dynamics in your house.
Comments