Git Product home page Git Product logo

sdm220-carbon's Introduction

sdm220-carbon

A simple script used to get values from Eastron SDM220modbus or SDM220MT energy meter to carbon via Modbus RTU protocol

Installation

Install pymodbus:

pip install pymodbus

Fill sdm220-carbon.ini with your settings

Installing as systemd service

Refer to docs/systemd.md

sdm220-carbon's People

Stargazers

 avatar  avatar Dmitry avatar  avatar Rui Pedro Henriques avatar reaper7 avatar  avatar

Watchers

Evgeny avatar

Forkers

praveenkv1988

sdm220-carbon's Issues

Python Modbus Energy Meter(EM6400)

Hi,
I am trying to implement modbus protocol on EM6400 in python to read values from energy meter.

Below here is more detailed explanation of my implementation:

Request:
01 03 0F56 0002 270F
01: Slave address
03: Function code for read holding registers
0F56: Data Address of the first requested register (address for voltage phase1 to neutral)
(0F56 hex = 3927, +40001 offset = 43928)
0002: Total number of registers requested
270F: CRC (Cyclic Redundancy Check) for error checking (LSB first)

Response:
01 03 04 2921 4373 D2B0
01: Slave address
03: Function code for read holding registers
04: Total number of bytes read
2921: Data in 1st requested register
4373: Data in 2st requested register
D2B0: CRC for error checking (LSB first)

Values in required register are 43732921 in hex (since obtained values are being read in little endian
format) which is 243.16 when converted to floating point using IEEE 754 norms. Obtained value is a
voltage (phase1 to neutral) which is 243.16 Volts.

Could i get a piece of code for the same as i am having difficulty in implementing this.Is it possible to implement this only by using Pyserial instead of Pymodbus.

Here is the piece of code, i tried
`import os
import sys
cwd=os.getcwd()
(setpath,Examples)=os.path.split(cwd)
print setpath
sys.path.append(setpath)

from PyArduino import *

import struct

port=locateport()
ser = serial.Serial(port, 9600)

ser.write("\x01\x03\x15\x86\x00\x02\x39\x15")
buf=ser.read(11)

b1=b2=b3=b4=0

a1=buf[3]

if (a1<16):
b1=1
a1=int(a1,16)
if (b1):
a1='0'+str(a1)

a2=buf[4]
if (a2<16):
b2=1
a2=int(a2,16)
if (b2):
a2='0'+str(a2)

a3=buf[5]
if (a3<16):
b3=1
a3=int(a3,16)
if (b3):
a3='0'+str(a3)

a4=buf[6]
if (a4<16):
b4=1
a4=int(a4,16)
if (b4):
a4='0'+str(a4)

a5=[a3,a4,a1,a2];
a6=''.join(a5)

print struct.unpack('!f', a6.decode('hex'))[0]

`
Regards,
Manas

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.