What are the dimensions of closed ct clamp ? Checked couple of Ali sellers, but none seem to provide that
The coil or the clamp? I would say both have at least 1cm of internal diameter - so plenty to measure typical wires down to 0 AWG (~8mm diameter)
Just a little nugget of info for people trying to run more than two PZEM004t v3. I have never run more than 2 in the past and always powered them off 5v. After trying to put four together on the same uart, they all would stop reporting data, or just the last one 0x04 would continue to report data and all the others would quit. It was random, it seemed as to which it would do. I found several posts involving modding the pzem with resistors or diodes, but generally I try to avoid that. My 5v external PS was slightly adjustable, and I dropped it to 4.5v, suddenly the 3rd pzem started to report properly. Then I cut the 5v wire to the harness and supplied 3.3v from the mini board itself and all four came online reporting as 1s intervals with no issue. So the no mod answer for me it seems is, drop the voltage to 3.3v.
Good morning, can you help me in programming my pzem v3.0.
I did several tests and in the end I programmed them with the Windows program, that is, I have to change the address and then put them on esp32.
Only 1 device works for me while if I put more than 1 they don’t work, I don’t use any diodes or resistors, I haven’t made any changes to the pzem, I power the pzem with the 3.3v of the esp32.
I’m waiting for his help, here’s my code:
esphome:
name: controll-home
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging toglere level e hardvare
logger:
# Enable Home Assistant API
api:
encryption:
key: !secret API_key
ota:
password: !secret OTA_Password
wifi:
networks:
- ssid: !secret wifi_ssid_1
password: !secret wifi_password_1
priority: 2.0
- ssid: !secret wifi_ssid_2
password: !secret wifi_password_2
priority: 1.0
- ssid: !secret wifi_ssid_3
password: !secret wifi_password_3
priority: 0.0
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "CONTROL HOME"
password: !secret wifi_ap
web_server:
port: 80
captive_portal:
# ___________________________________________________ DS18B20________________________________________________
#ESP32 (GPIO5)
dallas:
pin: GPIO5
update_interval: 5s
#_____________________________________________________PZEM-004T___________________________________________________
# ESP32 (TX-GPIO18 + RX-GPIO19)
uart:
- id: ubus1
tx_pin: GPIO18
rx_pin: GPIO19
baud_rate: 9600
stop_bits: 1
sensor:
- platform: pzemac
id: pzemac
address: 1
current:
name: "CORRENT"
accuracy_decimals: 2
# voltage:
# name: "VOLTAGE"
# accuracy_decimals: 2
power:
name: "POWER"
unit_of_measurement: W
accuracy_decimals: 2
id: potenza_zia
# frequency:
# name: "FREQ"
# unit_of_measurement: Hz
# accuracy_decimals: 2
# power_factor:
# name: "POWER FACTOR"
# accuracy_decimals: 2
energy:
name: "ENERGY"
unit_of_measurement: Wh
accuracy_decimals: 1
id: energy
update_interval: 5s #7s
- platform: template
name: "DAILY ENERGY"
unit_of_measurement: "kWh"
accuracy_decimals: 2
update_interval: 15s #11s
icon: mdi:counter
lambda: return (( (id(energy).state)/1000.0));
- platform: dallas
name: "TEMP HOME"
address: "0xcf041780cf3cff28"
id: temp_home
button:
- platform: template
name: "RESET kWh"
icon: "mdi:radiobox-marked"
on_press:
then:
- delay: 1s
- pzemac.reset_energy: pzemac
Here is my code for the pzems
sensor:
- platform: pzemac
id: pzemac_1
modbus_id: mod_bus_pzem1
address: 0x01
current:
name: 'Pumphouse Mains Current'
accuracy_decimals: 3
filters:
voltage:
name: 'Pumphouse Mains Voltage'
accuracy_decimals: 1
power:
name: 'Pumphouse Mains Power'
accuracy_decimals: 1
unit_of_measurement: 'W'
filters:
energy:
name: 'Pumphouse Mains Energy'
filters:
- multiply: 0.001 #converts to kwh
unit_of_measurement: 'kWh'
accuracy_decimals: 3
frequency:
name: 'Pumphouse Mains Frequency'
accuracy_decimals: 1
power_factor:
name: 'Pumphouse Mains Power Factor'
accuracy_decimals: 2
update_interval: never
- platform: pzemac
id: pzemac_2
modbus_id: mod_bus_pzem1
address: 0x02
current:
name: 'Jet Pump Current'
accuracy_decimals: 3
filters:
# - multiply: .5
voltage:
name: 'Jet Pump Voltage'
accuracy_decimals: 1
power:
name: 'Jet Pump Power'
accuracy_decimals: 1
unit_of_measurement: 'W'
filters:
# - multiply: .5 # Doubles the current reading
energy:
name: 'Jet Pump Energy'
# convert to kWh
filters:
# - multiply: .5 # Doubles the current reading
- multiply: 0.001
unit_of_measurement: 'kWh'
accuracy_decimals: 3
frequency:
name: 'Jet Pump Frequency'
accuracy_decimals: 1
power_factor:
name: 'Jet Pump Power Factor'
accuracy_decimals: 2
update_interval: never
- platform: pzemac
id: pzemac_3
modbus_id: mod_bus_pzem1
address: 0x03
current:
name: 'Well Head Current'
accuracy_decimals: 3
filters:
# - multiply: .5
voltage:
name: 'Well Head Voltage'
accuracy_decimals: 1
power:
name: 'Well Head Power'
accuracy_decimals: 1
unit_of_measurement: 'W'
filters:
# - multiply: .5 # Doubles the current reading
energy:
name: 'Well Head Energy'
# convert to kWh
filters:
# - multiply: .5 # Doubles the current reading
- multiply: 0.001
unit_of_measurement: 'kWh'
accuracy_decimals: 3
frequency:
name: 'Well Head Frequency'
accuracy_decimals: 1
power_factor:
name: 'Well Head Power Factor'
accuracy_decimals: 2
update_interval: never
- platform: pzemac
id: pzemac_4
modbus_id: mod_bus_pzem1
address: 0x04
current:
name: 'Reverse Osmosis Current'
accuracy_decimals: 3
filters:
# - multiply: .5
voltage:
name: 'Reverse Osmosis Voltage'
accuracy_decimals: 1
power:
name: 'Reverse Osmosis Power'
accuracy_decimals: 1
unit_of_measurement: 'W'
filters:
# - multiply: .5 # Doubles the current reading
energy:
name: 'Reverse Osmosis Energy'
# convert to kWh
filters:
# - multiply: .5 # Doubles the current reading
- multiply: 0.001
unit_of_measurement: 'kWh'
accuracy_decimals: 3
frequency:
name: 'Reverse Osmosis Frequency'
accuracy_decimals: 1
power_factor:
name: 'Reverse Osmosis Power Factor'
accuracy_decimals: 2
update_interval: never
Good morning,
Excuse me but how did you connect them to the power supply and pins of resistors or diodes between esp32 and pzem? How did the pzem address change?
while the part that concerns uart?
I await your response
uart:
- id: ubus1
tx_pin: GPIO18
rx_pin: GPIO19
baud_rate: 9600
stop_bits: 1
This is on an esp8266
uart:
id: uart_1
rx_pin: RX
tx_pin: TX
baud_rate: 9600
data_bits: 8
stop_bits: 1
modbus:
- id: mod_bus_pzem1
send_wait_time: 250ms
uart_id: uart_1
RE: “For PZEM use 5V from D1 mini and Tx, Rx use 5V / 3.3V level converter”
and wiring Level Shifters/converters:
For Clarity:
- Connect the D1 Mini TX(@3v) pin directly to the PZEM Rx(@5v) pin. Lower voltage to higher is OK here.
Now the PZEM TX pin which is at 5v needs to be dropped to the lower voltage of 3.3v for the D1 mini’s RX pin which is at 3v. The “Logic Level Shifter” manages this.
- Connect the PZEM TX pin to the Logic Level Shifters High Side(5v) then connect the corresponding pin on the “shifters” LOW side(3v) to the D1 Mini’s RX, again at 3.3v.
Note: The “Shifters” High side needs to be connected to a 5v power source and GND and the Low side needs to be connect to a 3v power source and GND. Since the High and Low GND are connected, you “should” only need to connect to one of the two GND pads on the Shifter.
more simple way is tasmota way. I have D1 mini and ac/dc 5V direct to pzem no resistor mode,works 1 year no problems. Resistor mode 3.3V pzems dont like in my testing.
If you have 1 pzem no problem, If you have 3phase must have diodes BAT58 diode
This is very good work.
I’ve been planning on doing something similar for the electrical cabinet for all the separate lines of the house in addition to my specific point of attention measurements like home theater, aquarium or studio.
As you might have seen from my example, I’m not using the modbus thing.
Were you ever be able to figure out what the problem was about having to use 5 devices instead of 6? Was it a some sort of cross interference of power or data lines?
Did you try a different power supply? Are you using a DIY power supply or is it a ready made power module? Maybe it is a switched mode power supply issue and a linear power supply with proper regulation might do the trick? Did you try to power all 6 of the modules with sparate power supplies for debugging purposes?
When using for power measurement of each saparate circuit from the main electrical cabinet, using modbus is a must. I mean one ESP-01 per 5 PZEM modules is still not bad but one should be able to use a single controller for many PZEM modules as intended using the modbus.
Not always true. If monitoring current on the whole house, do not use the neutral. 2 or 3 phases can share 1 neutral wire, and for example if all 3 live phases have an equal resistive load, the neutral at the utility box will not have any current. None.
You can use the neutral on a single phase appliance, as the current on the live will mirror the neutral then, but i would just get in the habit of using the live for current monitoring to avoid false readings for shared neutrals in some branch circuits and sub panels.
Sorry to ask a silly question, as I have near zero knowledge of electronics/circuits/etc.
Based on what I’ve read in this thread, is it safe to say that the PZEM-004Tv3 cannot be used unless you connect it directly to an A/C power source?
I was hoping to use it to measure only amperage (load). Because of my lack of knowledge, I did not intend to hook it up directly to the A/C source on my main panel.
As per my understanding, It requirs the AC side of the connections (Phase and Neutral) active to measure the readings.
Yes, that’s due to the fact how AC power metering works.
If you are only interested in current and don’t need power readings you can go with a CT coil/clamp
2 years later this works great. I don’t have a display, but the measurements works.
Also my PZEM module had V1 written on the board, but on the instruction that come with appeared that includes frequency and power factor. The original V1 didn’t included those.
So for who like me is buying modules form Ali in 2024 and come V1 labeled, they are not. Configure them as V3 and they’ll work.
I would like to share my pzem implementation as well. It is modified PZEM-004T version which is based on the modification done by the user HWCave from Github. TheHWcave/Peacefair-PZEM-004T-: reverse-engineered schematics and interface software (github.com).
The modification and resulting PZEM-004T are following:
- It can measure from 0V-266V. I’ll be using a fourth power supply in our home to power the boards that is the inverter-based backup system because we have occasional load shedding in my location.
- It is given some protection on input via four resistors in series instead of two tiny smd resistors which are borderline for 230V continuous voltage measurement and may have shorter lifespan.
- It has short circuit protection for each phase and neutral via fast blown fuses.
- It has isolation between PZEM boards and ESP32 power supplies via a separate 12V power supply especially for PZEM IC which is fully isolated with normal power supply without SMPS BS. ESP32 side is powered by Hi-link 3W supply.
With that modification now I can measure from 0V to 266V, and I can power them with a separate power source. I have tested these modules, and they run fine with 3.3V supply via ESP32.
Let’s see how they work in long run.
Hi,
I’d like to use PZEM004T 100A V1.0 for power metering with NodeMCU in ESPHome.
I have connected it but no data received. Only one led blinks on sensor.
Here is my code. What is wrong with this?
uart:
tx_pin: TX
rx_pin: RX
baud_rate: 9600
sensor:
- platform: pzem004t
current:
name: "PZEM-004T Current"
voltage:
name: "PZEM-004T Voltage"
power:
name: "PZEM-004T Power"
energy:
name: "PZEM-004T Energy"
update_interval: 5s
There is not anything interesting in log:
[15:53:23][I][app:100]: ESPHome version 2024.9.2 compiled on Dec 7 2024, 15:15:19
[15:53:23][C][wifi:600]: WiFi:
[15:53:23][C][wifi:428]: Local MAC: 48:55:19:F7:19:A2
[15:53:23][C][wifi:433]: SSID: [redacted]
[15:53:23][C][wifi:436]: IP Address: 192.168.100.71
[15:53:23][C][wifi:439]: BSSID: [redacted]
[15:53:23][C][wifi:441]: Hostname: 'nodemcu-test2'
[15:53:23][C][wifi:443]: Signal strength: -44 dB ▂▄▆█
[15:53:23][C][wifi:447]: Channel: 8
[15:53:23][C][wifi:448]: Subnet: 255.255.255.0
[15:53:23][C][wifi:449]: Gateway: 192.168.100.1
[15:53:23][C][wifi:450]: DNS1: 37.44.16.254
[15:53:23][C][wifi:451]: DNS2: 37.44.17.254
[15:53:23][C][logger:185]: Logger:
[15:53:23][C][logger:186]: Level: DEBUG
[15:53:23][C][logger:188]: Log Baud Rate: 0
[15:53:23][C][logger:189]: Hardware UART: UART0
[15:53:23][C][uart.arduino_esp8266:118]: UART Bus:
[15:53:23][C][uart.arduino_esp8266:119]: TX Pin: GPIO1
[15:53:23][C][uart.arduino_esp8266:120]: RX Pin: GPIO3
[15:53:23][C][uart.arduino_esp8266:122]: RX Buffer Size: 256
[15:53:23][C][uart.arduino_esp8266:124]: Baud Rate: 9600 baud
[15:53:23][C][uart.arduino_esp8266:125]: Data Bits: 8
[15:53:23][C][uart.arduino_esp8266:126]: Parity: NONE
[15:53:23][C][uart.arduino_esp8266:127]: Stop bits: 1
[15:53:23][C][uart.arduino_esp8266:129]: Using hardware serial interface.
[15:53:23][C][pzem004t:119]: PZEM004T:
[15:53:23][C][pzem004t:120]: Voltage 'PZEM-004T Voltage'
[15:53:23][C][pzem004t:120]: Device Class: 'voltage'
[15:53:23][C][pzem004t:120]: State Class: 'measurement'
[15:53:23][C][pzem004t:120]: Unit of Measurement: 'V'
[15:53:23][C][pzem004t:120]: Accuracy Decimals: 1
[15:53:23][C][pzem004t:121]: Current 'PZEM-004T Current'
[15:53:23][C][pzem004t:121]: Device Class: 'current'
[15:53:23][C][pzem004t:121]: State Class: 'measurement'
[15:53:23][C][pzem004t:121]: Unit of Measurement: 'A'
[15:53:23][C][pzem004t:121]: Accuracy Decimals: 2
[15:53:23][C][captive_portal:089]: Captive Portal:
[15:53:23][C][web_server:145]: Web Server:
[15:53:23][C][web_server:146]: Address: nodemcu-test2.local:80
[15:53:23][C][mdns:116]: mDNS:
[15:53:23][C][mdns:117]: Hostname: nodemcu-test2
[15:53:23][C][esphome.ota:073]: Over-The-Air updates:
[15:53:23][C][esphome.ota:074]: Address: nodemcu-test2.local:8266
[15:53:23][C][esphome.ota:075]: Version: 2
[15:53:23][C][esphome.ota:078]: Password configured
[15:53:23][C][safe_mode:018]: Safe Mode:
[15:53:23][C][safe_mode:019]: Boot considered successful after 60 seconds
[15:53:23][C][safe_mode:021]: Invoke after 10 boot attempts
[15:53:23][C][safe_mode:022]: Remain in safe mode for 300 seconds
[15:53:23][C][api:139]: API Server:
[15:53:23][C][api:140]: Address: nodemcu-test2.local:6053
[15:53:23][C][api:142]: Using noise encryption: YES
How?
if you are trying this in your test bench make sure the Power Side (Phase & Neutral wires) is also connected to respective terminals. Without that, you will not get any reading. In order to identify the current measurement, you should pass through only one wire of your load. Also as orange-assistant has already highlighted, share your schematic + images of your connection with more details if you are looking for help.
Caution:!!! You are working with high voltage and current on the AC side of this device.