Also, shouldn’t your board name be:
board: nodemcuv2
Also, shouldn’t your board name be:
board: nodemcuv2
Okay so i changed both board name and tried GPIO1,3 and RX, TX (100% identical to yours). Considering trashing this board as it just doesnt want to work… Do you have V1.0 and it works?
Its is a v3 I think, it’s unreachable so cant check.
I use the following on a v2 connected via esp home on a D1 mini
uart:
tx_pin: D1
rx_pin: D2
baud_rate: 9600
stop_bits: 1
sensor:
- platform: pzemac
current:
name: "PZEM-004T V3 Current"
voltage:
name: "PZEM-004T V3 Voltage"
energy:
name: "PZEM-004T V3 Energy"
power:
name: "PZEM-004T V3 Power"
frequency:
name: "PZEM-004T V3 Frequency"
power_factor:
name: "PZEM-004T V3 Power Factor"
state_class: "measurement"
update_interval: 60s
Your setting is for PZEM V3, not for V1.
Soo no one with v1.0 working?
Me too,
How did you solve it?
[10:20:28][W][modbus:096]: Modbus CRC Check failed! 1070!=FFFF
[10:20:28][D][pzemac:049]: PZEM AC: V=224.3 V, I=0.000 A, P=0.0 W, E=2.0 Wh, F=50.0 Hz, PF=0.00
[10:20:28][D][sensor:113]: 'voltage_ac2': Sending state 224.30000 V with 1 decimals of accuracy
[10:20:28][D][sensor:113]: 'current_ac2': Sending state 0.00000 A with 1 decimals of accuracy
[10:20:28][D][sensor:113]: 'power_ac2': Sending state 0.00000 W with 0 decimals of accuracy
[10:20:28][D][sensor:113]: 'energy_ac2_daily': Sending state 0.00000 kWh with 1 decimals of accuracy
[10:20:28][D][sensor:113]: 'energy_ac2': Sending state 0.00400 kWh with 1 decimals of accuracy
[10:20:29][D][sensor:113]: 'frequency_ac2': Sending state 50.00000 Hz with 1 decimals of accuracy
[10:20:29][D][sensor:113]: 'factor_ac2': Sending state 0.00000 with 1 decimals of accuracy
[10:20:29][D][pzemac:049]: PZEM AC: V=224.2 V, I=0.000 A, P=0.0 W, E=1.0 Wh, F=50.0 Hz, PF=0.00
[10:20:29][D][sensor:113]: 'voltage_ac5': Sending state 224.20000 V with 1 decimals of accuracy
[10:20:29][D][sensor:113]: 'current_ac5': Sending state 0.00000 A with 1 decimals of accuracy
[10:20:29][D][sensor:113]: 'power_ac5': Sending state 0.00000 W with 0 decimals of accuracy
[10:20:29][D][sensor:113]: 'energy_ac5_daily': Sending state 0.00000 kWh with 1 decimals of accuracy
[10:20:29][D][sensor:113]: 'energy_ac5': Sending state 0.00200 kWh with 1 decimals of accuracy
[10:20:29][D][sensor:113]: 'frequency_ac5': Sending state 50.00000 Hz with 1 decimals of accuracy
[10:20:29][D][sensor:113]: 'factor_ac5': Sending state 0.00000 with 1 decimals of accuracy
[10:20:38][D][pzemac:049]: PZEM AC: V=223.9 V, I=0.000 A, P=0.0 W, E=2.0 Wh, F=50.0 Hz, PF=0.00
[10:20:38][D][sensor:113]: 'voltage_ac2': Sending state 223.89999 V with 1 decimals of accuracy
[10:20:38][D][sensor:113]: 'current_ac2': Sending state 0.00000 A with 1 decimals of accuracy
[10:20:38][D][sensor:113]: 'power_ac2': Sending state 0.00000 W with 0 decimals of accuracy
[10:20:38][D][sensor:113]: 'energy_ac2_daily': Sending state 0.00000 kWh with 1 decimals of accuracy
[10:20:38][D][sensor:113]: 'energy_ac2': Sending state 0.00400 kWh with 1 decimals of accuracy
[10:20:39][D][sensor:113]: 'frequency_ac2': Sending state 50.00000 Hz with 1 decimals of accuracy
[10:20:39][D][sensor:113]: 'factor_ac2': Sending state 0.00000 with 1 decimals of accuracy
[10:20:39][D][pzemac:049]: PZEM AC: V=223.7 V, I=0.000 A, P=0.0 W, E=1.0 Wh, F=50.0 Hz, PF=0.00
[10:20:39][D][sensor:113]: 'voltage_ac5': Sending state 223.70000 V with 1 decimals of accuracy
[10:20:39][D][sensor:113]: 'current_ac5': Sending state 0.00000 A with 1 decimals of accuracy
[10:20:39][D][sensor:113]: 'power_ac5': Sending state 0.00000 W with 0 decimals of accuracy
[10:20:39][D][sensor:113]: 'energy_ac5_daily': Sending state 0.00000 kWh with 1 decimals of accuracy
[10:20:39][D][sensor:113]: 'energy_ac5': Sending state 0.00200 kWh with 1 decimals of accuracy
[10:20:39][D][sensor:113]: 'frequency_ac5': Sending state 50.00000 Hz with 1 decimals of accuracy
[10:20:39][D][sensor:113]: 'factor_ac5': Sending state 0.00000 with 1 decimals of accuracy
[10:20:45][D][sensor:113]: 'total_power': Sending state nan W with 1 decimals of accuracy
[10:20:48][W][modbus:096]: Modbus CRC Check failed! 1010!=FFFF
[10:20:48][W][modbus:096]: Modbus CRC Check failed! 9441!=FFFF
[10:20:48][W][modbus:096]: Modbus CRC Check failed! D702!=FFFF
Hi @4xvince ,
can you please elaborate if you removed R4 and R9 on ALL or just on 2 out of 3 PCEM04 (V3 i guess)?
So you do not need diodes or additional resistors?
Thanks!
Has anyone else noticed the reported voltage is high by about 10%? In my case, the actual voltage is approx 118.4 but the PZEM-004T v3 reports ~130.8. Current appears to be accurate but high voltage causes the watts to be 10% high as well. Does anyone know if this also affects the energy (kWh) reported? Imagine it does. Guess I’ll have to test with a KillaWatt to be sure. Would a simple filter in the config for voltage, energy and power help resolve the issue?
Measure the actual values with an external voltmeter and watmeter, then use linear calibration in the esphome.
What is your reference device to measure the voltage and what specs does it have?
I remember someone tested the $10 pzem004t v3 against a $2k fluke three phase power metering device and they showed the same values (inside the accuracy range of both devices: 0.5%/1%).
Used several different DVM’s and they are all very close. Here is a link to one. There’s almost no way the 130v is accurate. In the US, 130v would cause major issues.
Looks legit. From the price alone I would expect high accuracy (couldn’t find any details about it in the listing though).
Only thing I’m confused about, the thing you link doesn’t look like it’s capable of meassuring AC voltage at all (only DC up to 1700V is written as supported)
No idea about US but in europe (depending were you live) the voltage can fluctuate heavily without causing any issues. I were able to measure voltages under 200V and up to 260V in a period of one day. All appliance work normally, nothing breaks - even officially this is outside of the “allowed” specifications of the european grid.
According to a major US provider. 130v is outside of tolerance.
Accuracy for the meter linked above is 1.5% at AC voltages between 30 and 600. AC is mentioned in the description but only DC max voltage is called out because it’s a major feature.
Thanks for your help. Most likely the resistors used for the voltage divider in the PZEM-004 v3 are out of spec or it was not factory calibrated for this voltage.
I’ll have to use a filter on the voltage, kW and kWh to adjust the values using other known good measurement tools.
Something for others to keep in mind if using this device on typical 120v. Voltage readings could be off by 10%.
Hey guys, I’m sorry if the question is dumb, I’m a complete noob. I read the whole thread but I didn’t understand this… I want to monitor two different appliances (washing machine and dryer) with two pzem-004t connected to an ESP32 (wemos lolin32 lite). I have managed to connect the first pzem and to read the data from it through esphome, but I really don’t understand how to connect the second one. I read it has to be connected in parallel, but I don’t know how it is managed at software level… Would you help me please? Thank you!!
Use the PZEM004T-Master.exe software to change the address on the second module. Then you connect them in parallel
Thank you! What about the esp configuration in esphome?
In the esp configuration, add two PZEM004T sensors and add an address to each.
For example:
address: 1
......
address: 2
......
It is also possible to set the PZEM address using ESPHome, with the following code:
esphome:
...
on_boot:
## configure controller settings at setup
## make sure priority is lower than setup_priority of modbus_controller
priority: -100
then:
- lambda: |-
auto new_address = 0x03;
if(new_address < 0x01 || new_address > 0xF7) // sanity check
{
ESP_LOGE("ModbusLambda", "Address needs to be between 0x01 and 0xF7");
return;
}
esphome::modbus_controller::ModbusController *controller = id(pzem);
auto set_addr_cmd = esphome::modbus_controller::ModbusCommandItem::create_write_single_command(
controller, 0x0002, new_address);
delay(200) ;
controller->queue_command(set_addr_cmd);
ESP_LOGI("ModbusLambda", "PZEM Addr set");
modbus:
send_wait_time: 200ms
id: mod_bus_pzem
modbus_controller:
- id: pzem
## the current device addr
address: 0x1
modbus_id: mod_bus_pzem
command_throttle: 0ms
setup_priority: -10
update_interval: 30s
Here is code to add templates “Today energy consumption” and “Yesterday energy consumption” in kWh
Edit “hours” “minutes” “seconds” with your requirements.
uart:
id: PZEM
rx_pin: RX
tx_pin: TX
baud_rate: 9600
modbus:
sensor:
- platform: pzemac
current:
name: "PZEM-004T V3 Current"
voltage:
name: "PZEM-004T V3 Voltage"
energy:
name: "PZEM-004T V3 Energy Today"
id: energy_today
unit_of_measurement: kWh
accuracy_decimals: 3
filters:
- multiply: 0.001
power:
name: "PZEM-004T V3 Power"
power_factor:
name: "PZEM-004T V3 Power Factor"
update_interval: 30s
- platform: template
name: "PZEM-004T V3 Energy Yesterday"
id: set_yesterday
unit_of_measurement: kWh
accuracy_decimals: 3
icon: mdi:lightning-bolt
switch:
- platform: uart
uart_id: PZEM
id: reset_PZEM
name: "PZEM-004T V3 Energy Reset"
data: [0x01, 0x42, 0x80, 0x11]
time:
- platform: homeassistant
on_time:
- seconds: 0
minutes: 0
hours: 23
then:
- sensor.template.publish:
id: set_yesterday
state: !lambda |-
return id(energy_today).state;
- switch.toggle: reset_PZEM