Connecting a PeaceFair Pzem-004T to an Espressif ESP8266


@Tony the image in that thread is poor but I have highlighted in yellow the 2 CT’s we had in our consumer unit some time ago. Blue is an SCT used with Open Energy Monitor and home brew systems and the black one is Peacefair CT. If you look just above the CT’s you will see they are clamped around the main live in feed (brown wire). The blue CT’s have to be fitted in a particular way i.e. text on the CT facing towards the power source but I’m pretty sure the Peacefair ones can be clamped either way round.


Thank You !!! Now the trick is finding out which of my 3 brown wires is Live …I measured and only the two middle ones (Blue + Brown) are giving 230 V. So I need to put the sensor arond the brown one in the middle probably ? Is it normal that I get no data when on the blue one ?


Yes the brown 230V live is what you need and blue will not give you any data.
Another reason to avoid the hardware that you bought is the solid core CT. Much easier with the split core that Peacefair sell.


Fully agree on the choice !!! I have some spare SCT013-30A/1V from … Can I use that one iso the current one ? Will order another better Peacefair for my final installation indeed !


I also have several SCT013’s from the same manufacturer but no you can’t use them with the Peacefair Pzem. Each CT is calibrated for the system it belongs to. Obviously the SCT013’s are generic and therefore you can use them in home brew systems from the manufacturers data sheet.


OK thanks … For now I will change the sensor to the brown wire and check if I get data. Will order the “nicer” Peacefair though !!! BIG Thanks for all your help !!!


Reconnected and working now !!! :slight_smile: :slight_smile:


Some first remarks on the usage if the App on IOS :

When setting up the ESP, no selection possible of available WIFI SSID’s, need manual entry
When ESP loses (good) WIFI access … the App doesn’t seem to reconnect. Message “EspMonPro is offline” keeps repeating. Killing the App and then restarting it does not seem to reconnect. Restarting (power off/on) the ESP does not solve the issue. ESP shows up in it’s “initial” state again and the whole setup process through the App needs to be done again ! All data in the meantime is lost.


I suspect you might have a floating pin that’s clearing the credentials in the EEPROM.


Should there be some pull down/up resistors ? I will rebuild it when I receive the PCB anyway …


GPIO 5 (D1) is set to be able to clear the credentials from EEPROM if you ever want to use the ESP for something else etc. It might not be this but I would need to more details and screenshots to see what your problem is.


I will send you some screenshots. It seems that indeed the ESP is clearing it’s EEPROM since it loses the information of the Wifi SSID.

The device seems to return to initial state (see screenshot Wifi SSID EspproMon)


Looks like you are still running the old firmware and have problems with an API key.


It said “Next version V00221” yesterday …


It should say 222 now.


Just adding an image of the bare PCB to make it easier to see where everything goes.
If you look at JP4 (towards top left) you will see that our generic PCB just has 2 holes but the images at the start of this thread show 3 connections with the trimpot.
If you are going to use PCB connectors and a trimpot to “protect” the RX line on the WeMos (D6 GPIO 12) you need to trim off the leg of the 3 way PCB connector marked in yellow as “1” on the earlier images.

So the 2 holes for JP4 are for yellow markings 2 and 3 with 1 not being soldered to the PCB.
Pin 1 of the trimpot goes to yellow pin 1 on the PCB connector and also has the connection from the Pzem’s TX line.

If like us you want the cables from the Pzem to sit on the PCB rather than extending out from the edges of the PCB then you need make sure you select the correct leg of the JP4 PCB connector to trim off.

Many users will simply choose not to use a trimpot in which case Pzem’s TX line will go directly to the bottom of the 2 holes at JP4 (D6 GPIO12). If you are using a trimpot or voltage divider remember what we have written about not using large value resistors. We originally used a 10K pot in a 1:2 ratio but it’s better with a 1K pot.

Hope this all makes sense.


Sounds very clear ! Will probably do this Friday or just after the weekend and will make sure I download the latest firmware. Also have a better version of the Peacefair on order wich should be delivered soon. thank You !!!


We recommend thorough bench testing before installing in your consumer unit especially if your are using a solid core current transformer (CT).

I think you can buy split core CT’s separately from Peacefair for the Pzem-004T.


Do you have a regular fixed line broadband?

Just curious as to why you have a dual band router.

You could try disconnecting rx and tx and running the ESPproMon on demo mode.


My comments on the PCB :slight_smile:

  • JP4 in the pictures shows 3 PINS whilst there are actually only 2 on the PCB.
    Top View :
    Left = D6
    Right = GND

  • JP6
    Top view :
    Left = D7
    Mid = ?
    Right = ?

  • JP1
    , Top view :
    Left = 3V3
    Mid = D5
    Right = GND

So the trim potentiometer goes like this :

  • Left -> (1) - TX PZEM - ** MARK 1 IS NOT CORRECT AS THE (1) =LEFT PIN = D6**
  • Mid -> (2) - J4 (Left) (D6)**
  • Right -> (3) -> J4 (Right) (THERE’s NO PIN 3 ON THE PCB)

So actuall you have to solder TX PZEM to the left side of the potmeter as there are only 2 PINs on the PCB.

PCB - R1 : Shows a resistor in the picture but I don’t see why that should be there ?