Connecting a PeaceFair Pzem-004T to an Espressif ESP8266


@Tony scroll up a few posts as I provided full details regarding JP4.

Meanwhile I will check through the rest of your post.


Clearly marked as 510R within this thread at Connecting a PeaceFair Pzem-004T to an Espressif ESP8266

As per the photos nothing connected to the two you have marked as ?

Let me know if you still have questions when you have checked through the photos etc.


See my post regarding JP4.


Correct ! That’s what I did :

By the way : Still 2 issues :

  • Cannot select a Wifi SSID during Setup (will only show the last one connected to)
  • Power Off means : cleared so have to do setup all over again. I just received a new Wemos D1, will flash this one and see if the issue persists with this one too


Just flashed a brand new Wemos D1 with the latest binary. Poweredc it OFF … DAMN … again everything is lost and shows up as ESPProMON SSID … What the hell am I doing wrong here ??? (Sad face)


You have the WeMos the wrong way around on the PCB !!!

It’s clearly marked which way it should go.


Pretty sure that’s how it has to be for iOS.


It’s certainly not helping with you putting the WeMos the wrong way around in the PCB :slight_smile:


Hahaha tha’s right … It was more convenient this way around with the USB plug ! My bad !!! Dosn’t harm and shouldn’t make any difference in losing data after power off.


I’m amazed you got it the wrong way around and it means all the connections that you have meticulously checked are completely wrong.


No no no … It was just because I plugged it out of the headers to flash it and put it in the wrongb way … It’s correct again now …

What are your suggestions ? What can I do to find out what causes the ESP to lose it’s config ???


But in doing that you were putting 5V through the reset pin etc. Could kill your WeMos and Pzem etc.

If possible I would like to see a set of photos of the Pzem and PCB, without the WeMos in place.

What setting do you have on the pot?


That’s right but I was lucky this time !

The pot is a 10 K pot (didn’t have 3K one as you suggested in one of the posts) and it’s set to 50%. But that should not make any difference as the Wemos, even when not connected to the PZEM, loses config after power off. So it has to be related to the flashing or so. I do use another method than the one you describe but with this method I have flashed 100’s of EPS. I currently have about 10 devices permanently active in my home based on ESP that I flashed and programmed myself. here’s the PIC you requested :


For sure your system will not work like that. With a 10K pot you need about a 5% : 95% split.


Yes I will replace it for now with fixed resisors as you suggested in another post. I am also trying to flash now the way you suggest here : python -p COM4 write_flash -fm dio -fs 32m 0x0000 ESPproMon-latest.bin

Thing is I downoaded the ESPTool as you explained but I am missing the python stuff as I get this error :

C:\esptool-master>python -p COM12 write_flash -fm dio -fs 32m 0x0000 ESPproMon-latest.bin
’python’ is not recognized as an internal or external command,
operable program or batch file.


Just posting another copy of the completed PCB.

It looks nothing like yours, a temperature sensor slots in JP1 and an 433MHz transmitter in JP2 etc.

The flashing method shouldn’t make any difference as long as you have a method that works.


If the flashing method does not matter … How can it be that when I flash the ESP, Setup the App wikth it and then power off I lose my eeprom data EVEN if it’s not even connected to the PZEM ??? That’s my big mistery question …


I really start to wonder if it’s not related to the IOS version of the App … Should I try the Android versioen maybe ?


I have covered this with you previously.

One of the WeMos pins is used to reset the EEPROM and if you are not connecting everything up correctly or don’t have the WeMos plugged into the PCB the pin could be floating and triggering the reset.

My iPhone has been running the ESPproMon app continuously for the last 2 or 3 months without a single EEPROM reset. That’s all the phone does 24/7, run the app.


Ok, you are right … I am skipping steps maybe … So as from now on I will try to follow your instructions EXACTLY.

I read : “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.”

So I have a choice here :

no pot meter (which was my initial prototype setup which crashed all the time also but data was coming in from the PZEM correctly)


I take your other suggestion :slight_smile:

You can just use a couple of resistors as a voltage divider (1K from Pzem, 2K to ground and intersection to GPIO 12 (D6) on the ESP8266) but we use a PCB trimpot as shown in the image below.

So, what do you prefer me to do ? 1K pot (don’t have one laying around) or the 1K/2K voltage divider ?