Replying to myself - any suggestions on what I can do to troubleshoot the CRC errors?
Do the sensors work? I remember that I also had couple of CRC once when I paired a pzem004t with esp. Despite the errors the thing was working fine.
Maybe you could try to re-wire or re-solder? Maybe somewhere is a bad connection which causes the errors?
Is it possible to know what kind of 4pin connector is used for the TTL side?
(The white one soldered in PCB)
Iād like to buy some pre built cables.
Thank you.
Does anyone know what resistor is soldered on the AC input side. I need to replace mine but Iām not sure of the wattage. It looks like a 100ohm with 5% tolerance.
Thatās a 2W resistor
thousand years later, finally, I made three pzem working great on esp8266! I did it using three diodes and one 10k resistor like the circuit indicated above! In +Vdd I connected +3.3v power source. No errors anymore! = D
Now I can focus on my next challenge, understand why bosch bme680 hates me a lot and give me always a lot of errorsā¦
I recommend you to buy a socket kit in AliExpress, they have this interface there to sell.
Yes but there are different sockets with different distances between the pins.
So you connected the 10K resistor to 3.3V and not to 5V. There are different tutorials out there recommending both connectionsā¦
Hello, I have a problem. I measure 3 phases.
The daily counter is not reset.
Does anyone know what could be the reason?
Iām helping myself with switches now.
It is about the last part, I would like to make it fermented.
esphome:
name: zh_leistung
esp8266:
board: d1_mini
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
logger:
api:
ota:
web_server:
port: 80
#time:
# - platform: homeassistant
# id: homeassistant_time
status_led:
pin:
number: D4
inverted: true
modbus:
# PZEM-004T V3 Pins
uart:
id: PZEM
rx_pin: D2
tx_pin: D1
baud_rate: 9600
sensor:
- platform: wifi_signal
name: "WiFi_Signal_dBm"
id: rssi_sensor
update_interval: 30s
- platform: uptime
name: "Uptime"
id: uptime_s
update_interval: 10s
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# L1
- platform: pzemac
address: 1
current:
name: "L1_Strom"
voltage:
name: "L1_Spanung"
power:
name: "L1_Leistung"
energy:
name: "L1_Verbrauch_heute"
filters:
# Wh to kWh is 0.001
- multiply: 0.001
unit_of_measurement: kWh
accuracy_decimals: 3
update_interval: 10s
# L2
- platform: pzemac
address: 2
current:
name: "L2_Strom"
voltage:
name: "L2_Spanung"
power:
name: "L2_Leistung"
energy:
name: "L2_Verbrauch_heute"
filters:
# Wh to kWh is 0.001
- multiply: 0.001
unit_of_measurement: kWh
accuracy_decimals: 3
update_interval: 10s
# L3
- platform: pzemac
address: 3
current:
name: "L3_Strom"
voltage:
name: "L3_Spanung"
power:
name: "L3_Leistung"
energy:
name: "L3_Verbrauch_heute"
filters:
# Wh to kWh is 0.001
- multiply: 0.001
unit_of_measurement: kWh
accuracy_decimals: 3
update_interval: 10s
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
switch:
- platform: uart
uart_id: PZEM
id: reset1_esp
name: "L1_Verbrauch_Heute_Reset"
data: [0x01, 0x42, 0x80, 0x11]
- platform: uart
uart_id: PZEM
id: reset2_esp
name: "L2_Verbrauch_Heute_Reset"
data: [0x02, 0x42, 0x80, 0xE1]
- platform: uart
uart_id: PZEM
id: reset3_esp
name: "L3_Verbrauch_Heute_Reset"
data: [0x03, 0x42, 0x81, 0x71]
# Restart
- platform: restart
name: "Restart_ESP"
# Um 00:00 Reset
#time:
# - platform: homeassistant
# on_time:
# - seconds: 0
# minutes: 0
# hours: 0
# then:
# - switch.toggle: reset1_esp
# - switch.toggle: reset2_esp
# - switch.toggle: reset3_esp
I donāt see even a total_daily_energy component in your yaml
You use the total energy
(counter) from your pzem004t which is stored in a internal eeprom and even continuous to count if your esp isnāt powered (your pzem004t obviously needs AC power to continue working).
You should consider using the utility_meter in ha (available via the helper ui) to calculate daily/weekly/monthlyā¦ energy
EDIT:
Just now I see the āfermentedā (google translate gone wrong?) part:
What you try is to reset the counter in the pzem004t, in general that should work (not sure about the uart commands) but you have commented out this section. Your esp82xx doesnāt have a RTC so a time source
is mandatory if you want to run the reset of the counters on_time
.
In the end it might be more useful and failure proof to just use the utility_meter in ha like mentioned before.
Thanks !!!
Many people sharing their 3 phase diagram (with 3 individual PZEMs) using single AC LINE for reference voltage for all of them. This is indeed wrong and PZEMs will report totally screwed results. If you are monitoring 3 phase system, each PZEM needs to use that LINE which has CT connected. reason for that is that 50HZ sinus between L1, L2, L3 is shifted by 120 degrees, so measurement of current and voltage will be done wrong way. Internet is full of such diagrams and explanations, so I wont be describing it here.
Well, did a short image searches for 3-phase pzem004t wiring setups but after about seeking thru over 100 images I couldnāt even spot one that showed your described wrong wiring. Most of the images show even a single pzem with AC wiring or it shows some setups with 3 pzemās but only the serial (DC) side of things.
Also I scrolled back a bit in this very long thread and also couldnāt spot one wiring that you explained
Any idea were I could get such a diagram @AlfaBravoX?
As requested
# PZEM 004T V3 NODEMCU #
# Substitutions
substitutions:
# Device Names
device_name: "pzem_nodemcu"
friendly_name: "PZEM 004T V3 NODEMCU"
esphome:
name: pzem_nodemcu
platform: ESP8266
board: nodemcuv2
wifi:
ssid:
password: XXXXXXX
power_save_mode: none
manual_ip:
static_ip: 192.168.0.105
gateway: 192.168.0.2
subnet: 255.255.255.0
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Pzem Nodemcu Fallback Hotspot"
password: "A1i5751c9OoJ"
captive_portal:
# Enable logging
logger:
level: DEBUG
baud_rate: 0
# Enable Home Assistant API
api:
ota:
# Enable Web server.
web_server:
port: 80
text_sensor:
- platform: version
name: "ESPHome Version ${friendly_name}"
# Example configuration entry
- platform: wifi_info
ip_address:
name: ESP IP Address ${friendly_name}
ssid:
name: ESP Connected ${friendly_name}
bssid:
name: ESP Connected ${friendly_name}
time:
- platform: homeassistant
id: homeassistant_time
# LCD Display
i2c:
sda: D6
scl: D5
scan: True
display:
- platform: lcd_pcf8574
id: mydisplay
dimensions: 20x4
address: 0x27
lambda: |-
it.printf(0, 0, "DAILY ENERGY:%.1f kWh", id(${device_name}_daily_energy_total).state);
it.printf(0, 1, "POW:%.1f W", id(${device_name}_power).state);
it.printf(10, 1, "AMPS:%.1f A", id(${device_name}_current).state);
it.printf(0, 2, "%.1fV", id(${device_name}_voltage).state);
it.printf(8, 2, "%.1fPF", id(${device_name}_power_factor).state);
it.printf(14, 2, "%.1fHz", id(${device_name}_frequency).state);
it.strftime(0, 3,"%H:%M %d.%m", id(homeassistant_time).now());
it.printf(12, 3, "%.1f db", id(${device_name}_wifi_signal).state);
uart:
rx_pin: D1
tx_pin: D2
baud_rate: 9600
stop_bits: 1
sensor:
- platform: pzemac
current:
name: "${friendly_name} Current"
id: "${device_name}_current"
voltage:
name: "${friendly_name} Voltage"
id: "${device_name}_voltage"
energy:
name: "${friendly_name} Energy"
id: "${device_name}_energy"
power:
name: "${friendly_name} Power"
id: "${device_name}_power"
frequency:
name: "${friendly_name} Frequency"
id: "${device_name}_frequency"
power_factor:
name: "${friendly_name} Power Factor"
id: "${device_name}_power_factor"
unit_of_measurement: pf
update_interval: 2s
- platform: total_daily_energy
name: "${friendly_name} Total Daily Energy"
id: ${device_name}_daily_energy_total
power_id: ${device_name}_power
filters:
# Multiplication factor from W to kW is 0.001
- multiply: 0.001
unit_of_measurement: kWh
icon: mdi:counter
- platform: integration
name: "${friendly_name} Energy Meter"
sensor: ${device_name}_power
time_unit: h
filters:
# Multiplication factor from W to kW is 0.001
- multiply: 0.001
unit_of_measurement: kWh
icon: mdi:counter
# Sensors with general information.
# Uptime sensor.
- platform: uptime
name: ${friendly_name} Uptime
id: "${device_name}_uptime"
# WiFi Signal sensor.
- platform: wifi_signal
name: ${friendly_name} WiFi Signal
id: "${device_name}_wifi_signal"
update_interval: 60s
binary_sensor:
- platform: status
name: "${friendly_name} Status"
status_led:
pin:
number: D4
inverted: false
this is correct connection http://puaks.blogspot.com/2021/07/cara-aman-merakit-kwh-3-phase-dengan.html
Color of wires are definitely wrong for European regulations but for explanation it is fine
consider in (EU):
Blue (in real cable must be black, grey or brown color) L1
Yellow (in real cable must be black, grey or brown color) L2
Red (in real cable must be black, greym or brown color) L3
Black (in real cable must be blue color) N
and explanation why in 3 phase monitoring we need to use reference from 3 different Lines is here: https://electronics.stackexchange.com/questions/12851/why-is-three-phase-offset-by-120-degrees#:~:text=When%20thereās%20120%C2%B0%20between,the%20return%20line%20(neutral).
yes, correct, thanks for pointing this out. updated the post.
The spec you should be looking at is voltage drop. Around 0.3V is fine. Otherwise just give your diode a try.