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 esp8266. Show all posts
Showing posts with label esp8266. Show all posts

Monday, 24 December 2018

Home Automation System - Let's continue with packages


I'm back...after a lot of time spent at work.

Step by step, I'll reach my goals...no need for hurry...it's a hobby!

Today's target is the packaging of photovoltaic production and basement consumption monitoring system

Here you can find my previous post about it...

http://domoticsduino.blogspot.com/2018/10/home-automation-system-two-pzem-004t.html

As you can see in the following image, it's a mess...and high voltage wires (220v) and PZEM-004T are not safe!


Now finally I'm pretty sure that this monitorin system works well...so it's time to package it, in the best manner I can afford (I'm not so good in manual jobs)😉

In brief, I have to arrange two PZEM-004T device and a ESP 8266 Mcu, keeping free space for wires and power.

I will use two boxes:



The big one for two PZEM-004T and the small one for the ESP 8266.

To let the wires get out from the box I made some holes in the plastic (I repeat: I'm not so good in manual jobs)



Here is the two PZEM-004T on the bottom of the plastic box. They fit perfectly.


Ok, boxes closed and wires connected again. Here is the final result (a little cleaner than before...)


Next step will be to hang boxes on the wall; now they are just leaning on the wall.

-----------------------------------------------------
Similar items used in this project
-----------------------------------------------------


3Pcs Geekcreit® NodeMcu Lua WIFI Internet Things Development Board Based ESP8266 CP2102 Wireless Module

12,66€
Geekcreit® NodeMcu Lua WIFI Internet Things Development Board Based ESP8266 CP2102 Wireless Module

4,11€
3Pcs Geekcreit® NodeMcu Lua ESP8266 ESP-12E WIFI Development Board

13,58€
AC Digital Multifunction Meter Ammeter TTL Current Tester Module PZEM-004T With Coil 100A 80-260V

5,25€
10pcs 100 x 80 x 32mm DIY Electronic Plastic Housing Junction Box Power Supply Box Instrument Case Jig Box XL-39

11,60€
2pcs 75 x 54 x 27mm DIY Plastic Project Housing Electronic Junction Case Power Supply Box

1,73€
5Pcs KY-015 DHT11 Temperature Humidity Sensor Module For Arduino

7,67€
10Pcs DHT11 Digital Temperature Humidity Sensor Module For Arduino

9,31€

Sunday, 11 November 2018

Home Automation System - Let's make it cleaner



It's time to put in order my things and idea about my Home Automation System project



In particular:

openHAB: there's a little confusion on logical name of item and things

MQTT: topic names are a little complicated to be memorized

Software: I have a lot of custom firmware version wrote for my custom devices (see ESP8266...)

Hardware: my custom devices are always "unfinished", with "live" wires...I'd like to packaging them

Let's start from the last point

The first device which needs a good packaging, also for security purpose, is the power meter, placed on the main floor (see https://domoticsduino.blogspot.com/2018/05/home-automation-system-energy.html)

Some weeks ago, I bought some plastic boxes. Here is the mail bag



and these are the boxes...two different sizes



I hope both PZEM-004T and ESP8266 will fit together



Perfect fit. Now I will try to run the wires through the hole


Ok, now I put it in its right place...hoping it will work as before



Luckily, it works as expected. Next packages will be the device involved in monitoring the photovoltaic production and basement consumption (see https://domoticsduino.blogspot.com/2018/10/home-automation-system-two-pzem-004t.html) and the device with gas, temperature and humidity sensors (see https://domoticsduino.blogspot.com/2017/11/home-automation-system-my-first-sensors.html)


-----------------------------------------------------
Similar items used in this project
-----------------------------------------------------

Friday, 5 October 2018

Home Automation System - Two PZEM-004T and a single ESP8266




After my successful experiments with the PZEM-004T and a Nodemcu ESP8266 aim to monitor power consumption (devices are actually working well in my ground floor power monitoring system, see https://domoticsduino.blogspot.com/2018/05/home-automation-system-energy.html), I decided to update my photovoltaic production monitoring system, actually based on a Wifi 433Mhz receiver (see https://domoticsduino.blogspot.com/2017/08/home-automation-system-mqtt-and-rf433.html).

Actual system has a problem due to an invalid read of power values when the inverter is switched off. In fact it gives me about 250W power production...

My idea is to use the same devices used for the ground floor power monitoring system...so a PZEM-004T and a Nodemcu ESP8266.

These are the devices:

NODEMCU ESP8266

PZEM-004T

Because my inverter is near the electrical panel in the garage, I decided to let the things more complicated adding another PZEM-004T to also monitor the basement consumption with the same ESP8266.

Then I added also a temperature and humidity sensor to the same circuit.

My following step was to check that a single NODEMCU ESP8266 was able to control both PZEM-004T...My tests were successful

Here is it my first PZEM-004T linked to the main output cable of the inverter...on the right you can see the DHT11, temperature and humidity sensor (it's a not so accurate sensor, but it's right for my kind of measurement...)


This is the second PZEM-004T, linked to the main cable of basement power, inside the electrical panel


Complete view:


Now it's time to write the software and test it.

I decided names for the MQTT topics and I created items and sitemap objects for OpenHAB

This is what we could see in my OpenHAB BASIC UI



Energy Consumption value is the sum of all the sensor power (2 of them are already running)
Values are different related to the previous screenshot because they continuously change


Last step: I created some charts in the Grafana dashboard


My primary target was reached: my production monitor give about 0W when the inverter is switched off

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