Getting data from inverters via an RS485 connection

I emailed the manufacturer of my inverter (Ginlong) and asked them for the communications protocol infrormation and they sent it to me, they used modbus rtu over the RS485 to communicate with the inverter.

I wrote a very basic edit of the example program using C# nuget packages in VS 2017, NModbus and NModbus.serial (not Nmodbus4, I couldn’t get that to work over serial)

I then just modified their example to read the registers and do a http get to the appropriate address to send the data to my emoncms server.

This has a timer controlling the fetch interval.

The software runs on a windows 10 PC using task scheduler to act as a watchdog (run every 5mins if it is not already running, but it is so simple and there is nothing else really on the PC so it doesn’t crash)

I have just received my emonpi and I installed it and various additional sensors to support the data from the inverter (temp sensor for hot water tank, CT clamp for hot water divert, pulse counter for generation meter)

My current plan is to finish my node red flow I have been working on this afternoon to monitor the hot water temperature and at specific times during the day send a command to the hive thermostat to boost heating if the solar has not generated sufficient hot water, but to then continue monitoring the temperature of the hot water and stop the boost depending on the measured temperature (this temperature will be different at different times of the day and days of the week)

Once I have done that, I have saved various discussions on how others have implemented the rs485 modbus rtu fetch in pi, and how to forward the data into the emonhub such that it then gets buffered and stored in the event of the remote server going down.
I have previously set up a python script to run as a service on a pi zeros, so I will try and implement this pi rs485script as a service on the pi with a watchdog if possible.

As I get to these I will be happy to share the code on how rs485 has been implemented.

Hi Ian,

I have a GoodWe 1000NS inverter also known as a Replus 1000TL2E with Wifi, USB and RS485 and I would be keen to hear your experiences of getting the data into Emoncms as its the last thing I would like to do on my system that I have had up and running for 4 years now. Any advice welcomed as I have tried a few options from Github with no success on USB or RS485.

Alan

I look forward to any insight that you may have and I will contact the UK arm of the Goodwe Inverter to get the relevant spec. No C+ genius but once I have the ground rules I can usually work it through as I did for the 4CH relay board and several other project here with Node Red and others.

Will keep my eyes open for an update.

Alan

I managed to get the hive integration working this weekend.

When I get the rs485 functions working on the pi I will share it with you.

If you get the communications protocol from Goodwe PM it to me and I will take a look at it at the same time and see if I can do a version for your inverter.

I’m not totally sure what language it will be yet it depends on what modbus modules are available and the results from each.

If you don’t have an rs485 interface yet, I would recommend USB-RS485-WE-1800-BT which is what I have used for my inverter.

Hello Alan,

I have now got my emon-pi fetching data from the Solis-4G inverter (using FTDI USB-RS485-WE-1800-BT RS485-USB adatper) and forwarding the data to the Emonhub running on the emonpi using the socket interfacer functions.

The emonhub then forwards it to my main installation of emoncms.

The program has been written as a one-shot python script that is repeatedly called from a node-red flow conifugred to call it every 5 seconds, (after lots of research, I found that python does not seem to have a timer function that will run every 5 seconds, it only has functions that will delay 5 seconds after other code has been called! which is then dependent on execution time of the code).

The advantages of using the socket interfacer to the emonhub rather than just putting it straight into the emoncms are:

  • emonhub will buffer these messages so if the emoncms server is down the data will then be sent once the emoncms recovers
  • the data is also published to MQTT and so can be used in node-red flows.
  • the data can also be published to the secondary emoncms servers or emoncms.org configured in the emonhub configuration

I have uploaded the python file and instructions here:

I hope this helps in getting your interface to work.
Ian

Indeed it doesn’t. However, Advanced Python Scheduler can schedule events down to one second intervals, and uses a syntax that’s very similar to cron.

I use it to invoke a python script at 5 second intervals to read a WattsOn Modbus based headless kWh meter.

There’s a thread on the forum about reading an Eastron SDM220 Wh meter that has the details.

Hello @Bill.Thomson

Thanks for the feedback. I must admit I didnt find anything about the Advanced Python Scheduler when I was looking.

Main benefits for using Node-RED as the scheduler for me were that it is already installed and running on the emonpi and I was already using it for interfacing to hive to control the gas-hot-water heating. (Alan above has also been using Node-RED too).

I know I found quite a lot of information around the forum advocating minimalmodbus and doing the data collection which was useful as the basis for the python RS485 interface to collect the information from the inverter.

Howerver, I found only one reference to using the socket interfacer, but it was very useful as it detailed the issues experienced in getting it working, Unfortunately I did not find anything on how build the packet structure in python to send data to the socket interfacer in emonhub which I was keen to do.

My previous incarnation of this program was written in C# and ran on a windows PC, that version sent it directly to my main emoncms installation, however didnt have the benefits of the MQTT, buffering and being able to send to multiple emoncms installations offered by feeding it directly into the emohub functions.

Ian

Hi All,

After many hours of breaking down the code from the original thread on GitHub, I finally have the USB feed from my GoodWe1000TL2E inverter supply an update every 10 seconds to my Raspberry Pi and I added in some MQTT capabilities to send the information into Emoncms locally and then I have use Node-red to share the info in a basic Dashboard which I intend to put into HTML 5 when I get 5 min.

My main issue was that in a part of the code it was looking for data in the received which didn’t exist on my inverter. It was after something in response location [66] and my responses only went uptown [46].
So after fixing that data started to flow and then I had to change the code to reflect what was in my response and remove many used objects.

When I get 10 min I will upload my altered code just in case it helps anyone else onto GitHub with the relevant references to the original code…

