PZEM-016 single phase modbus energy meter

I set my camera to 12 MP in the hopes of being able to enlarge the picture to read the characters on the chip, but no joy. The markings are very faint. I had it in full sunlight, but still no help. Bummer.

Ah well, I guess at $12 per unit, there’s not a lot of incentive to reverse engineer it ;-).

PB and I thought the same thing, i.e even if it’s junk, at that price it’s a throw-away item.
So far, it seems to be fairly accurate. I have a 40 W incandescent lamp as a load with 10 turns wrapped
through the CT window and it’s reading 429.1 W, 3.57 A, 120.2 V.

But hey, whatta ya want fer 12 bucks, right? :wink:

So internally consistent at least. Do you have a trusted meter you can compare those numbers with?

I guess I could buy one and stick it on the calibrator to give it a good run for its money, but I doubt my calibrator’s V output would have enough ousht to drive its power supply. I needed a separate V input on my monitor for that reason. One V input to power the unit, and 3V inputs to measure. Once installed, you can daisy chain the first off any of the other three but when calibrating, just having the power supply attached to the calibrator’s V output distorts the signal (as do many 9VAC wall-warts).

The Fluke 27 DMM I have (calibration unknown) consistently reads 0.4 to 0.5 V higher than the
Modbus meter.

But… I do have access to TMDE that gets calibrated anually.
I’ll take it to work with me tonight and check it against a a Fluke 289 true RMS DMM.

Whatever it is, it looks like you flash it via JTAG, note the TDI TMS TCK pins in the bottom left corner. And you’d need an isolated programmer since all that sits on the scarey side of the barrier.

I noticed they used an STM32 with an ST-LINK header in one of their products:
https://www.webx.dk/oz2cpu/energy-meter/energy-meter.htm

That too would need an isolated STLINK programmer. Actually, that entire hack project is very dangerous (they do mention it in the fine print). They’re wiring up external hardware to the live side of the barrier so all of the display hardware is live.

Now, speaking of STM32s… what’s been happening out there in OEM / STM32 land?

Got one of those too.

Version 13 of your script is the newest thing I’ve seen…

Looks like my 27 isn’t too far off. (can’t complan too much, it was a freebie)
Compared to a calibrated Fluke 289, the unit reads a consistent 0.3 Volts low.

Mine arrived yesterday,

