EASTRON SDM630DC

flane
Posts: 91
Joined: Mon Aug 11, 2014 7:22 am

Re: EASTRON SDM630DC

Post by flane » Tue Mar 29, 2016 4:39 pm

Hi Adam,
great Job.

It's possible to have C program for SDM630 ?
What problems do you have with current?

grseidel
Posts: 1
Joined: Fri Jan 18, 2019 7:03 am

Working Implementation with mbrtu

Post by grseidel » Fri Jan 18, 2019 7:21 am

I implemented a working solution with mbrtu, which I share here.

setting up libmodbus

Code: Select all

cd ~
git clone git://github.com/stephane/libmodbus
cd libmodbus
./autogen.sh
./configure --enable-static
make
sudo make install
sudo cp ./src/.libs/libmodbus.a /usr/local/lib/
setting up mbrtu

Code: Select all

cd ~
git clone https://github.com/gitaeuber/mbrtu
cd mbrtu
make
sudo make install
Usage (Total Power for SDM630) - check the settings on SDM630 (i.e. parity even, 9600 Baud, slave 1)

Code: Select all

mbrtu -d /dev/ttyUSB0 -b9600 -pE -s1 -a1 -fi -tF32_dcba -n2 -r0x34
Setting up two scrips to be called from Metern
sdm630: (power)

Code: Select all

#!/bin/bash
#GES first script to read modbus: Gesamtleistung

DATA=( $(mbrtu -d /dev/ttyUSB0 -b9600 -pE -s1 -a1 -fi -tF32_dcba -n2 -r0x34) )
if [ -z ${DATA[2]} ]
then
    echo "no data received on modbus"
else
    echo "elect(${DATA[2]:5}*W)"
fi
sdm630z: (counter)

Code: Select all

#!/bin/bash
#GES second script to read modbus: Zählerwert

DATA=( $(mbrtu -d /dev/ttyUSB0 -b9600 -pE -s1 -a1 -fi -tF32_dcba -n2 -r0x0156) )
if [ -z ${DATA[2]} ]
then
    echo "no data received on modbus"
else
    echo -n "elect("
    awk '{print $1*$2 "*Wh)"}' <<<"${DATA[2]:5} 1000"
fi
(Generate Scrips linked to /user/bin)

Code: Select all

sudo ln -s /home/pi/sdm630 /usr/bin/sdm630
Then ther was one tricky part once these scripts were called from metern - they returned Permission Denied...
I resolved by adding the MeterN user to the group accessing the USB

Code: Select all

usermod -a -G dialout www-data #sonst keinen Zugriff auf USB!
Vola!

mori
Posts: 1
Joined: Fri Aug 28, 2020 6:42 pm

Re: EASTRON SDM630DC

Post by mori » Fri Aug 28, 2020 6:48 pm

Hello I have a problem with the installation. I get this error message after the following point.

Who can help me?

Code: Select all

cd ~
git clone https://github.com/gitaeuber/mbrtu
cd mbrtu
make

Code: Select all

pi@raspberrypi:~/mbrtu $ make
cc -std=c99 -O3 -Wall -D_BSD_SOURCE -I/usr/include/modbus/ -lmodbus mbrtu.c -o mbrtu
In file included from mbrtu.c:22:0:
mbrtu.h:25:22: fatal error: modbus.h: No such file or directory
 #include   <modbus.h>
                      ^
compilation terminated.
Makefile:9: recipe for target 'mbrtu' failed
make: *** [mbrtu] Error 1

jeanmarc
Posts: 2055
Joined: Thu Aug 29, 2013 7:16 am

Re: EASTRON SDM630DC

Post by jeanmarc » Sat Aug 29, 2020 8:11 am

Maybe change #include "mbrtu.h" to #include <mbrtu.h> into mbrtu.c :eh:

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest