HELP! PZEM-017 and D1 Mini 32 ESP32 Clone Setup

Do as you think. I just suggested how it works on my D1mini without a problem for more than a year.

OK, I hooked up everything and Iā€™m still getting "Entity is Non-numeric ", and I even tried a different uart, but that gave more problems.

Maybe itā€™s my sensor setup. Did you configure anything differently??

You tried to switch Tx, Rx. Just do it in the configuration

I have it this way

uart:
  tx_pin: D1
  rx_pin: D2
  baud_rate: 9600
  stop_bits: 2

I tried connecting to a different set of pins designed for uart. The esp32 supposedly has 3 sets. The tx pin on pin 9 made the WiFi stop working when installed in the software, but pin10 which is rx was fine, but I switched it to both the tx and rx pins of the ttl to uart adapter. Everything resulted in the entity is non-numeric error. I even tried the resistor trick, still nothing.

I ordered some esp8266ā€™s and a nodemcu esp32 to see if I can make anything different happen with everyone elseā€™s known configurations.

I still would like to know if the code you used was dissimilar to the example for the pzem-017 example on the earphone website, or if you configured the sensor in a special way. Thanks!

I used an example from the ESPhome documentation

Connect pins IO22 and IO21 (D1, D2) as Tx pin D1 to TTL converter to Tx and Rx pin D2 to TTL to Rx. The TTL board is probably incorrectly marked

Found the solution! Turns out the pinout I had was not complete, and on the ESP32 there is a 3rd UART pair: Pins 16 (RX) and 17 (TX). Through a level shifter, I connected the ESP TX and RX to the TTL to UART adapterā€™s TX and RX (respectively)ā€¦yes, TX to TX, and RX to RX. A to A and B to B from the TTL to UART adapter and the PZEM-017. No resistor needed, so far :slight_smile:

According to the ESPHome debugger, the UART1 pair (pin 9 and 10) is used for the programmer and wifi, so that pair is a non-option, and it was causing the ESP32 to go into a bootloop and then safemodeā€¦so thatā€™s why I tried the UART2 option, and Iā€™m super glad it worked!

This the fully correct Mini ESP32 pinout:

Hereā€™s the final wiring schematic:

Code was almost exactly what ESPHome recommends, except the pin difference. I hope this helps someone in the future. Take care!

2 Likes

Hello,
I have a similar setup (ESP32 DEVKIT1). I have connected all the boards the same way as described, but I am receiving errors regarding CRC checks:

[17:51:08][W][modbus:121]: Modbus CRC Check failed! 9FBD!=9F32
[17:52:08][W][modbus:121]: Modbus CRC Check failed! 3745!=F610

I have connected the board on the UART2 (GPIO17 for TX and GPIO16 for RX). I have bought another pair of UART adapter and logic sifter, but the same issueā€¦ Does anyone know, what could be the issue?

Many thanks.

Hi, Iā€™m in the same situation. Setup with ESP-wroom-32, worked for about half a year and after updating Esphome sometime in December 2022, CRC errors started to increase. A correct value appears here and there, but only exceptionally. I havenā€™t found a solution yet :confused:

I just setup a pair of these and seeing the same CRC errors
Any update on this?

1 Like

hello I buyed on of this pzem 017 and coonect to my wemos d1 mini and getting this errors. I canĀ“t get no values both tx and rx lights of rs485 adapter are flashing. any ideas?

[15:23:57][VV][scheduler:225]: Running interval 'update' with interval=2000 last_execution=619821 (now=621821)
[15:23:57][VV][uart.arduino_esp8266:196]:     Flushing...
[15:23:57][V][modbus:199]: Modbus write: 01.04.00.00.00.08.F1.CC (8)
[15:23:57][V][modbus:042]: Modbus received Byte  1 (0X1)
[15:23:57][V][modbus:042]: Modbus received Byte  4 (0X4)
[15:23:57][V][modbus:042]: Modbus received Byte  0 (0X0)
[15:23:57][V][modbus:042]: Modbus received Byte  5 (0X5)
[15:23:57][V][modbus:042]: Modbus received Byte  5 (0X5)
[15:23:57][W][modbus:108]: Modbus CRC Check failed! C022!=505
[15:23:57][V][modbus:042]: Modbus received Byte  0 (0X0)
[15:23:57][V][modbus:042]: Modbus received Byte  0 (0X0)
[15:23:57][V][modbus:042]: Modbus received Byte  0 (0X0)
[15:23:57][V][modbus:042]: Modbus received Byte  0 (0X0)
[15:23:57][V][modbus:042]: Modbus received Byte  0 (0X0)
[15:23:57][W][modbus:108]: Modbus CRC Check failed! C071!=00
[15:23:57][V][modbus:042]: Modbus received Byte  0 (0X0)
[15:23:57][V][modbus:042]: Modbus received Byte  29 (0X1d)
[15:23:57][V][modbus:042]: Modbus received Byte  152 (0X98)
[15:23:57][V][modbus:042]: Modbus received Byte  0 (0X0)
[15:23:57][V][modbus:042]: Modbus received Byte  0 (0X0)
[15:23:57][V][modbus:042]: Modbus received Byte  0 (0X0)
[15:23:57][V][modbus:042]: Modbus received Byte  0 (0X0)
[15:23:57][V][modbus:042]: Modbus received Byte  0 (0X0)
[15:23:57][V][modbus:042]: Modbus received Byte  0 (0X0)
[15:23:57][V][modbus:042]: Modbus received Byte  155 (0X9b)
[15:23:57][V][modbus:042]: Modbus received Byte  200 (0Xc8)
[15:23:59][VV][scheduler:225]: Running interval 'update' with interval=2000 last_execution=621821 (now=623821)