Thursday, August 20, 2015

Setting up StecaGrid communication

So, this StecaGrid 3600 was a fair bit cheaper than normal, and as always cheapness comes at a price. It turns out that there exist different revisions of the inverter and I received an older version of it. And from what I understand the newer models have an ethernet interface which connects directly to your LAN, allowing you to navigate to a nice little dashboard or read raw xml data.

That was not the case with my model. I had already verified that it came with two RJ45 connections at the bottom, but unfortunately both are used for a funky RS485 serial connection. So the only way forward was to figure out how this serial connection works, and I started research before I even got my solar panels.

The manufacterer Steca Elektronik nicely provided me with the technical documentation of their RS485 interface and this looked really promising; it contained various commands to retrieve almost all metrics that were available via the inverter display itself... among which the daily and total yield values!

So after this inverter had been installed I couldn't wait to get started. But before even thinking about the data and documentation I first had to to get the serial connection to work, and by that I mean the actual physical wire that connects the inverter to a computer.


I sacrificed this old 20-meter UTP patch cable and cut off one of the RJ45 connectors, so I could connect the relevant wires to an RS485-USB adapter. I then plugged it into the computer which detected the USB serial port...

And at that point I got stuck.

I found several serial communication software tools, and tried sending some bytes to see if the inverter would send any response, which it did not. I also had the tools listen on the serial port for several days and log every single byte they received, and although there seemed to be spontaneous activity now and then, it mostly consisted of 0x00 bytes and a handful of other random bytes, garbage in proper programmer's terminology.

The technical documentation from Steca was at a higher protocol level than the serial protocol I was currently struggling with. They described command bytes that led to certain response values... perfect... but that command had to be wrapped with all kinds of control and checksum bytes; get one wrong and your command would simply be ignored.

On top of that, there were still more variables in play:
  • Did I attach the correct wires to the A (485+) and B (485-) pins of the adapter?
  • Which of the two RJ45 sockets on the inverter should I use?
  • In what position should I put the tiny line-termination switch at the bottom of the inverter?
  • Did I use the correct serial connection parameters?

I must admit I almost gave up here. Almost even resorted to pulse-counting on the S0 port of the kWh-meter, which turned out to be a trivial arduino sketch and circuit, but at the same time felt so dirty and disappointing.



And then... two weeks after I had connected the cable... on this german forum Photovoltaik I found a mention of the Steca User Software that also used this RS485 connection. After installation, it started its inverter detection on the serial port, and hallelujah, within 3 seconds it reported a "StecaGrid 3600". Communication established, arduino back in the box, the mission was back on track.


This program could update the inverter's firmware (more on that later), but also retrieve the actual panel power, voltage and frequency measurements, visualize the day curves from the past 30 days, and the yield totals from the past months and years.

Whatever this program could do, I wanted to do it myself and tightly focused on what I really needed, and prepared for automated readouts.


It was time to take the next tools from my toolbox: a serial traffic monitor which could capture all bytes on the serial port, and a decompiler for Steca's .NET assemblies. Time to reverse engineer all these data commands.


A final note on the variables that lead to successful communication with the StecaGrid:
  • It doesn't matter which of the two sockets you use since they're internally connected to each other; RS485 was designed to connect multiple devices in series over long distances.
  • The line-termination switch can be in either position, but I found that I get more 0x00 padding with the switch in ON (right-most) position, so I put to OFF.
  • UTP wire 1 (orange/white) is connected to data A (485+)
    UTP wire 2 (orange) is connected to data B (485-)
    UTP wire 8 (brown) is connected to ground
  • Connection parameters:
    Baud rate:38400
    Parity:none
    Data bits:8
    Stop bits:1

12 comments:

  1. Line termination is for switching on/off the 120 ohm terminating resistor at Steca side of RS485 bus. If only one unit on the bus, then it should be switched on. Normally a RS485 bus should have 2 of such terminating resistors, one at each end. The USB converter cable probably has the other one. I would recommend switching it to on, even if you don't notice any direct effect. It is to make communications more robust/reliable. I am curious as to the documentation you received from Steca. Is it possible to send me a copy ? (robert.hulsebos@gmail.com - also Steca 3600 owner)

    ReplyDelete
  2. Hello Sebastijan,

    Many thanks for your great blog. I am going to buy Steca inverter for my solar panels and I am also trying to connect the inverter to my Home automation system based on Homeseer. I wonder whether the protocol is Modbus RTU. There are Modbus tools (eg. Modbus master) for reading the Modbus registers.

    I have also contacted Steca but their first answer was that it's not possible to connect the inverter to a PC. I don't quite believe in this.

    Best regards,
    Jari

    ReplyDelete
  3. Hi,

    I got some more information from Steca. The protocol is Modbus and the guy Steca tech support promised to send more information.

    Please try to download Modbustool software from link http://www.softpedia.com/get/Network-Tools/Network-Monitoring/ModbusTool.shtml. I have been using this software for testing my Modbus devices. I don't yet have the Steca inverter so I can't make any tests.

    Best regards,
    Jari

    ReplyDelete
    Replies
    1. Aha Modbus! If you get any specific info from Steca I'm really interested to hear...

      Delete
  4. Hi Sebastian,

    I will inform you once I get more info from Steca.

    You can easily check with the Modbus tool the Modbus registers and see if the communication works. Most likely you see hex stings in the registers. The problem is that you don't know which registers contain what information so you would need to do reverse engineering to find out the information.

    I will get my Steca inverter some time in April so I can't make any tests yet.

    Best regards,
    Jari

    ReplyDelete
  5. Hi again,

    I think I'm wrong about the Modbus Tool because I haven't used it for a while. If I remember correctly it will show the content of the registers in ascii.

    If you manage to get Modbus Tool working I would be interested in getting a screen copy of the program window.

    I'm not sure that Steca will give information on their protocol. If I can show a screen copy of the Modbus Tool then then there is no point for Steca to hide the information.

    Best regards,
    Jari

    ReplyDelete
  6. Hi Sebastian, great blog you got here. I am in exactly the same position as you are, with a STECAGRID inverter that does only RS485. Just as you I got read-outs working with a RS485-USB converter and Steca User software. However it runs on Windows7 and is somewhat limited in that it only does off-line data-collection. Graphs are nice, but nowadays most inverters have some ' real-time' web-page with yield-data. Did you make any progress in intercepting the communication that the Steca User Software does over the RS485 link ? If so, would you be willing to share the results on your blog?

    ReplyDelete
  7. I have made some progress with my Stecagrid inverter. I am also using Steca user software and I monitored the traffic on the serial port using Portmon serial port sniffer. I know now the hex strings for the commands for reading the measurement values.

    ReplyDelete
  8. Good blog, it help a lot! Does anyone know anything about steca modbus register addresses?

    ReplyDelete
  9. Hallo Sebastian, have you still been working on the Steca RS485 protocol ? Do you have an update on how to read the data from the Steca inverter ?

    ReplyDelete
  10. Hi all, not sure if this blog is still active, but right now I'm dealing with StecaGrid 23000 and wanting to use 3rd party polling software. However, i couldn't find any modbus table for this brand. Any help?

    ReplyDelete
  11. See https://community.home-assistant.io/t/configuration-for-modbus-on-steca-stecagrid-solar-inverter-using-solaredge-modbus/304058. First post has a link to the modbus table. Registers are offset by 2.

    ReplyDelete