Thursday, May 17, 2018

More on House Power Monitoring: Prebuilt Device

There's been a lot of new devices appearing on the market for monitoring power. I decided to get one and see what was actually going on. I prowled around Alibaba for a while and settled on this one, the PZEM-004:


The reason I picked this one is that it has a TTL serial output that I can play with as well as a display, and for a long time now I've wanted a display to put on the water heater to show me when it is actually using power. This might just fit the bill as well as giving me an output that I can use to record the actual power usage. Since the water heater is 240VAC, this should do the job. If it works.

Naturally, when it came in, I took it apart to see what was inside:



The power and CT inputs are on the right and a ttl serial port is on the left. The two big chips that do the work are: Atmel 24C02N a 2 wire serial eeprom <link> and SDIC RWTS SD3004 energy monitoring chip <link>. 

These 'energy monitoring chips' are a relatively recent thing. Manufacturers took the interest in smart meters and energy monitoring seriously and produced a whole lot of special purpose chips to sell. They're pretty nice, and for an industrial application, do a good job. Every smart meter out there has something similar inside it. The problem I see with them is that for a person like me, they're too darn complicated. They take a bunch of support circuitry and need special commands to do what you want. For the time being, my own devices will use the older methods I already understand, unless this device changes my mind.

The rest of the circuitry is power supply, serial interface, support for the displays and such. I can't recommend that people get one of these because there is no clear separation between the parts that can kill you and the rest of the board. They appear to be relatively safe, but missing are the board cuts and clear indications of where the high voltages run. For a beginner that wants to start monitoring devices, this could get them in trouble.

But, trouble seems to be my middle name.

My water heater is solar. I have a panel on the roof of the garage that heats water, and when the temperature in the heater is less than the temperature of the solar heater, it pumps water from the panel to a heat exchanger inside the water heater. The heat exchanger is necessary because the fluid used in the panel is partly ethelyene glycol to avoid the possibility of freezing up there on the roof. The heater tank is 80 gallons to hold enough hot water for a long time. There is a little 45W motor that moves the water around to do the heat exchange.

Additionally, there is a helper element inside the hot water tank. The helper element is activated whenever the water needs heating, including when the sun is out and the solar is working. They recommend that people put a timer on the helper element, instead I hooked it into the house controls <link>. So this device gives me the ability to use the serial output from the power monitor to record the energy used by the heating element of the water heater.

But, why is that important to me since I have a solar water heater. Firstly, because I can. Secondly, it would be good information to know what a water heater actually uses in energy for my purposes. Heating a bunch of water is an efficient task since the element is actually submerged in there, but it still uses a heck of a lot of power. I want to understand this.

The very first thing I encountered was hooking the darn thing up in some kind of test bed. I really didn't want a bunch of jumpers carrying 220 hanging off my water heater, so I cut up an old extension cord and built a test bed for a 110VAC light that had two bulbs. That way I could change the bulbs and see different values as a kind of calibration test. I made darn sure the wires weren't exposed so I wouldn't rest my arm on them. The meter worked fine and actually gave a reasonable reading first try.

Next I went looking for how to hook up the serial port to my laptop. The USB to ttl serial cable that came with it had a fake chip in it and wouldn't work. I chased down the correct drivers for the chip and got the serial working, but couldn't find the proper baud rate anywhere in the (slim) documentation that came with it. That got me to searching the web for information.

Really fortuitous problem. There are a lot of sites out there that have messed with this device and put up examples. I even ran across a library to support it in github <link> so I wouldn't have to do everything from scratch. By the way, the baud rate is 9600!

So, I added a little arduino to my test setup and started to peck away.


Yes, I know it's not the safest setup in the world, but as long as I remember to pull the plug before grabbing that metal screwdriver, I should be OK.

As you can see, the monitor worked first try and all the displays worked. The picture missing some things is an artifact of the pulsed display. I didn't have as much luck with the software I found though. It took me a bit to figure out what 'yield();' was that was keeping me from compiling, but it turns out that that is simply a delay(0) for the esp8266. I added a stub for that.

Everything worked from then on Here's the serial results as it came out of the box:


The power, voltage and stuff was right on the money when I compared it to other devices I have around the house. The current transformer they supply is one of those that you have to remove the wires to use. You can see it in the picture above. In some places you can't get the wire loose for various reasons, so I tried a SCT-013 that can be found all over the place and I happened to have. The results were not as pleasant:



If I need to use one of those, I'll have to hunt down and change the burden resistor since I can't get to the calibration. The displays shows one bulb at first and two about half way down; roughly half what it should be. There are no markings on the supplied CT, but I bet it has half the windings of the SCT-013.

(Edit: I looked up the various datasheets, the SCT-013 has a ratio of 1:1800 and the split core version of the included CT is 1:1000. Not quite half, but close. There is a split core CT that will work with this, the PZCT-02, that costs about five bucks and has a 30 day delivery. I'd still like to be able to use the SCT one though)

So, now I'm at a decision point. Do I add this to the water heater setup or not? If I do, do I use a separate system from the garage device. The garage is currently handled by an Arduino that controls the water heater and the garage doors. This device could be for the water heater like I have one for the freezer and such.

Decisions, decisions.

Continuing with this device <link>

No comments:

Post a Comment