MODBUS RTU reading
Posted: Thu Jul 21, 2022 10:19 am
Hello everyone
I am trying to read data from slave using modbus protocol.
My slave device is Elmeasure Lg+5110 energy meter.
Modbus communication parameters are :
baud rate :-9600
mode :- modbus RTU (half duplex)
parity :- None
port :-UART PORT 2 (GPIO 16 & 17)
I am using MAX-485 IC for proper communication between esp32 and slave device which is elmeasure energymeter.
I have attached files here which i am using to send request and read data from slave.
Expected output of the code is to read value and store it in JSON as key value pair.
Output at beginning: {"Avg_Current":0.021621618419885635,"Current_R":0.0648648589849472,"Current_Y":0,"Current_B":0,"Neutral_Current":0,"Avg_VLN":76.359291076660156,"Voltage_R":229.07786560058594,"Voltage_Y":0,"Voltage_B":0,"Avg_VLL":152.64540100097656,"Voltage_RY":229.04116821289062,"Voltage_YB":0,"Voltage_BR":228.89505004882812,"Watt":13.422094345092773,"Watt_R":13.422094345092773,"Watt_Y":0,"Watt_B":0,"Frequency":50.041572570800781,"Avg_PF":0.91303509473800659,"PF_R":0.91303509473800659,"PF_Y":1,"PF_B":1,"Watt_hour":5302.0830078125,"VA_hour":5842.8515625,"VAr_Total":-6.0250649452209473,"VAr_R":-6.0250649452209473,"VAr_Y":0,"VAr_B":0,"VA_Total":14.771618843078613,"VA_R":14.771618843078613,"VA_Y":0,"VA_B":0,"VARi":0,"VARc":0,"THD_VR":1.8450759649276733,"THD_VY":0,"THD_VB":0,"THD_AR":0,"THD_AY":0,"THD_AB":0}
And i got this output for sometime but after some time period value of all parameters are interchanged with each other.
Output after sometime period :
{"Avg_Current":0,"Current_R":0.021621618419885635,"Current_Y":0.0648648589849472,"Current_B":0,"Neutral_Current":0,"Avg_VLN":0,"Voltage_R":76.359291076660156,"Voltage_Y":229.07786560058594,"Voltage_B":0,"Avg_VLL":0,"Voltage_RY":152.64540100097656,"Voltage_YB":229.04116821289062,"Voltage_BR":0,"Watt":228.89505004882812,"Watt_R":13.422094345092773,"Watt_Y":13.422094345092773,"Watt_B":0,"Frequency":0,"Avg_PF":50.041572570800781,"PF_R":0.91303509473800659,"PF_Y":0.91303509473800659,"PF_B":1,"Watt_hour":1,"VA_hour":5302.0830078125,"VAr_Total":5842.8515625,"VAr_R":-6.0250649452209473,"VAr_Y":-6.0250649452209473,"VAr_B":0,"VA_Total":0,"VA_R":14.771618843078613,"VA_Y":14.771618843078613,"VA_B":0,"VARi":0,"VARc":0,"THD_VR":0,"THD_VY":1.8450759649276733,"THD_VB":0,"THD_AR":0,"THD_AY":0,"THD_AB":0}
If anyone know about this problem or have any idea about this problem please comment and replay.
Thank you in advance.
I am trying to read data from slave using modbus protocol.
My slave device is Elmeasure Lg+5110 energy meter.
Modbus communication parameters are :
baud rate :-9600
mode :- modbus RTU (half duplex)
parity :- None
port :-UART PORT 2 (GPIO 16 & 17)
I am using MAX-485 IC for proper communication between esp32 and slave device which is elmeasure energymeter.
I have attached files here which i am using to send request and read data from slave.
Expected output of the code is to read value and store it in JSON as key value pair.
Output at beginning: {"Avg_Current":0.021621618419885635,"Current_R":0.0648648589849472,"Current_Y":0,"Current_B":0,"Neutral_Current":0,"Avg_VLN":76.359291076660156,"Voltage_R":229.07786560058594,"Voltage_Y":0,"Voltage_B":0,"Avg_VLL":152.64540100097656,"Voltage_RY":229.04116821289062,"Voltage_YB":0,"Voltage_BR":228.89505004882812,"Watt":13.422094345092773,"Watt_R":13.422094345092773,"Watt_Y":0,"Watt_B":0,"Frequency":50.041572570800781,"Avg_PF":0.91303509473800659,"PF_R":0.91303509473800659,"PF_Y":1,"PF_B":1,"Watt_hour":5302.0830078125,"VA_hour":5842.8515625,"VAr_Total":-6.0250649452209473,"VAr_R":-6.0250649452209473,"VAr_Y":0,"VAr_B":0,"VA_Total":14.771618843078613,"VA_R":14.771618843078613,"VA_Y":0,"VA_B":0,"VARi":0,"VARc":0,"THD_VR":1.8450759649276733,"THD_VY":0,"THD_VB":0,"THD_AR":0,"THD_AY":0,"THD_AB":0}
And i got this output for sometime but after some time period value of all parameters are interchanged with each other.
Output after sometime period :
{"Avg_Current":0,"Current_R":0.021621618419885635,"Current_Y":0.0648648589849472,"Current_B":0,"Neutral_Current":0,"Avg_VLN":0,"Voltage_R":76.359291076660156,"Voltage_Y":229.07786560058594,"Voltage_B":0,"Avg_VLL":0,"Voltage_RY":152.64540100097656,"Voltage_YB":229.04116821289062,"Voltage_BR":0,"Watt":228.89505004882812,"Watt_R":13.422094345092773,"Watt_Y":13.422094345092773,"Watt_B":0,"Frequency":0,"Avg_PF":50.041572570800781,"PF_R":0.91303509473800659,"PF_Y":0.91303509473800659,"PF_B":1,"Watt_hour":1,"VA_hour":5302.0830078125,"VAr_Total":5842.8515625,"VAr_R":-6.0250649452209473,"VAr_Y":-6.0250649452209473,"VAr_B":0,"VA_Total":0,"VA_R":14.771618843078613,"VA_Y":14.771618843078613,"VA_B":0,"VARi":0,"VARc":0,"THD_VR":0,"THD_VY":1.8450759649276733,"THD_VB":0,"THD_AR":0,"THD_AY":0,"THD_AB":0}
If anyone know about this problem or have any idea about this problem please comment and replay.
Thank you in advance.