It’s a “Vango” V9881D (link to datasheet http://www.vangotech.com/tw/uploadpic/152783461494.pdf)

the rs485 transceiver is a Maxim MAX485 (link to datasheet https://datasheets.maximintegrated.com/en/ds/MAX1487-MAX491.pdf). The spec of a MAX485 is a “whole unit” so there would only be a maximum of 31 of these (plus a master) in a single rs485 chain (without repeaters).

the isolation is done by a pair of CT Micro CT817C’s (link to datasheet │CT Micro International Corporation│)

there is also a “S9111 ADAC2” that I didn’t find any info on, but it’s position and tracks lead me to suspect it might have something do with creating the 5v DC supply.

I haven’t hooked up to a load yet, but I did try communicating with just the rs485 and 240v connected and it seems to communicate fine with the “one to one” windows utility in the zip posted earlier in this thread.

The terminal blocks are a tad el cheapo (as expected) but aside from that it seems “ok” build wise. However IMO the connection map on the underside can be a bit misleading as it is correct whilst looking at the underside, but it needs inverting when looking at the module from the top which is where the terminal screws are (despite the map possibly suggesting otherwise), that’s not an issue when the unit is loose in your hand, but if mounted and you’re using an online map or looking at another unit, you could get it wrong.

I am going to try writing a python script a little later (if I don’t get otherwise engrossed with something else), I’ll post here what I learn.

Hi Paul,

Good pics. Your camera is better than mine. thumbsup

Looks like it’s got the goods. I notice they too calibrate phase error at a 60° phase shift, so you may not want to put it into calibration mode unless you’ve got some equipment that can do that.

It’s just a regular 12mp camera on a Galaxy S7, but I use a magnifier app for such occasions (https://play.google.com/store/apps/details?id=com.softdx.quickmagnifier). The hardest part to using it is keeping your hand steady, it’s like I’ve got a serious case of “the morning after the night before” shakes.

Luckily it isn’t so easy to do (without the supplied utility) once they are in service, if there are more than one of them connected you cannot put it in calibration mode as it uses a generic slave address (regardless of the one programmed) that all of the devices will try to respond to. It can only be calibrated in a “one on one” connection.

Whilst looking at some other devices such as this one

https://www.ebay.co.uk/itm/5-45-A-45A-MAX-220V-50HZ-60HZ-voltage-current-energy-meter-RS485-MODBUS-RUT-/222562056284?clk_rvr_id=1598746816103&utm_medium=cpc&utm_source=twenga&utm_campaign=twenga&utm_param=eyJlcyI6MCwicyI6OTcyMDIzNywiY2kiOiIwM2U2ZDA5YTEzZjVlNGMzY2FhMDg2ODBhZDMxZTNkMyIsImkiOiI2Njg1ODk5NTg5MzcxMjIwODgyIiwidHMiOjE1MzE2NTA4NDEsInYiOjMsInNvIjoxNTAwLCJjIjo2Njk5MX0%3D&rmvSB=true

I noticed that some have separate import and export energy totals which makes perfect sense and would be essential for some applications eg PV inverter and grid connections. From what I’ve read all the values from the pzem’s are unsigned so both import and export will ramp up the energy total and there is no easy way to tell the direction of travel of the power value to calculate it outside the device.

The example device I linked above should work work really well for users with a excess PV diverter as “true” export and import values will be of much greater value than the “net per 10s” we’re used to which looses all the data for energy in the “sweet spot” oscillating. I’m thinking of trying one of those too as the din rail mount and separate import/export totals might be worth the price difference (< x2).

Although that one will do up to 45A without a CT (which is a plus IMO), something like the one below with a 100A CT might be more appropriate for a main grid connection although this one is unfortunately considerably dearer (~ x4).

[edit - hope nobody minds, I’m going to add some links here to refer back to as it seems that last device goes under a couple of names and there is conflicting info about whether it is 60A or 100A]

EM115-MOD (60A CT)

Page Not Found - Aliexpress.com

http://a2.leadongcdn.com/attachment/7ripKBloSRjlmnkoRiwS77gwbf3znq/EM115-Mod-.pdf

EM115-MOD (100A CT)

EM115-Mod single phase~100A~MID~Modbus - Buy energy meter, MID Certified meters, MID Approved meters Product on Shanghai Fangqiu Electric Co., Ltd.

https://meters.co.uk/wp-content/uploads/2018/05/EM115-MOD-.pdf

OB115-MOD (100A CT)

OB115-MOD Single Phase MID CT Meter

OB115-MOD (45A Direct)

https://owen-brothers.com/media/wysiwyg/OB115_User_Manual_2016_v1.2.pdf

DDS238-1 ZN (45A Direct)

https://www.ebay.co.uk/itm/5-45-A-45A-MAX-220V-50HZ-60HZ-voltage-current-energy-meter-RS485-MODBUS-RUT-/222562056284

DDS238-1 ZN (32A Direct)

Modbus - KWh meter - DDS238-1 ZN

single phase static watt hour meter | Electricity Meter

China Circuit Breaker Manufacturer, AC Contactor, Thermal Relay Supplier - XIAN GOODNESS IMP. AND EXP. CO., LTD. ($1.90~$2.40 volume pricing!!!)

DRS-205C (32/45A Direct)

Page Not Found - Aliexpress.com

http://q.zvk9.com/1200/2017/12/12/2.0%20DRS-205C%20MBus%20Protocol%20V1.1.pdf

http://q.zvk9.com/1200/2017/12/12/DRS-205C%20MODBUS%20user%20manual.pdf

DRS-2DM(60/80/100 Direct 2 tariff)

Page Not Found - Aliexpress.com

HTB1ZGClHpXXXXamXVXX.PRXFXXXv.pdf (257.4 KB)

1 Like

There seems to be quite a selection.
Here’s a direct connect 5A base, 65 A max 230V, 50 Hz unit for less than a tenner.

That one seems to only have an S0 pulse output not modbus/rs485, but yes there are many out there.

Reminds me of a song from the 50s… (Shake, Rattle and Roll)
I’m like a one-eyed cat peepin’ in a sea-food store

I’m not familiar with what they offer over their serial bus, and how those registers related to the IC registers, but certainly the IC claims to tally positive and negative energy separately. I suspect that “energy accumulation frequency” mentioned in the last paragraph below is what the energy diverter folk refer to as their “bucket”, i.e. how quickly it will note the change in direction and start tallying into the other register.

10.13.1. Energy Accumulation

In E1 path, positive and negative active powers are accumulated into the energy 
accumulators according to their signs; for example, positive active power is 
accumulated into PPCNT (0x10F0), and negative active power is accumulated into 
NPCNT (0x10F1). Besides, other data, such as I1 current RMS or a constant 
(preset in the register DATACP, 0x10FC), also can be selected to be accumulated 
into PPCNT via configuring bits PSEL1~PSEL0 (bit[1:0] of PMCtrl4, 0x287D) when 
the chip is used for low power applications.

In E2 path, positive and negative active/reactive powers are accumulated into 
the energy accumulators according to their signs; for example, positive power
is accumulated into PQCNT (0x10F6), and negative  power is accumulated 
into NQCNT (0x10F7).

When MTCLK frequency is 3.2768MHz, 1.6384MHz or 819.2kHz, the energy accumulation 
frequency is 12.8kHz. When MTCLK frequency is 32768Hz, the energy accumulation 
frequency is 2979Hz.

By way of comparison, here’s a pic I took from my ADE energy IC a few years back. The Red trace is current, which you can see switches from a low level forward current to a high level reverse current. The Yellow trace is the /IRQ signal coming out of the IC to alert me that energy flows have reversed. You can see it takes almost two full 50Hz line cycles to alert me. The IRQ is just informational as (like yours) it internally flips to the negative energy accumulator upon reversal, but I assume the IRQ is coincident with that flip and so gives an indication of how long it takes.

Nice review Paul!

The PZEM-016 has a total of only 12 register addresses. Here’s the map:
pzem-016-registers
It would’ve been nice if they implemented the processor’s bi-directional functions on the 485 bus. :disappointed: