The winter is starting to get tougher here in Portugal, bringing up challenges regarding climatization of our homes. If you don’t live in here, you probably thought that it is a warm country due to our sunny summers. Traditionally older houses are inferior in terms of climatization, lacking things seen in other western and central Europe countries.
Designing a solution
With that said, I’ve put my DIY hat, and the first thing I’ve done was to seal air leaks by install weather stripping where it was necessary, improving the amount of heat lost from heating appliances.
I’m using a simple space heater to do climatization of my living room, which includes an analogue thermostat. Toggling it too high or too low results in an inefficient outcome, so I’ve decided to turn this appliance into a Smart Heater.
By using an ESP8266, running Arduino, plugged with a DHT11 sensor, I’m able to measure in real-time the temperature and humidity of my living room. This device collects the data and sends it to an MQTT server running in a Raspberry Pi. I’ve developed a small microservice that analyzes this data, toggling a smart plug when necessary, according to a preset target temperature. This setup allows me to save money since the heater is only turned on when needed, without any manual interaction.
You can find the source code for the following components here:
Monitoring the solution
To monitor the Node.js Microservice, we can use the New Relic monitoring platform to collect temperature information in the form of custom events. With the data present in New Relic, we can create powerful dashboards that allow us to visualize on the real-time. New Relic includes a free tier, with no credit card required. Currently the microservice aggregates 60 samples before doing any action.
All the data is queryable through NRQL, here is an example of a query for the temperature readings widget (Picture 3):
SELECT latest(minimum) as 'ºC Min', latest(maximum) as 'ºC Max', latest(average) as 'ºC Avg', latest(target) as 'ºC Target' From HeaterEvent WHERE appName = 'Smart Heater' TIMESERIES
We could scale this solution to include multiple temperature sensors and smart plugs. The MQTT messages would have to carry a device identifier so that the Node.js Microservice could do a correlation between temperature source and a given smart plug.
Another improvement to consider is swapping the DHT11 sensor to a DHT22, which provides a lower margin of error, in terms of readings.
This solution is just a prototype, not recommended for general use. You’re better off purchasing a smart climatization solution from a well-established vendor. Use the information provided here as-is, no warranties and/or liability provided.