Thanks to Ian Rogers who inspired me to try again after a 6 month gap and the fact the inverter supplier now has no UK presence as the unit I have was made by GoodWe for Renesola.

Now onto my next project with ESP8266 and e-paper displays.

Alan

1 Like

HI Ian
Do you know if this will work with Solis Hybrid Inverter?.

Looking at the suggested WiFi interface on one displayed on CCL components list, that looks the same as came with my inverter,

I would therefore assume that it will work in the same way, however I don’t know.

Could u share the RS485 specifications?

Hi.
I have a ginlong solis 4g, I am trying to connect to a eastron sdm 270, but my seller does not have the knowledge and ginlong does not respond to me.
How do you connect to the inverter, can you help me?
Best regards. Marco

I use the python program i wrote:

I use this connected to the emonpi

If you are referring to the physical connection, you’ll need an RS485 interface.
Here are a couple of examples:
https://www.ebay.com/itm/USB-to-RS485-TTL-Serial-Converter-Adapter-Interface-Module-2-Protection-Hot/143039007283?hash=item214dca0a33:g:IXQAAOSwGVFcBhy7

https://www.ebay.com/itm/CH340-USB-to-RS485-485-Converter-Adapter-Module-For-Win7-Linux-XP-Vista-N165/193165069276?_trkparms=ispr%3D1&hash=item2cf9890bdc:g:4sAAAOSwHwldqljY&enc=AQAEAAACYIQvEcHUrT7nmUC3yY5qbPyaBN1nJEDYW8MyypsJPgXK4PLYVaIgu9w9Os2XtDHJeiUAYixKujloujtVML8FH42p%2Bqx8cDGnNTFh4SjXDQelzvRaiiFMe%2BL8Rox4s6IrF8jIoyqINuVs8SbP%2BQNsgkMZbwDAnm5whSy0Mr1dmrjC%2B5qfdnG3N3R9L6jpxPy8KMCw%2BJcPmtemVEJnAsd14uh%2Bb47cxpK4XRazj9FBWiqnEcH4tonDjT1up9HGoSVwPGqn1ot%2FY5DBZfFSSuBWwcyLQwkWaqAcnnWzrMovc3ohVzcc3hoVORHshyztKNB49%2B9cwKBdd8vDpFMbxMSsp6RL03o9Q084h770v%2BrL1gi3rV3LVPs06oAWxUSVQAMeFkJ7IEElIs7%2BWZF%2Bj%2FLOopI3b5cxjWHLOVw%2FqavMuhxX3laq9r2VMxdXPEzh6bfImeiDa2BZL0LHuqzpnYJD%2FPQjG8E1kf3XYW0b6hGiadP9yuKg0Rp2amay1WWN3W1T8zD7EG1MjubM%2Fah3LxkU0iFcDQefWL5gGzsTR1b3Ye5RhH4iW3dvi2iEjrVGIZoQBjG2oskXRoylBYoZa403MvoHGw1Xb1EZ3%2FM7u%2F8kJJW%2Bd58t1tpPsNmpFBWSAKWb86w1sp1ZlmpDkLY0gHJssyVcxciN35jAMcaxYgN8Wm7rEvRqYXq5jCyjxRwbxedgr85xa9JG2KhMoQcnU3bPTW9aQnSeQt%2F1aJhz9pmsQQO4hxEvIYBmNaNbBfFsnJzljJpiyheQohJrt0CiCTqrUeXS4dDmnRom3tZI3bvG709z&checksum=193165069276b0491c91163c468499f81ee0b2f52af3

This might be of help as well:
RS485_MODBUS-Hybrid-BACoghlan-201811228-1854.pdf (147.7 KB)

Hi.
Thank you for your interest and fast response.
I believe I did not explained myself well.
What I am trying to do is to connect the eastron meter with the inverter as per manual.
I Know that on eastron is connected on 5 and 6, but on the solis mini 4g 1.5Kw I don’t know where to connect physically.

It sounds as if you may be a bit confused. (or there is an aspect to your inverter that I’m not aware of)
Typically, you’d send the RS485 output from the inverter to something like a Raspberry Pi.
(in Ian’s example above, he specified an emonPi)

The Eastron 270 would also typically be connected to a computer of some sort, but that would be
to read the meter via its RS485 port, then process the received data in order to make it useful,
e.g., via a graph.

The inverter’s RS485 output (again, unless there’s something I’m not up to speed on) is not likely
to be in a format the Eastron 270 can use. i.e. the Eastron will be expecting commands to enable
it to perform voltage, current (from CTs attached to it) and energy measurements vice ingesting and displaying the data from your inverter.

IOW, both the Eastron meter and the Ginlong Solis 4g Inverter are measuring electrical quantities and reporting them on a wired connection. Both expect to send the data to something else (like a Raspberry Pi) that will use the information in some way, e.g display it on a screen.
Each does not expect to talk to the other.

Im using eastron meters (SDM630 and three SDM230’s)

The meters are connected via RS485
This is converted to TCP using a USR-TCP232-410S serial to ethernet converter

On the emoncms server I run MBMD to get the meter data (no need for socat)
This posts to a webpage on the server via MQTT

You can get mbmd from github

here is the command line i use to access the meters
/sbin/mbmd run -a 172.31.222.2:26 --rtu -d SDM230:3,SDM:1,SDM:2,SDM:4 --api 0.0.0.0:8081 -v -m 172.31.222.222:1883 --mqtt-topic emon

I run this command as a systemd service via a shell script

1 Like

Nice work. But marcomau was asing how to connect his Eastron meter to his inverter as opposed
to reading the Eastron device with say a Raspberry Pi or other computer.

hi lan, can we do some collabration with you regarding this.

Any chance you would share the protocol that Ginlong sent you please?