How to connect pzem 017 DC with nodemcu

This is correct. I don’t have cod for arduino, only for esphome and my schematic is for that.

This is my code:

uart:
tx_pin: 1
rx_pin: 3
baud_rate: 9600
stop_bits: 2

sensor:

  • platform: pzemdc
    current:
    name: “Batery Current”
    id: dc_current
    voltage:
    name: “Batery Voltage”
    id: dc_voltage
    power:
    name: “Batery Power”
    id: dc_power
    update_interval: 1s

Hi there. I have the pzem 017 setup in home assistant. Is there a way to show the soc reading from the pzem. I wanted to be able to monitor state of charge in home assistant from this to then control for example turn off solar when battery hits 80% soc.

Were you able to do this? I’m looking for doing exactly the same thing and just found the device. I haven’t purchased it yet because I’m researching on how to use it with my epever solar charge controller and Home Assistant setup to do a more close to reality monitoring of the battery SOC.

Hey guys, I am trying to find the schematics of the peace fair module PZEM004T but not able to find any. Can someone please point me out in the right direction on this for where this schematic is available. I have searched google for 2 days or so. Thanks

Esp8266 is powered by a battery of solar panels. Is it possible to power PZEM-017 from the same solar panel battery source that I would like to measure?

This is how you can connect without additional boards by removing this element and soldering the jumpers. then there will be PZEM0XX Tx Pin B , Rx Pin A.

1 Like

Has anyone gotten ESPhome with the PZEM 017 to read “energy” (KWH)? Thanks
MikeyM

Yes, I use this code in esp8266:

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

sensor:
  - platform: pzemdc
    current:
      name: "FV-Proud"
      filters:
        - calibrate_linear:
          - 0.0 -> 0.0
          - 2.1 -> 0.9
    voltage:
      name: "FV-Napětí"
      accuracy_decimals: 2
    power:
      name: "FV-Příkon"
      filters:
        - calibrate_linear:
          - 0.0 -> 0.0
          - 60.1 -> 25.6
      id: my_power
    update_interval: 5s
    
  - platform: total_daily_energy
    name: "FV-Energie"
    filters:
      - multiply: 0.001
    unit_of_measurement: kWh
    power_id: my_power
    
time:
  - platform: sntp
    id: my_time
2 Likes

Hello, can you please advise me how to connect PZEM-17 with D1-mini.I used a code from pepe59. I have an RS485 to TTL converter. I connected the output of Tx converter to Tx D1 mini and Rx to RX but it didn’t work. I also tried D5 and D6, only there will probably be a need to set up the serial software, because if I just connect TX to D5 and RX to D6, it doesn’t work. Thank you

uart:
tx_pin: 1
rx_pin: 3
baud_rate: 9600
stop_bits: 2
or
uart:
tx_pin: 14
rx_pin: 12
baud_rate: 9600
stop_bits: 2

You have a badly connected TX, RX.
Must be RS485-TTL TX on RX D1-mini and RX on TX D1-mini.
PZEM serial line - RS485 converter is A to A and B to B

I tried that too, but it didn’t help the D1 mini connects but I don’t get the data. Do you also have a D1 mini or other board?
pzem

esphome:
  name: pzem017
  platform: ESP8266
  board: d1_mini

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  password: "7a8fhfg5h5hfh54be730a7"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Pzem017 Fallback Hotspot"
    password: "2fh5fhfh5cX4s"

captive_portal:




uart:
   tx_pin: 1
   rx_pin: 3
   baud_rate: 9600
   stop_bits: 2
   
   
   

sensor:
  - platform: pzemdc
    current:
      name: "FV-Proud"
      filters:
        - calibrate_linear:
          - 0.0 -> 0.0
          - 2.1 -> 0.9
    voltage:
      name: "FV-Napětí"
      accuracy_decimals: 2
    power:
      name: "FV-Příkon"
      filters:
        - calibrate_linear:
          - 0.0 -> 0.0
          - 60.1 -> 25.6
      id: my_power
    update_interval: 2s
    
  - platform: total_daily_energy
    name: "FV-Energie"
    filters:
      - multiply: 0.001
    unit_of_measurement: kWh
    power_id: my_power
    
time:
  - platform: sntp
    id: my_time

I use a nodemcu 8266, a larger board.
I sent a private message.

Same question, the energy value could be read in pzemac platform, not in dc … Could be implemented with reset function of course, in next release? thanks

Here I measure the energy (direct current) that comes into the battery.
solar energi

Ok bit it is calculated by esphome… I mean the value inside pzemdc and not read by integration. There is also a problem with current, it is double than real so I need to use filter multiply x 0.5

Finally I used modbus controller integration too in order to read just energy value and create a small action to send direct on serial port the 4 byte to reset enegy if I need.
Anyway the current value reported by pzemdc original integration is not true (double), I have no knowledge to modify the source code, but I hope somebody could do . Thanks.

Hi I know its been a while since your post, but did you get it working ??..I had the same problem and found that the cheap RS485 TTL boards do not have the 120ohm resistor across pins A and B connected. You can see it fitted to the board but its not connected on one side. Therefore put a 120ohm resistor between the A and B outs and it should all work, i also had a problem that the silk screen on the board has got Rx and Tx mixed up, to get over this just connect Rx on 485 board to Rx or your receive GPIO pin) on wemos d1 … same for Tx. ie 485 Tx to transmit pin on wemos D1 hope it helps.

Hello pepe59,

I have some trouble with PZEM-017 DC connection to my Wemos D1 mini. Please can you help me with this?

budis (CZ/EN)

Hi, did you actually measure the calibration constants between the real and measured value for PZEM 017 or are they taken from somewhere? Thanks

Ahoj, kalibračné konštanty medzi reálnou a meranou hodnotou pre PZEM 017 si reálne meral či sú odniekiaľ prevzaté? Dík

I can’t get it work either. I have exactly same connection as posted here How to connect pzem 017 DC with nodemcu - #12 by cristi2005

with configuration posted here How to connect pzem 017 DC with nodemcu - #38 by pepe59 (swapped D1 D2 with RX TX of course)

But there is no response from PZEM-017. :’( Any advice how to make it work please?