Disclaimer

Please, proceed carefully following the tips published in this blog, specially when Main Power is involved. I'm not responsible for any damages caused by what is written in this blog.
Thank you
Showing posts with label consumo di energia. Show all posts
Showing posts with label consumo di energia. Show all posts

Wednesday, 30 May 2018

Home Automation System - Energy consumption monitor...the definitive release




Several days have passed since my last post on the Home Automation System and we left a pending speech about the measurement of home consumption.

My prototipe works fine, so it's time to use it.

My final target is to build 3 power monitor, one for each floor. The first ready to use device is for the main floor.

I will plug the device where the main power cables arrive. So I plan to power on the 5V adapter for the ESP8266 and the PZEM-004T.

Here is the device linked to the main power cable and powered on:



Now, let's give a look to the MQTT messages, using mqtt-spy:


Perfect...all work as expected.


Now it's time for OpenHAB and Grafana.

I setup OpenHAB to get data as numerical variable, using the MQTT topic already defined. Then I edited my sitemap to view these data. Here is the result:


It's an interesting thing the comparison between production and consumption.

The last step is the visualization of historical data with Grafana, comparing production (green) and consumption (yellow):


Now, we just have to wait for other PZEM-004T...already ordered.

Stay tuned.

Wednesday, 18 April 2018

Home Automation System - Energy consumption monitor...mqtt protocol




Here we are again to speak about energy monitor and OpenHAB. I made some step forward with my experiments.

In the previous post I made some tests with the PZEM-004T Energy Module and an Arduino UNO.


The test was OK...and now I would try to replace Arduino UNO with a cheaper Esp8266 NodeMCU.

There are some differences, because Esp8266 NodeMCU works with 3.3V but Arduino works with 5V, as the PZEM-004T Energy Module.

In the previous test I took 5V from Arduino board and so there was no need to use an external supplier. Now with the Esp8266 NodeMCU it's different because it needs 3.3V.

But...my Esp8266 NodeMCU is a particular model, called LoLin and can be powered with 5V through microUSB cable and it has an output pin with the same voltage as main power.

So, I will use an old power supplier which provides 5V and 400mA.


Let's plug all together.



Last step: the software

Let's use the same software used for Arduino, just to check the everything works well.

Here is the serial output.

18W lamp:


100W lamp:


It's all OK...nice!

Let's edit the software to introduce MQTT protocol. This is the idea: if energy values are similar, I will send the data every 1 minute; otherwise, when a value differs from the previous one, send the data immediately.

This is my MQTT topic (just for testing purpose)

nodemcu/test/esp8266mcu12/powerconsumption/state

using MQTT-SPY I check the transmission:


All work as expected...

My next job will be to integrate this device with OpenHAB and see the data on its sitemap and on Grafana dashboard