How to connect pzem 017 DC with nodemcu

i did not want to connect my pzem017 through rs485-ttl converter ,
what i want is to connect my esp8266 node directly by soldering to the PZEM017 as i have seen in this github post ,

but i cant figure out the exact location to connect rx tx ,

Why on earth not?

I solve problem in this mode and work perfect.
I use this convertor: https://www.aliexpress.com/item/32385757602.html?spm=a2g0s.9042311.0.0.632f4c4d5hzPqu

1 Like

Hello Cristi,

I’m currently working on the pzem-017 with Esp8266 NodeMCU or ESP8266 Mini D1 which is the same as your project.

Would you please share your code so the PZEM-017 can talk with ESP8266 and display the data?

Regards,
Key

Hi Nickrout,

I have no problems with the connection between PZEM-017 and ESP at all. What I’m looking for is the code or the sketch that can run and give out the reading on Arduino. (the one from your link does not help)

Does anyone have a project or code for this PZEM-017 to work with ESP on Arduino?

Regards,
Key

Why are you posting in the esphome section if you do not actually want to run on esphome?

my schematic is for esphome

For arduino find info here: https://www.youtube.com/watch?v=vvQcoQesAD0&list=PLUD7ZwUf-UI3asH78saWsUWbSfv6cYh0s&index=29&t=0s

Esphome does not run on an arduino AFAIK.

Strictly speaking your correct, but esphome uses arduino. Therefore any library available in esphome should be pretty easy to port for use in arduino if needed.

That said, it’s not hard to find a direct example of arduino code for the PZEM sensors (this may also work for the -017?):

Yes I know, but there is already pwem-017 support in esphome.

nick, I’m no expert either, but I did play with rs485 stuff when I was helping my daughter’s swim team install some new scoreboards. As far as the protocol is concerned, it works exactly like UART. In fact, the scoreboards had a wireless option and an rs485 option. The rs485 option uses an adapter, which inside is just an ftdi chip connected to an opamp and optocouplers. The wireless dongle was nothing more than an ftdi connected to a 2.4 rf link (both methods use the same windows ftdi driver). Incidentally, my son’s baseball fields also got new wireless scoreboards last year that I helped install… same deal the old boards had rs485, and the new ones could use that, or a wireless link that has a module which plugs into the same port inside the scoreboards as the rs485 cable would go (no jumpers or other changes needed).

On the hardware side, it is essentially UART with a pair of 1.5V differential data lines (instead of the single ground reference line, which is vulnerable to noise). Usually they also use optocoupling to further eliminate ground loop noise. The differential signal, together with twisted pair wiring, makes rs485 capable of working reliably with 100m long cables. So you can think of rs485 like nothing more than a hardware attachment to boost your UART signal over long distances.

Since it’s 1.5V differential, it may be lucky and not necessarily harm an esp, but reliability could get dicey… and you run a risk of getting some bad inductance that might trash a GPIO pin. Bottom line, use a proper rs485 adapter and twisted pair wiring when communicating between an rs485 and uart device… and of course keep the uart wires as short as possible, and let the rs485 lines do the running.

Using a level shifter as peopsed by @cristi2005 is certainly the safest bet.

I still can’t figure out what @key5000 wants.

Hi Cristi,

I already saw that link and watched. The board he mentioned on his video is Arduino Mega and the board I am using is NodeMCU and EAP8266 mini D1. I did tried to modify the code but still doesn’t work.

Have you be able to make your PZEM-017 to work with Mini D1 and Arduino?

Hi truglodite,
The PZEM-004T and PZEM-017 are two different hardware and they use different code.

Hi Nickrout and all other expert,
What I want to achieve on this project is to use PZEM-017 with either ESP8266 Mini D1 or NodeMCU to give out the reading in Arduino so I can implement and view it with Blink app.

I need the code or sketch that can work on PZEM-017 and ESP8266 for Arduino.

Please help

So nothing to do with home assistant at all?

Hi Nickrout,

Will be in up coming month as I just bought another Raspberry Pi to setup the server. But in the mean time, i need this to run on Arduino/Blynk server.

Connect it directly to the arduino then. I cannot understand why you want to use an esp?

Yes, there is a video (post above) that show PZEM-017 with Arduino Mega but i’m looking for PZEM with ESP (has different hardward and output the the Mega) which also use Arduino code but and has WiFi build in.