These sensors work in the UART mode, and you should connect sensors to UART pins (CC2530 P0.2 -> RX, CC2530 P0.3 -> TX). Therefore you cannot use the UART interface in the same configuration.

UART-based sensor
UART-based sensor.

PZEM-004 V3

Please, note that the firmware supports V3 only.

PZEM-004 configuration for one sensor
PZEM-004 configuration for three sensors
This sensor type supports the write command.

write - resets the counter
Topic: zigbee2mqtt/[friedly_name]/set
Payload: {"[channel]": 0}
Channel: l1, l2, l3 … l16

Senseair S8

This sensor type supports the write command.

write - starts calibration procedures.
Topic: zigbee2mqtt/[friedly_name]/set/[channel]
Payload: {"[channel]": value}
Channel: l1, l2, l3 … l16
Value:
0 - start the zero calibration procedure.
1 - start the background calibration procedure.

Comments
Harvey Specter
Posted at 02:59 January 22, 2021
Mário Arnaldo Mazon
Reply
Author

Hi. As PZEM-004T uses UART, is there any way to connect three or more of them to one cc2530 and get 3 channels (three phase) readings, for example ? I understood I need to connect it to pins p0.2 and p0.3, but in which case I need to configure INPUT ? Or I only config the Output ? Thank you.

    Harvey Specter
    Posted at 03:27 January 22, 2021
    Owner
    Reply
    Author

    Hi. I didn’t try to connect 3 sensors.
    1. You should change the sensor’s address using a utility from a manufacturer. Each sensor should have a unique address.
    2. You should configure 3 outputs. All outputs should use pin P02.
    3. You don’t need any inputs.
    Please, let me know about your results.

        Harvey Specter
        Posted at 04:59 January 29, 2021
        Owner
        Reply
        Author

        Thank you for sharing your expirience!

          Harvey Specter
          Posted at 19:10 February 21, 2021
          gio
          Author

          Hi, i noticed a really strange behaviour using PZEM004-t. I realized a schematic with this config:
          Board type: CC2530
          Device type: End device without routing
          Update firmware’s timestamp : 2021-02-20
          Status LED: P01, Periodic (every 5 seconds)
          Default reporting interval (s): 20

          Output pins:
          P02: Output 1, PZEM-004T V3 (Address (dec): 1)
          P10: Output 4, GPIO, External pull-up
          P11: Output 5, GPIO, External pull-up

          Input pins:
          P20: Input 4, GPIO, External pull-up, Link to out 4
          P17: Input 5, GPIO, External pull-up, Link to out 5

          So far so good, all is working. I use SmartRF04EB as programmer. If i flash firmware and then let connect the board to zigbee2mqtt (without power cycle or reset the board), all is working flawlessy: inputs command linked out fast and even output switched from z2m works fast.
          But if i reset or power cycle the board (Off then on after flash), command outputs from zigbee2mqtt becomes very very laggy (5-10 seconds). Command outputs from linked Inputs instead remain fast.
          I’m sure there is a bug somewhere.

          Harvey Specter
          Posted at 09:37 February 22, 2021
          gio
          Author

          Hi, i have found the reason of very laggy gpio commands outputs using PZEM: if router function is disabled command are very laggy (5-10 seconds). With router enabled commands are ever fast.

Harvey Specter
Posted at 17:26 December 2, 2020
Frab
Reply
Author

Hi, I cannot get the PZEM-004 V3 to work.
For me it’s not clear if I am configuring it wrong or there is a malfunction on the module.
Is it ok if I configure like this?
OUTPUT 1 – P02 – PZEM004 – ADDRESS 248 (where do I find this value, is it standard?)
INPUT 2 – P03 – PZEM004
Anyway thank you for your work!

    Harvey Specter
    Posted at 14:02 December 4, 2020
    Owner
    Reply
    Author

    Please, configure Output 1 only. The address is the default value from the documentation. Please, try to swap RX and TX wires. Did you connect GND and 3.3V to PZEM too?
    The sensor does not work without a connected load.

      Harvey Specter
      Posted at 21:49 December 5, 2020
      Frab
      Reply
      Author

      Thank you. With:
      OUTPUT 1 – P03 – PZEM004 and no INPUT it works! It was not really clear for me how to connect.
      Now the only thing I notice: in Zigbee2Mqtt every value appears good, but Watts are without comma (example: 596 watts instead of 59,6 watts). Is this Zigbee2Mqtt bug?
      Anyway, a coffee is coming 😉

        Harvey Specter
        Posted at 06:54 December 6, 2020
        Owner
        Reply
        Author

        Watts: Maybe, it is a bug. I’ll fix it in the next version.

        Harvey Specter
        Posted at 12:04 December 7, 2020
        Owner
        Reply
        Author

        Fixed.

Leave a Reply to Owner
Cancel Reply