10x PZEM-004T

Hi
I have 10 pieces PZEM-004T as energy monitor.
Sometimes 2-3 PZEMs fail. Restart usually helps.
In the log file this yellow message:
'Modbus CRC check failed! 4C65!=1404
Does anyone know the problem?

1 Like

Does anyone know your wiring/yaml?

uart:
  id: uart1
  tx_pin: D2
  rx_pin: D1
  baud_rate: 9600
#  debug:

modbus:
  - id: mod_bus_pzem1
    send_wait_time: 250ms
    uart_id: uart1

sensor:

  - platform: pzemac
    id: Strom_Gesamt
    current:
      name: "Strom Gesamt"
    voltage:
      name: "Spannung Gesamt"
    energy:
      name: "Energie Gesamt"
    power:
      name: "Leistung Gesamt"
    frequency:
      name: "Frequenz Gesamt"
    power_factor:
      name: "Power Factor Gesamt"
    update_interval: 10s
    address: 1
    modbus_id: mod_bus_pzem1

  - platform: pzemac
    id: Strom_Aussen
    current:
      name: "Strom Aussen"
#    voltage:
#      name: "Spannung Aussen"
    energy:
      name: "Energie Aussen"
    power:
      name: "Leistung Aussen"
#    frequency:
#      name: "Frequenz Aussen"
#    power_factor:
#      name: "Power Factor Aussen"
    update_interval: 10s
    address: 2
    modbus_id: mod_bus_pzem1

etc.
PIN D2 is on an OptoCoupler PC 817 to RX from PZEM.
PIN D1 is on TX from PZEM.
All PZEM parallel.

No diodes on the TX’s from each pzem in your setup?

image

Sorry. Yes. Every PZEM have diode to TX. But no resistor to 5V :thinking:
My Optocoupler are 2 pcs parallel (one over other)
Energie

Maybe you could try to add one and see if it helps?

I wonder if they always the same ones or always “random” ones?

I also see you have no stop_bits (default is 1) in your uart defined. Some users claim setting it to 2 helps with the CRC check failed

Stop_bits: 2 → only CRC error and no data!

“…more then 4…”
that problem is no data. my problem is sometime no data and sometime any CRC-Error.

I thing i should use a 1.5 Amps PNP Transistor S8550 instead optocoupler… :man_shrugging:

Looks like my first try. 1 to 4 no problem. Direct connected.
Then 5 to … = no Data.
More then 4 with one optocoupler many CRC-Error´s.
Now two optocoupler parallel sometime CRC-error´s

So 4 pzem always work stable? And as soon you have more you always experiencing some sort of problems - right?

I was wondering anyways that you have 10 pzem connected to one esp82xx, I had in mind there was kind of a hard limit… but by the looks of it there isn’t - beside some unstable experiences :expressionless:

Another thing which might be worth trying is to use more than one uart bus. For example hook 4 pzem’s up to one uart bus and another 4 to another bus and another :bus: for the rest?

I have try 4 pcs testet for 10min. without problems.
Limit? I dont know. I have used adress 1 to 11.
Why should i use 2 uart and modbusses?

Just to see if you can avoid the problems you have… like a work’a’round (having more than 4 pzem connected to a esp but still have it stable and not throwing CRC failures and stop sending data)

I understand. I think the problem ist not software. I think the problem is power consumption from optocoupler in the PZEM´s oder Timing problem.
a little more timeout from adress to adress maybe…

1 Like

Hi
Were you able to solve your problem?
If the answer is yes, how?

My last Version is 2 optocoupler on top of each other for RX Optocoupler.
The Optocoupler goes to 5V and R8 from PZEM i have 500 Ohm.
Look here:
HOWTO control PZEM-004t · arendst/Tasmota · Discussion #10567 (github.com)
BTW: Sometime are 2 or 3 not available. Then i must restart ESP. Sometime 2 or 3 times.