From what I gather the pzems are quite voltage sensitive. One works while connected to my pc usb, while doesn’t work when connected to ipad charger
From your setup, I suggest firstly to disable the logger by setting baud_rate to 0. Then using the rx and tx hardware uart pins gpio1 and 3. I will have time to check the same setup tonight and will inform more.
I have also added two pzems in parallel by changing their addresses with tasmota. The cabling is described in this post:
And now I have a 2 phase system and all working under esphome.
I did not use the 1K mod, as it has been stated by the CEO that the 8266’s are 5V tolerant.
I use the pzem004t v2 (esphome pzem004t component) and a pzem004t v3 (esphome pzemac component) successfully with esphome. One of them is connected to a esp m3 and the other to a node mcu. But they also work vice versa.
No level shifting, no resistors! just a 5v source for the pzem004t and the esp (the esp m3 uses a ams1117 to get the voltage down to 3.3v). I use the software serial on both esp’s.
I finally follow your comments and powered PZEM and nodemcu with transformer to 5V, PZEM without resistor and your script with stop bits to 1 and It works fine!!! Finally
INFO Successfully connected to ac_pzem.local
[17:14:46][I][app:100]: ESPHome version 1.14.3 compiled on Nov 23 2019, 17:13:57
[17:14:47][C][wifi:415]: WiFi:
[17:14:47][C][wifi:283]: SSID:
[redacted]
[17:14:47][C][wifi:284]: IP Address: 192.168.15.80
[17:14:47][C][wifi:286]: BSSID: [redacted]
[17:14:48][C][wifi:287]: Hostname: 'ac_pzem'
[17:14:48][C][wifi:291]: Signal strength: -54 dB ▂▄▆█
[17:14:48][C][wifi:295]: Channel: 1
[17:14:48][C][wifi:296]: Subnet: 255.255.255.0
[17:14:48][C][wifi:297]: Gateway: 192.168.15.1
[17:14:48][C][wifi:298]: DNS1: 192.168.15.1
[17:14:48][C][wifi:299]: DNS2: 212.33.225.212
[17:14:48][C][uart:140]: UART Bus:
[17:14:48][C][uart:142]: TX Pin: GPIO1
[17:14:48][C][uart:145]: RX Pin: GPIO3
[17:14:48][C][uart:147]: Baud Rate: 9600 baud
[17:14:48][C][uart:148]: Stop bits: 1
[17:14:48][C][uart:150]: Using hardware serial interface.
[17:14:48](Message skipped because it was too big to fit in TCP buffer - This is only cosmetic)
[17:14:48][C][logger:175]: Logger:
[17:14:48][C][api:095]: API Server:
[17:14:48](Message skipped because it was too big to fit in TCP buffer - This is only cosmetic)
[17:16:25][I][ota:046]: Boot seems successful, resetting boot loop counter.
I have no idea how to do that sorry
But it is a serial command from the console: ModuleAddress 1 changes the currently connected single pzem004’s address to 192.168.1.1. And this can work for up to 3 pzems. You use the addresses 1,2 and 3.
Sorry bit of an off topic question but I’m stuck for answers…
I’ve a question on how you connect the reference wires to live and neutral on the pzem-016… I was thinking I’d just take the live and neutral from a power socket next to my utility board… or do I specifically have to take the live from before all the loads and the neutral from after all the loads?
yes I watched a youtube video and the chap pointed out that wiring the reference wires after the detection coil is no big deal… just means it records its own drain which is only a few milliamps so no worries there
INFO Reading configuration /config/esphome/pzem_004t.yaml...
INFO Starting log output from 192.168.5.239 using esphome API
INFO Connecting to 192.168.5.239:6053 (192.168.5.239)
INFO Successfully connected to 192.168.5.239
[16:54:21][I][app:100]: ESPHome version 1.14.3 compiled on Mar 17 2020, 15:26:41
[16:54:21][C][wifi:415]: WiFi:
[16:54:21][C][wifi:283]: SSID: [redacted]
[16:54:21][C][wifi:284]: IP Address: 192.168.5.239
[16:54:21][C][wifi:286]: BSSID: [redacted]
[16:54:21][C][wifi:287]: Hostname: 'pzem_004t'
[16:54:21][C][wifi:291]: Signal strength: -71 dB ▂▄▆█
[16:54:21][C][wifi:295]: Channel: 11
[16:54:21][C][wifi:296]: Subnet: 255.255.255.0
[16:54:21][C][wifi:297]: Gateway: 192.168.5.1
[16:54:22][C][wifi:298]: DNS1: 192.168.5.1
[16:54:22][C][wifi:299]: DNS2: (IP unset)
[16:54:22][C][uart:140]: UART Bus:
[16:54:22][C][uart:142]: TX Pin: GPIO4
[16:54:22][C][uart:145]: RX Pin: GPIO5
[16:54:22][C][uart:147]: Baud Rate: 9600 baud
[16:54:22][C][uart:148]: Stop bits: 1
[16:54:22][C][uart:152]: Using software serial
[16:54:22][C][modbus:096]: Modbus:
[16:54:22][E][uart:390]: Invalid stop bits: Integration requested stop_bits 2 but you have 1!
[16:54:22][C][logger:175]: Logger:
[16:54:22][C][logger:176]: Level: DEBUG
[16:54:22][C][logger:177]: Log Baud Rate: 115200
[16:54:22][C][logger:178]: Hardware UART: UART0
[16:54:22][C][pzemac:061]: PZEMAC:
[16:54:22][C][pzemac:062]: Address: 0x01
[16:54:22][C][pzemac:063]: Voltage 'PZEM-004T V3 Voltage'
[16:54:22][C][pzemac:063]: Unit of Measurement: 'V'
[16:54:22][C][pzemac:063]: Accuracy Decimals: 1
[16:54:22][C][pzemac:063]: Icon: 'mdi:flash'
[16:54:22][C][pzemac:065]: Accuracy Decimals: 1
[16:54:22][C][pzemac:065]: Icon: 'mdi:power'
[16:54:22][C][pzemac:066]: Frequency 'PZEM-004T V3 Frequency'
[16:54:22][C][pzemac:066]: Unit of Measurement: 'hz'
[16:54:22][C][pzemac:066]: Accuracy Decimals: 1
[16:54:22][C][pzemac:066]: Icon: 'mdi:current-ac'
[16:54:22](Message skipped because it was too big to fit in TCP buffer - This is only cosmetic)
[16:54:22](Message skipped because it was too big to fit in TCP buffer - This is only cosmetic)
[16:54:22](Message skipped because it was too big to fit in TCP buffer - This is only cosmetic)
[16:54:22](Message skipped because it was too big to fit in TCP buffer - This is only cosmetic)
[16:54:22][C][captive_portal:169]: Captive Portal:
[16:54:22][C][ota:029]: Over-The-Air Updates:
[16:54:22][C][ota:030]: Address: 192.168.5.239:8266
[16:54:22][C][ota:032]: Using Password.
[16:54:22][C][api:095]: API Server:
[16:54:22][C][api:096]: Address: 192.168.5.239:6053
[16:54:42][D][pzemac:046]: PZEM AC: V=130.0 V, I=0.000 A, P=0.0 W, F=60.0 Hz, PF=0.00
[16:54:42][D][sensor:092]: 'PZEM-004T V3 Voltage': Sending state 130.00000 V with 1 decimals of accuracy
[16:54:42][D][sensor:092]: 'PZEM-004T V3 Current': Sending state 0.00000 A with 3 decimals of accuracy
[16:54:42][D][sensor:092]: 'PZEM-004T V3 Power': Sending state 0.00000 W with 1 decimals of accuracy
[16:54:42][D][sensor:092]: 'PZEM-004T V3 Frequency': Sending state 60.00000 hz with 1 decimals of accuracy
[16:54:43][D][sensor:092]: 'PZEM-004T V3 Power Factor': Sending state 0.00000 with 2 decimals of accuracy