Git Product home page Git Product logo

sungrow-meter-cheater's Introduction

Buy Me A Coffee

Last update: 2024/05/12
The project is working again, thanks to @pdf83 support. Sungrow has changed some behavior in the firmare and the main script needed to be updated.

2023/12/10
After updating my SG5.0RS to the firmware version SUNSTONE-S_B000.V001.P029-20231019.zip the inverter is lo longer requesting the address 356+8 registers (164H, Active power of phase A,B,C and Total active power). In addition, the meter is not detected on the web yet.
But we have a new player: fe03500000018105. Register 5000H? What is that?
The script cheater.sh has been updated to answer 0, but no request for active power is received yet.
Do you know the solution? Please let me know on "issues". Thanks in advance.

Sungrow-Meter-cheater

Sungrow DTSU666 power meter emulation using a Raspberry Pi

Project objectives

This is a research project that aims to emulate a Sungrow Meter DTSU666

Main references

cheater.sh
meltaxa/solariot#27
https://stackoverflow.com/questions/2746553/read-values-into-a-shell-variable-from-a-pipe
https://www.exploringbinary.com/twos-complement-converter/

calc_crc16.sh
https://ctlsys.com/support/how_to_compute_the_modbus_rtu_message_crc/
https://github.com/onslauth/bash_crc16
https://stackoverflow.com/questions/8564267/crc16-algorithm-from-c-to-bash
https://crccalc.com/

Requeriments

  1. A Sungrow inverter, I'm using a SG5.0RS
  2. A Raspberry Pi, I'm using a Raspberry Pi 2 and a 2 GB SD card
  3. Raspberry Pi OS Lite, I'm using 32-bit: https://www.raspberrypi.com/software/operating-systems/#raspberry-pi-os-32-bit
  4. A 485 dongle, I'm using a ARCELI USB to 485 adapter: https://amzn.eu/d/59K0N9B
  5. Install the required software: sudo apt install screen stty curl jq

Installation

Connect two wires from COM2 terminals (A2,B2) to 485 adapter terminals (D+,D-). Read the documentation of you inverter, I have used the page 20 of this manual: https://aus.sungrowpower.com/upload/file/20210707/SG2.0-6.0RS-UEN-Ver11-202106.pdf

Configuring /home/pi

  1. Copy these files to /home/pi/cheater
cheater.sh
Shelly_get_em0_power.sh
Shelly_get_em0_voltage.sh
calc_crc16.sh

Configuring crontab for 'pi' user

  1. Run "crontab -e" and add:
@reboot (cd /home/pi/cheater; screen -d -m ./cheater.sh)
  1. Not mandatory but recommended: run "sudo crontab -e" and add:
0 4   *       *       *       /sbin/reboot
  1. Reboot and run "screen -r" to check if the communication is working:
request: fe03003f0001a009: slave 254 ($FE), register 63 ($3F), 1 register | answer: address=254 ($FE), baud rate=1 (9600 bps) FE0302FE012DF0
request: fe03500000018105: slave 254 ($FE), register 20480 ($5000), 1 register | answer: device type coding=0x20D5 FE030220D5740F
request: fe03016400081020: slave 254 ($FE),register 356 ($0164), 8 registers, Active power of phases A,B,C and Total active power | answer: (A,Total=-615 W, B,C=0 W) FE0310FFFFFD990000000000000000FFFFFD99DED2
request: fe0300770001201f: slave 254 ($FE), register 119 ($77), 1 register, Frequency | answer: 50 Hz, FE030200322D85
request: fe03000a000c71c2, register 10 ($0A), 12 registers, Current forward active total/spike/peak/flat/valley/... electric energy | answer: (0,0,0,0,0,0) FE03180000000000000000000000000000000000000000000000006F1F
request: fe03003f0001a009: slave 254 ($FE), register 63 ($3F), 1 register | answer: address=254 ($FE), baud rate=1 (9600 bps) FE0302FE012DF0
request: 207300000001c370: slave $20, register 0 ($00), 1 register | answer: 207300000001c370
request: 20030000000d82be: slave 32 ($20), register 0 ($00), 13 registers | answer: 20031A0000000100000001000000010000000100000001000000010006767
request: 20030000000d82be: slave 32 ($20), register 0 ($00), 13 registers | answer: 20031A0000000100000001000000010000000100000001000000010006767
request: 20030000000d82be: slave 32 ($20), register 0 ($00), 13 registers | answer: 20031A0000000100000001000000010000000100000001000000010006767
...
  1. Exit from screen command using the sequence (Control+a)+d

Images

Injection:

Consumption:

Trend:

485 Connection:

RBPi2:

sungrow-meter-cheater's People

Contributors

linux-risc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

lexleite

sungrow-meter-cheater's Issues

S100 map

So using the information I have used modbus master to dump the first 100 registers.
I will monitor the values throughout the day to generate a proper map. So far I can see register 24 is grid frequency and 6 is grid voltage.
The S100 slave ID is 32 and the value of register 0 is 64 and doesn't seem to change.

image

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.