Connecting a PeaceFair Pzem-004T to an Espressif ESP8266


Are you using a split or solid core CT? It’s much easier if you buy a split core CT. You simply clamp it around the main live feed and don’t need to disconnect any wires.

For the live and neutral for the Pzem you have 2 options:

  1. If your consumer unit is close to a mains socket wire up a plug between the socket and the Pzem. This is the safest as it’s just like wiring up a plug for a TV or a kettle etc. Certainly this would be a good way for you to test your system until such time as an electrician completes the installation for you. If you only have a solid core CT I wouldn’t do any more work inside the consumer unit based on your knowledge of electrical wiring.

  2. Alternatively you need to take the feed from the consumer unit. This is blue and brown from the trip switches but if you are having to ask the question I would leave it to an electrician to do.


As your diagram clearly shows, you should connect N wire to first port, L should be connected to second one, third and fourth are reserved for CT, wiring order is not important there. You would also want to mount your CT on L main wire, and to make sure it’s not to close to N main wire, in order to get accurate results and avoid interference. I’m telling you this because I can see that your installation is tightly packed, CT sould be at least at 5cm distance from N main. And yes, red circled wire is L main.


I connected it correctly, and i was able to monitor it from the app. A success, but is there anyway to powerup the ESP from the PZEM??
I had the small hope that the VLL port could provide the power…


Short answer no, the ESP powers the PZEM’s TTL port rather than the other way around.
I guess technically the 110 / 230V power feed into the Pzem (not the TTL port) could be passed through a transformer to take the voltage down to 5V for a USB connection to the ESP (WeMos).


humm ok… a mind twist… so i can use a phone charger for this… most are 5v.


Yes of course that’s what most people use with their WeMos.
There are some low cost USB chargers that don’t provide enough power to run the WeMos AND the TTL port on the Pzem so don’t use a super cheap charger.
With our consumer unit we had a door bell wired up just above the unit so we changed it to a 3 pin socket with twin USB ports. It means we can run up to 3 Pzem’s in our consumer unit.


I will use something like this


Looks perfect.


I think I will pick up one of those sockets with USB ports.


Test post - ignore.


It’s an interesting discussion. I ordered a kit from Amazon which contains just the PZEM and the transformer. Which type of cable can I use to power the device (PZEM 004)?

I’m talking about the type of cable that we shoud put int the pin 1 & 2, Can you send me the link where I can order it? Thank you