/SDM120-Modbus

An Arduino library for Multi-functional Energy Meter SDM120 Modbus

Primary LanguageC++

SDM120 Modbus Library

This is an Arduino Library for the multi-functional energy meter SDM120 Modbus.

Index

Pre-requisite

Installation

Windows

  • Open cmd, enter
cd %userprofile%\Documents\Arduino\libraries &&
git clone https://github.com/ngharry/SDM120-Modbus

to download SDM120 Modbus library.

  • Wait until the downloading process finishes.

Linux

[TODO] Add tutorial for Linux here.

How to

Convert Float to Array of Bytes (IEEE 754)

See examples/FloatToBytes.

Convert Array of Bytes to Float (IEEE 754)

See examples/BytesToFloat.

Construct Commands

See examples/ConstructCommands.

Get Raw Data from SDM120 Modbus

See examples/GetRawData.

Get all Processed Data from SDM120 Modbus

See examples/GetData.

Error Codes

HEX DEC Name Description
0x00 0 STATUS_ERROR General errors
0x01 1 STATUS_SUCCESS Function runs successfully, no errors
0x02 2 ERR_READ_RS485 No data read from RS485 communication
0xFA 250 ERR_FUNC Unrecognised function sent to SDM120

Bugs Reporting

TODO

  • Add terminology table.
  • Add more error codes (as specified in doc/SDM120 PROTOCOL.pdf).
  • Add intalling process for Linux (I love Linux).