Component: Energy Monitor (PZEM-004T) (Electrical)
Author | Matrix Ltd. |
Version | 1.0 |
Category | Electrical |
Contents
Energy Monitor (PZEM-004T) component
The PZEM-004T module is used for measuring AC voltage, current, active power, frequency, power factor & overcurrent. Resetable active energ and the overpower level can be set and monitored.
Component Source Code
Please click here to download the component source project: FC_Comp_Source_Energy_Monitor_PZEM-004T.fcfx
Please click here to view the component source code (Beta): FC_Comp_Source_Energy_Monitor_PZEM-004T.fcfx
Detailed description
No detailed description exists yet for this component
Examples
Note if there is a communication issue then just 9's will be returned!
Example program that uses a PZEM-004T energy monitor to monitor mains voltage, current, frequency, power factor, energy, and over specified power alarm. The alarm threshold is set within properties. Initialiasion returns 0 if PZEM-004T is detected or 255 if it is not. Values are sent to the ESP32 TTGO display which uses a ST7789v1 GLCD.
Macro reference
Initialise
![]() |
Initialise |
Starts up the UART to allow communications. Also, checks if PZEM-004T is detected. Returns 0 if detected or 255 if not detected. | |
![]() |
Return |
ReadAlarmStatus
![]() |
ReadAlarmStatus |
65535 = Overpower alarm triggered. 0 = Overpower alarm not triggered. | |
![]() |
Return |
ReadCurrent
![]() |
ReadCurrent |
Read what the current draw is. Resolution: 0.001A Measurement accuracy: 0.5% | |
![]() |
Return |
ReadEnergy
![]() |
ReadEnergy |
Read active energy value. Resolution: 1Wh Measurement accuracy: 0.5% | |
![]() |
Return |
ReadFrequency
![]() |
ReadFrequency |
Reads the frequency of the mains | |
![]() |
Return |
ReadPower
![]() |
ReadPower |
Read active power. Starting measure power: 0.4W Resolution: 0.1W | |
![]() |
Return |
ReadPowerAlarmThreshold
![]() |
ReadPowerAlarmThreshold |
Reads the power alarm threshold in watts | |
![]() |
Return |
ReadPowerFactor
![]() |
ReadPowerFactor |
Read power factor Resolution: 0.01 Measurement accuracy: 1% | |
![]() |
Return |
ReadVoltage
![]() |
ReadVoltage |
Read voltage. Measuring range:80~260V Resolution: 0.1V Measurement accuracy: 0.5% | |
![]() |
Return |
ResetEnergy
![]() |
ResetEnergy |
Reset the energy value | |
![]() |
Return |
SetPowerThresholdLevel
![]() |
SetPowerThresholdLevel |
Sets the power alarm threshold in watts | |
![]() |
PowerThresholdValue |
Reg addreess high of alarm threshold | |
![]() |
Return |