Making the PZEM-004T a little bit safer to use

Out of curiosity I ordered a PZEM-004T module from China.

This module can measure RMS voltage, RMS current, active power and total energy usage over time and has a opto-coupled TTL serial connection to get the values remotely. Great if you want to interface it with an Arduino or something like that.
For less then 10 euro it’s a bargain :slight_smile: and I have seen some projects that uses this module.

Unfortunately the PCB design sucks :frowning: In my opinion it is unsafe :frowning:

The creepage distance between the opto-coupler and serial output pins and the mains is a miserable 0.25mm. As the module is rated for 260V this should be 2.2 mm minimum.
The resistor that is used as voltage divider for the chip is a 1 mega ohm MCR10 SMD resistor that is rated for 150V voltage drop maximum. As the peak voltage at 260V is ~370V this resistor should be replaced with preferable four 250 kilo ohm resistors in series.

To make it at least a little bit safer I desoldered the serial connector and the opto-couplers and I made a second PCB and used the opto-couplers to connect the main PCB to the second PCB. Now there is plenty of space between the mains and the interface :slight_smile:
I also added a transistor to drive the RX opto-coupler. It now works at 5V and 3.3V with a FTD1232 module and the maximum current during operation is 7 mA at 5V and 4 mA at 3.3V. The modification was made with components at hand so any advice to improve upon this solution is welcomed.

I also made a small PCB for the other end to use a normal resistor and a connector to expose the voltage input of the board. Now it should be possible to measure the current through and the voltage over a load that is controlled with a triac controller. At this moment this is untested.

I hope this is useful :slight_smile:

PZEM-004T mod diagram.png

The safety issues are really important and the dual voltage support is a really good feature but you have changed a nice compact board into a monster [no offence]. Hopefully someone else can offer suggestions on how to contain these fixes on the original board.

I'd like to see photos of the other sides of you boards showing the modifications.

I think is is not possible to modify the existing pcb to make it more safe. The manufacturer, Peacefair, should make a larger PCB with a clear separation between the mains and the serial interface preferable with a slot underneath the opto couplers.

If they add a transistor (or a p-channel mosfet) like I did it should be possible to connect multiple boards in parallel without exceeding the output current of the arduino.

They also should replace R3 with three 1 Meg resistors like in the DL69-2048 (R3, R4 and R5).

Also the resistor across the big capacitor should be replaced with multiple resistors in series or a trough hole type like in the DL69-2048.

I regretfully have no picture of the other side of the board I put on top, there are only three resistors and one transistor on the other side so it should not be to difficult to work that out :slight_smile:

It looks like I could cut and remove ground material on the backside of the board to separate the ground plane around the opto-isolators and the serial connections from the rest of the board. See attached pic.

Could this address the safety concern about the isolation of the serial port?