Difference between revisions of "Component: Energy Monitor (PZEM-004T) (Electrical)"

From Flowcode Help
Jump to navigationJump to search
(Created page with "{| style="width:50%" |- | width="20%" style="color:gray;" | Author | Matrix Ltd. |- | width="20%" style="color:gray;" | Version | 1.0 |- | width="20%" style="color:gra...")
 
Line 28: Line 28:
  
 
''<span style="color:red;">No additional examples</span>''
 
''<span style="color:red;">No additional examples</span>''
 +
 +
  
 
==Macro reference==
 
==Macro reference==
Line 55: Line 57:
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
===ReadAnalogInput===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadAnalogInput'''
 
|-
 
| colspan="2" | This command requests the analogue input register values starting from the start RegAddress and going through to RegAddress plus RegCount. Returns 0 for success, 1 for CRC fail and 255 for no reply.&nbsp;
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | SlaveID
 
|-
 
| colspan="2" | The ID of the MODBUS slave&nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | RegAddress
 
|-
 
| colspan="2" | Input Address: 0=10001, 1=10002, 2=10003, ...&nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | RegCount
 
|-
 
| colspan="2" | Number of consecutive inputs to read, starting from RegAddress&nbsp;
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
|}

Revision as of 13:00, 18 July 2023

Author Matrix Ltd.
Version 1.0
Category Electrical


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

No additional examples


Macro reference

Initialise

Fc9-comp-macro.png Initialise
Starts up the UART to allow communications. Also, checks if PZEM-004T is detected. Returns 0 if detected or 255 if not detected.  
Fc9-u8-icon.png - BYTE Return


ReadAlarmStatus

Fc9-comp-macro.png ReadAlarmStatus
65535 = Overpower alarm triggered. 0 = Overpower alarm not triggered. 
Fc9-u16-icon.png - UINT Return


ReadCurrent

Fc9-comp-macro.png ReadCurrent
Read what the current draw is. Resolution: 0.001A Measurement accuracy: 0.5% 
Fc9-f32-icon.png - FLOAT Return


ReadEnergy

Fc9-comp-macro.png ReadEnergy
Read active energy value. Resolution: 1Wh Measurement accuracy: 0.5% 
Fc9-f32-icon.png - FLOAT Return


ReadFrequency

Fc9-comp-macro.png ReadFrequency
Reads the frequency of the mains 
Fc9-f32-icon.png - FLOAT Return


ReadPower

Fc9-comp-macro.png ReadPower
Read active power. Starting measure power: 0.4W Resolution: 0.1W 
Fc9-f32-icon.png - FLOAT Return


ReadPowerAlarmThreshold

Fc9-comp-macro.png ReadPowerAlarmThreshold
Reads the power alarm threshold in watts 
Fc9-u16-icon.png - UINT Return


ReadPowerFactor

Fc9-comp-macro.png ReadPowerFactor
Read power factor Resolution: 0.01 Measurement accuracy: 1% 
Fc9-f32-icon.png - FLOAT Return


ReadVoltage

Fc9-comp-macro.png ReadVoltage
Read voltage. Measuring range:80~260V Resolution: 0.1V Measurement accuracy: 0.5% 
Fc9-f32-icon.png - FLOAT Return


ResetEnergy

Fc9-comp-macro.png ResetEnergy
Reset the energy value 
Fc9-u8-icon.png - BYTE Return


SetPowerThresholdLevel

Fc9-comp-macro.png SetPowerThresholdLevel
Sets the power alarm threshold in watts 
Fc9-u16-icon.png - UINT PowerThresholdValue
Reg addreess high of alarm threshold 
Fc9-u8-icon.png - BYTE Return


Property reference

Fc9-prop-icon.png Properties
Fc9-conn-icon.png UART Properties
Fc9-type-16-icon.png Channel
UART Channel selector Software channels are bit banged using generic I/O pins but are not as reliable as hardware channels. Hardware channels use the selected peripheral on-board the target microcontroller. 
Fc9-type-5-icon.png TX
Pin to be used for Transmit data 
Fc9-type-5-icon.png RX
Pin to be used for Receive data 
Fc9-type-16-icon.png Baud Options
Baud rate option selector 
Fc9-type-14-icon.png Baud Rate
 
Fc9-type-16-icon.png Bus
Specifies the bus mode being used, RS232 allows you to connect a single master node to a single slave node. RS485 allows you to connect a single master node to multiple slave nodes. 
Fc9-conn-icon.png Modbus Properties
Fc9-type-21-icon.png Receive Buffer Size
Maximum number of bytes the receive buffer can hold 
Fc9-type-21-icon.png Slave ID Bytes
Number of bytes used when passing a slave ID, usually 1 but sometimes 2 
Fc9-type-21-icon.png Silent Interval
Configures how much time to wait after each master modbus command before another command can be sent. A silent interval of 60ms minimum is required in order to guarentee successful reception of the next transmission. 0=No Delay 60 = 60mS - Default Range : 0 - 65535 
Fc9-type-21-icon.png UART Receive Timeout
Amount of time to wait before timing out when listening for a slave's response. Range: 0 - 255. 0 = Don't Wait 1 - 254 = X ms 255 = Wait Forever 
Fc9-type-21-icon.png Receive Timeout Count
Number of timeouts in a row to wait for until we decide the slave is not responding or finished responding to a message. Range: 0 - 255 0 = First Timeout Only 1 = First Timeout + 1 2 = First Timeout + 2 
Fc9-conn-icon.png Simulation Properties
Fc9-type-10-icon.png Label
A text label to appear on the Modbus panel object. 
Fc9-type-7-icon.png Scope Traces
Selects if the scope traces are automatically added to the data recorder window or not. Simulation - draws an approximation of the UART data onto the scope trace. ICT - sets up the scope trace for incoming data and adds UART packet decoding at the correct BAUD. 
Fc9-type-7-icon.png Console Data
Selects if the console data is automatically generated or not 
Fc9-type-21-icon.png Console Columns
Number of characters that can be displayed on a single line of the console. 
Fc9-type-16-icon.png Data Source
Simulation data source used to allow the component to connect to various remote devices Nothing - Simulation data is ignored COM port - Routes the communication data to and from a physical or virtual COM port API - Routes the communication data via a data API component on the Panel.