Skip to content

reading SDM120 / SDM220 / SDM630 modbus energy meters from esp8266 arduino via rs232 to rs485 converter (template library)

Notifications You must be signed in to change notification settings

ShepherdNetworkLtd/SDM_Energy_Meter

 
 

Repository files navigation

Template library for reading SDM120 / SDM220 / SDM630 Modbus Energy meters.

Updated codebase by JRK to demonstrate usage on an Arduino Uno.

Master Branch (The one you are on now): Original codebase modified and updated to work on the Arduino Microcontroller Platform (tested on Arduino Uno). This includes SDM_Energy_Meter\examples\sdm_simple which is an example that demonstrates the reading of all variables from a SDM120 device. For wiring diagram, please see the Arduino_Wiring_Diagram_SDM120.jpg in the main folder.

Particle Branch: Codebase developed for Particle Electron/Photon, ported from Arduino modified codebase (from original).

Original readme.md from contributor (Reaper7):

Reading via Hardware Serial or Software Serial (library https://github.com/plerup/espsoftwareserial)
and rs232<->rs485 converter with automatic flow direction control (look at hardware_sdm220.jpg)
or with converters with additional pins for flow control, like MAX485.
(In this case MAX485 DE and RE pins must be connected together to one of esp pin and this pin must be passed when initializing the library)

//lib init when Software Serial is used:
#include <SDM.h>
SDM<4800, 13, 15, 12> sdm;  //baudrate, rx pin, tx pin, dere pin(optional for max485)

//lib init when Hardware Serial is used:
#define USE_HARDWARESERIAL
#include <SDM.h>
SDM<4800, 12, false> sdm;  //baudrate, dere pin(optional for max485), swap hw serial pins from 3/1 to 13/15 

Tested on wemos d1 mini->ESP8266 with Arduino 1.8.3 & 2.3.0 esp8266 core

crc calculation by Jaime García (https://github.com/peninquen/Modbus-Energy-Monitor-Arduino/)

UPDATE:

2016 - 2017 Reaper7

paypal.me/reaper7md

About

reading SDM120 / SDM220 / SDM630 modbus energy meters from esp8266 arduino via rs232 to rs485 converter (template library)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 100.0%