SDM120 Modbus to PVOutput.org

Hello,

I have a new PV system up & running with 6 JA Solar 305 Wp PV panels and 3 APsystems YC500i micro inverters. I have installed an Eastron SDM120 Modbus meter between the power grid and the inverters to monitor the system.

Now i want to upload all data from the SDM120 to PVOutput. I used Google and found some scripts and tools to read the Modbus meter, however there is no ready to use script to directly upload it to PVOutput.

Is there anyone here who has the same SDM120 and wants to share his script with me?

Thank you.

Hi @maarten_brand

I do not have SDM120 nor the script, I do have an SDM630 but it is not yet properly installed so I stop its development a little. If you have basic python skill you may want to modify my code that reads Growatt modbus and send to pvoutput. I could be just a matter of reading the proper registers and attaching its values to pvouput properties (v1, v2…). I cannot do coding right now for you but if you are willing to code and/or test I can help. Do you have SDM120 properly attached to a PC/RaspberryPi right now?

BRs,
Benito

@maarten_brand,

Please, try this code: https://github.com/jrbenito/eastron-pvoutput it is quick n dirty mashup between a eastron reader code I found (easy to use/understand) and the pvoutput class I put together for the Growatt inverter read.

I make following assumptions:

  1. Your meter is a bidirectional model (per Eastron documents it is)
  2. It is installed as import direction being from grid to PV and, of course, export being from PV to grid. If it is inverted, please change the register 74 to 72 at v1 setting.
  3. You are interest only in reading during daylight (ongoing production)

Please, let me know if this works for you.

BRs
Benito

Hi everyone,

I have it all up and running now. Maybe someone else can use this in the feature.

Used hardware:

  1. On the Raspberry Pi, install Raspbian

  2. Run this commands:

sudo apt-get install -y autoconf libtool
git clone https://github.com/stephane/libmodbus/
cd libmodbus
./autogen.sh && ./configure --prefix=/usr && make && sudo make install

git clone https://github.com/gianfrdp/SDM120C.git
make clean && make
sudo make install

Required to read temperature from domoticz
sudo apt-get install jq

  1. Make a new pvoutput.sh file and make it executable (chmod +x)

  2. Copy this to the .sh file:

today=date '+%Y%m%d'
minute=date '+%H:%M'
echo ----------------
echo Current date and time in PVOutput compatible format
echo Date is $today
echo time is $minute
echo ----------------

values=sudo sdm120c -a 1 -b 2400 -e -p -v -P N -z 3 -q /dev/ttyUSB0
echo
echo ----------------
echo Modbus meter values
echo ${values}
echo ----------------

V=echo ${values} | awk '{print $1}'
W=echo ${values} | awk '{print substr ($2,2);}'
WH=echo ${values} | awk '{print $3}'

echo
echo ----------------
echo Values to uploaded to PVOutput
echo Watt Hour is $WH
echo Watt is $W
echo Voltage is $V
echo ----------------

temperature=curl -s 'http://10.0.0.10:8080/json.htm?type=devices&rid=142' | jq .result[0].Temp | sed 's/\"//g' | awk '{ print $1 }'
T=echo ${temperature} | awk '{print $1}'

echo
echo ----------------
echo Temperature read from Domoticz
echo Temperature is $T
echo ----------------

curl -d “d=$today” -d “t=$minute” -d “v1=$WH” -d “v2=$W” -d"v5=$T" -d “v6=$V” -d “c1=1” -H “X-Pvoutput-Apikey: your-api-key-here” -H "X-Pvoutput-SystemId:your-systemid-here " https://pvoutput.org/service/r2/addstatus.jsp
echo

  1. Schedule the file to run every 5 minutes with crontab (crontab -e)

*/5 * * * * sleep 4; /home/pi/scripts/pvoutput_upload.sh >/dev/null 2>&1

As you can see, i use my Domoticz system to read out the temperature. You can remove this part if you don’t have domoticz.

2 Likes

This is a pure Python implementation suitable for a Raspberry Pi to read out an SDM120 Modbus energy meter and to submit the readings to PVOutput, queuing measurements if no connection is possible: