Page 1 of 2

Electricity meter using ZUNO_METER

Posted: 28 Nov 2017 16:18
by commonswift

I am new to this forum and to Z-uno, but I can sure see a lot of interesting uses for the Z-uno. I have done some webprogramming but I am also new to Arduino. As my first "real" project I would like to create a device to put in the cabinet where my electricity meter is residing. I plan to install relays/contactors to control electric heating (2-phase -> difficult to switch with ordinary Z-wave switch devices) and some other utilities, but the main reason for putting a Z-uno in the cabinet is to measure the overall electricity consumption of my house.

On my electricity meter is a LED that flashes 1000 times for a consumed kWh and I want to use the LED as an inobtrusive way to measure energy usage. From what I've seen, the meterLED in my house seems to flash with ca 0.2 - 5 Hz (but sure I havent watched it a lot :-). Ideally one could get the momentary power use too by measuring the pulse intervals, but that would be a next step. I would hook up a LDR or photodiode close to the LED indicator. This has already been one by others using arduinos.

I assume that I could more or less copy the "Water meter" example (which also has EEPROM backup) for the meter part, but just use one meter channel and change meter type from WATER to electric. Hardware will be crammed into a 2-unit wide DIN container to make it look nice & safe. If I get it to work I'll post the design.

When I study the "Water meter" example, there are some things I dont really get. What is the TICK_VALUE constant doing? Is it scaling the count values to m3 values? Does this mean that the water meter get one tick every 100 litres? So if I want to scale my electricity meter to kWh then I would instead divide the ticks by 1000. The very last line in the "loop" states a delay of 100ms, is this necessary? The LED in my electricity meter flashes very briefly, I guess shorter than 100ms so I cant keep this delay I assume. Can I just delete it?

If the resetter is run, does it actually zero also the EEPROM content?

If someone has an answer or two or any comment I'd appreciate it, otherwise I'll just try out and learn. I'm of course happy to share the code I've put together so far.


Re: Electricity meter using ZUNO_METER

Posted: 04 Dec 2017 19:07
by knst08
Just solved quite similar problem - device is on din rail in boiler room controls 8 energy consumers (5 circulation pumps, well pump, filtering system etc). 8 relay controlled loads in total. I used acs712 ( ... er-manual/ ) for measuring power consumption. Why do not you like use couple of these (one for each phase) instead of optical reading?
In this case you will need once per 30 seconds (minimum allowed report interval in z-wave for sensors) run series of current measures i.e. get samples within 500ms (10 periods of 50Hz sin ) , get RMS, multiply by volts in network and get power consumed then report sum of power collected on 2 acs712 as your consumption.

Re: Electricity meter using ZUNO_METER

Posted: 05 Dec 2017 23:47
by commonswift
Many thanks for the suggestions! I have actually looked into using ACS712 for a 2-phase heater, for all the 1-phase devices it is simpler to just use a wall plug with energy meter. But there are some reasons why I would like to try using the blinking LED on the meter, which would tell me total consumption of the entire home; 1) Hardware is simpler (just a resistor + LDR), safer and less intrusive than wiring in 3x ACS712 in the main feed. 2) I assume that the coding would be simpler too; no need to measure and calculate RMS values etc., the "calibration" is already done in the electricity meter and I am trying to reuse some code from the water meter example.

I have made a first attempt and controlling relays/door tamper was of course very straightforward. Although it took a surprisingly long time, an energy meter finally appeared in the UI7 web interface of my Vera Plus. Less surprisingly, the energy consumption meter does not update at all, but I will keep testing.

Re: Electricity meter using ZUNO_METER

Posted: 21 Mar 2018 14:53
by kartono
Hi knst08,

im trying to setup acs712, would be be able to post the sketch for me to look at how you did it?.


Re: Electricity meter using ZUNO_METER

Posted: 25 Sep 2018 13:40
by perjar

I am in the process of building an electricity meter which reads the light pulses on the "official meter".
I am not completely done yet. I have the HW and the program logic ready and tested. It is stable and has been running for a while. BUT, I have not yet connected the z-uno to the z-wave controller. Up until now it runs stand alone just so I can verify that the sketch is stable etc.

I purchased a pulse sensor from Open Energy Monitor and it works really well. ... se-sensor/

I have recently come across some issues though so right now I am a bit stuck. ... rom#p78948

The hang/unhang issue referred to above somehow sorted itself out. I have no idea how but I am grateful that it works now.

I have taken the next step now and included the device in the z-wave network which is controlled by a Fibaro HC2 controller.

The next challange that has presented itself is how to get the data properly accepted into the controller.
I have defined two channels: One that reports the current power consumption (watts) and one for energy consumption (kWh).
These two channels pop up as two devices in the HC2 and are identified as devices reporting in W and kWh respectively. So far so go good.
However, the HC2 shows 0 W and 0 kWh in the user interface. But if I look at the attributes of the power meter device, it reports the correct number of watts in the "power" attribute, but "0" in the "value" attribute which I think is that the user interface is showing.

This is what it looks like in the user interface:
Electricity meter in HC2.PNG
Electricity meter in HC2.PNG (19.27 KiB) Viewed 2170 times
The values in the footers are correct and are coming from the z-uno. But as you can see, the main values displayed are just zero.

Further to this, the energy panel in HC2 does not include my z-uno reports in the data it presents.

Has anyone successfully integrated the ZUNO_METER_TYPE_ELECTRIC channel into a HC2?

Re: Electricity meter using ZUNO_METER

Posted: 30 Dec 2018 19:47
by perjar
Adding to my previous post.

Another issue is that even if I have only defined two channels (one for power and one for energy) the z-uno appears as no less than three devices in the controller: two power meters and one energy meter.
It would not be a big issue if it were not for the fact that the duplication of the power channel/device also duplicates the amount of z-wave messages to the z-uno. I want to keep an almost real time view of the power consumption so the z-uno reports at a high frequency. The trouble now is that every time the z-uno repors a power value, it actually sends two messages instead of one, leading to the z-uno accounting for 54% of all z-wave traffic in my network instead of 27%.

Channel definition in the z-uno sketch:

Code: Select all

How it looks in my Fibaro Home Center 2 controller:
z-uno electricity meter.PNG
z-uno electricity meter.PNG (25.67 KiB) Viewed 1768 times
Any idea how I can get rid of the extra power meter?

Re: Electricity meter using ZUNO_METER

Posted: 04 Jan 2019 02:03
by PoltoS
You can hide that element in Fibaro UI. I guess it will also supress requests to hidden elements.

Re: Electricity meter using ZUNO_METER

Posted: 04 Jan 2019 18:03
by perjar
Thanks for the tip, but hiding it in the UI does not disable it, it just hides it from view. The device still generates traffic even when hidden.
The big question in my view is: why does it appear at all? Is this due to an error in the HC2 or in the zuno?

Re: Electricity meter using ZUNO_METER

Posted: 05 Jan 2019 14:00
by PoltoS
This is because Z-Wave protocol requires that a multichannel device MUST expose it's channel #1 features ouside of channels (we call it channel #0). So all on first channel is duplicated.

Re: Electricity meter using ZUNO_METER

Posted: 11 Jan 2019 18:43
by perjar
I see. It is a bit confusing though, because I have a number of multi-channel devices in my newtork but none of then display this behaviour. Would that be because they are not complying with standards or perhaps that Fibaro has implemented a "hard wired" fix for these devices in order to hide this double exposure of channel #1?