📜 ⬆️ ⬇️

Electricity monitoring with Eastron SDM220-Modbus meter

I want to tell you about the experience of connecting the Eastron SDM220-Modbus electric meter and receiving data from it.
In general, there is nothing complicated, the meter has a standard RS485 interface and supports the Modbus protocol.



Counter was purchased on Aliexpress .
A USB-RS485 adapter of its own production based on FT232RL and SP485 was used for the connection, but it should work with any other adapter.


')
When the power is connected, the counter shows the current settings, including the connection speed, the default speed was 2400, despite the fact that 9600 was written in the data sheet. I changed it to 9600. To do this, hold down for 3 seconds. button with a corner arrow, select the desired setting, change it and exit the settings by holding the button with circular arrows.

To receive data from the device, you need to send an 8-byte request to the virtual com port via the usb-RS485 adapter:

For example, 01-04-00-00-00-02-71-CB
Where 01 is the address of the device, visible on the meter itself, the default is 1
04 - operation code, read data register
00-00 - register number, in this register, for example, the voltage value is stored
00-02 - the number of cells to read (2 bytes)
71-CB - checksum using CRC-16 algorithm

If everything is correct, the following message will come in response:

For example, 01-04-04-43-4C-A1-C5-96-14
Where 01 is the address
04 - request response code
04 - number of response bytes
43-4C-A1-C5 - the returned float value in IEEE 754 format in reverse order, i.e. value should be C5-A1-4C-43
96-14 - CRC-16 checksum

To poll the counter, a simple program was written that allows you to poll each individual counter register and all registers in sequence.


The request is written in red, the answer is blue, the decoded value is green, the results of polling all registers are brown.
To work, you need .NET Framework 3.0, in the list you need to select the com-port to which the RS485 converter is connected

The program itself, as well as the documentation on the meter, can be downloaded on our website megadevices.com.ua

Plans for the future - screw ESP8266 and organize the transfer of data to the People's Monitoring

Source: https://habr.com/ru/post/369379/


All Articles