-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GoodWe XS-serie UART RS-232 #28
Comments
I was looking to build something for my 1500-XS. The HF-LPB100 seems to 'forget' the AP SSID every time the sun goes down... (Why is disabling this AP feature not an option after setting up the STA mode!) The output above is generated by the ESP8266 (based on code from this repository) when connected to the "USB" interface of the inverter? Without the HF-LPB100? I haven't gotten to hardware hacking yet and I was first trying to decode the TCP protocol. After all, after replacing the default wifi module it would be nice to update the SEMS portal from my own module ;) Edit: I should be able to connect a simple Logic Analyzer to the communication between the inverter and Wifi module. I will report back when I have some data to share. |
Update: I connected a Logic Analyzer and found the baud rate between the inverter and wifi module is 9600 baud. Also I see the same messages on the serial bus as seen on the wireshark dump (1 minute interval)
This HF-LPB100 seems to be a serial to TCP bridge only. Messages from inverter:
Messages from server (or to inverter):
|
After rebooting the wifi module I'm seeing AT commands, So yes, the wifi module is a simple serial to IP bridge |
Wow, great work both of you. Really detailed analysis. |
The final 2 bytes are indeed CRC and the algorithm turns out to be "CRC-16/MODBUS". I am fairly certain the voltage level is 3.3v and it's a regular 9600 baud serial interface. If we record the dialog between the original wireless module we should be able to simulate the wifi dongle using an ESP (Only a few AT commands). After the AT+ENTM command it's a simple serial to TCP bridge, no problem for the ESP. I will check if your provided code results to recognisable data. This is the AT dialog in my example (MYSSID and MYBSSID replaced). RX is the inverter and TX is the wireless module
|
The total kW should be fairly static but I'm getting nowhere
Compares to this in the SEMS portal:
|
I made a datalogger to write the stream to disk over time, but the data after the SN does seem to be encrypted or compressed somehow (high entropy) |
I did follow with interest your dialog here, however I'm afraid I am not knowledgeable enough to further contribute. In the meanwhile I moved on to setup a kWh meter pulsecounter in esphome with an integration sensor in home assistant. |
@No13 I found this blog from someone who seems to have figured out (part of) the data. Maybe that can help you? I see he is also on GitHub, @Sp1l did you made a script after your blogpost in 2019 for intercepting the data and using it elsewhere? @No13, could you also try with nmap to see if UDP 8899 and/or 48899 is open in the wifi-module? If so, this script could work for the XS-series maybe. |
I now also have a GW3000-XS (i got tired of the relay clicking of my 3000NS at twilight). I have the same module as the pictures in the first message. I made a dump of the SPI chip (hidden under the metal shield). While browsing the file (mostly HTML content according to
@No13 Let me know if i can help you with anything. |
@No13 See https://gathering.tweakers.net/forum/list_message/66034946#66034946 for a script that a user on Tweakers.net is using to intercept the data. @popoviciri this might also be useful for you. Don't know if this repository is still the right place to talk about this, as the way of handling the data is very different from the RS485-method that the sketch was written for. |
The script that i linked to is for older inverters where the TCP data isn't obfuscated/compressed. The XS-series use a different protocol, as i can't find any recognizable values after i converted them to hex. I contacted Goodwe, but they say they cannot give me the protocol information. So we are back where we started :-( Strange thing is by the way that i have the option 'Set modbus address' in the menu of the inverter. Could the protocol we are looking at be modbus by any chance? I also had a look at the connectors of the inverter. In the manual i see something about the 'DRED' connector. This is for remote control of the inverter by energy companies (shutting down if there is too much production for example). I have the impression when looking at the manual, that if your inverter is RS485 capable, this connector is also used for that purpose. Unfortunately only two pins on this connector are populated in my case, so no RS485. |
@popoviciri When looking at the photos of the module (and my own), i noticed that the TX of the UART is connected to two pins of the USB-connector. I am thinking of why this is done, maybe so the inverter can see if there is something connected? I have now turned my attention to see if there is a RS485 connection anywhere. The TCP messages to Goodwe/serial connection to wifi-module seem uncrackable for now. |
@popoviciri @No13 I found some very interesting info! On the Goodwe website there is a download called GW_Firmware & PC Software & Instruction All-in-one for CEI 021. I attached the document regarding the instructions for the XS: Local Upgrade for XS Method.pdf As you can see they use a cable they call 'TTL-485-USB cable' to update the inverter with the utility 'DataSend for COM'. When looking at the instructions for a SMT-type inverter in the download package, they have included a manual on how to construct an updating cable for the SMT-type inverter. It uses only two wires and works with the same program (DataSend for COM). This makes me think that there actually is a RS485 port in our XS-series, but not as a separate connector, but through the USB3 connector. Now only to see if that is really the case and how to find out the pinout.. When looking at your schematics, i see that pins 2 & 3 and 5&6 are not used by the original wifi stick. Would it really be that simple that the RS485 lives on one of these.... I will see if i can measure/try something this week. |
Hi @ThinkPadNL, Great finds! I didn't think it'll be a RS485 port in there as well. If there is, then must be on pin2 and pin3 for a standard USB2 connector. When I catch a moment from work, I'll connect to those and see if I get anything. Anyway, I believe that the 'TTL-485-USB cable' you mention above it's likely a GoodWe internal cable since the Vs and GND pins on the inverter are reversed. I did powered an ESP8266 via that source so I know this is right. Or maybe there is no ground needed for the connection and just the two data pins? I use this TTL to RS485, board which has a GND pad as well so I assume it is needed. By the way, I have two of these so if you need one, ping me on tweakers, and I'll send it to you. Cheers! |
@popoviciri I was able to find a USB3 cable. I will conduct some measurements tomorrow (inverter is off because it is dark now). Any tips where to look for? When looking at your schematics, i see that TX is not only connected to pin 8, but also to pin 6 (why???). So that leaves us with 3 free pins: 2, 3, 5 i guess? Just measure between GND (pin 1 on USB3 connector in this case) and those three? Any other suggestions? With my previous inverter (NS-series) it only used the two A & B pins for RS485, no GND was needed. Thanks for the offer for the converter PCB, but it's not needed. 👍 I have that exact PCB lying around. Have used it for some years with my 3000NS (which i swapped with a 3000XS because that one hass much less clicking relay noise at twilight/bad weather). |
I remembered that when contacting Goodwe about options for local data retrieval on the XS-series, they send me a PDF with information about the Modbus RTU protocol, see this document i attached. That is the physical part, but it makes me think that this inverter uses a different protocol (Modbus) than what the code in this repository was written for (some proprietary protocol with handshake and such). However i have zero experience with modbus and the protocol PDF is not making it more clear to be honest. I can also imagine that we first need to send a 'please give me data' command to the inverter before it replies. So i am wondering if my voltmeter measurements will give me any useful info. Any ideas about this @popoviciri and @No13 ? |
A new, sunny, day. As i work from home i had some time to experiment. I started with measuring the pins on the USB3 connector. One lead of the multimeter i clipped to pin 1 (which is used as GND by the XS). Then probed all remaining pins:
I attached a RS485-TTL PCB and this to a USB-Serial converter. I then downloaded Modbus Poll and configured it (9600 8N1), entered the modbus settings as per the Goodwe PDF (slave address 247, function 03). The interesting information starts from register 200 up to 237 so i used starting address 200, quantity 37. I tried all possible combinations of wires. Then i also did the same but with the ESP connected to the RS485-TTL and with the sketch from this repository. Still no data (or RX light) from inverter. Also tried the 'DataSend for COM' utility from Goodwe. There is a button 'Open COM', but that works as soon as there is a COM port available on the system and has nothing to do with the inverter being connected or not. The utility doesn't offer a function to retrieve information from the inverter. The next step in the program is to send the data, but i am not going to flash a random firmware file to my inverter lol. I have asked Goodwe (and attached the XS upgrading instructions) if they have more information about this cable: which pins does it use? |
Goodwe replied that the cable is hard to find in the Netherlands. It has to be specially made, they only have two of it available. |
Pin 2 and 3 from the USB are connected to these red + black wires plugged into the board. |
Whoaaaa, those are some great pictures! 🙌 Especially because i had the same thoughts a few weeks ago, to open up the inverter. But i was held back by the 'warranty void' sticker 😇 I already tried removing it very carefully with a hairdryer and a sharp knife, but after trying only 0.1mm i already saw i couldn't remove it without damaging it, so i stopped. You were not impressed by it and ripped it off anyway? 🤣 The amount of wires in the bigger white connector matches exactly the pins that you pointed out on the wifi-stick, so no extra pins/functionality there. Interesting to see that separate red/black connector. You would really think it could offer RS485 on those, but as we have both tried it doesn't work. If i understand the manual/Goodwe support correctly there are two types of inverters, where one has RS485 and one has not (ours). I would assume that for the RS485 they connect some extra wires/PCB-module somewhere and use different firmware on it. What about the separate PCB that the purple and yellow wire goes to? Does it have any chips/additional connectors on it? And maybe you can make some more sharp pictures of the main PCB and internals of the inverter? Maybe we can identify some more interesting things. And also just to feed my curiosity 😄 |
Very interesting, thanks for making these! I guess that for bigger inverter models they just use more beefy components. You can also see it on the PCB, there is a jumper (near the barcode sticker) for selecting the power (0.7 / 1 / 1.5 / 2.0). This will probably tell the CPU which hardware is present. @No13 and i both did a search with 'strings' utility on the firmware files. In the I had a look in the datasheet for the I'm not sure about the protocol though. It could be the protocol (proprietary) that this sketch uses, but also modbus (as the display has a menu option to set the Modbuss address). But if i remember correctly my old GW3000-NS also had that modbus option in the menu, but still used the proprietary protocol. Also be sure to startup (apply DC + AC) the inverter with the wifi-module removed. It could be (assumption) that RS485 is not enabled when wifi is connected/was connected when inverter was already on. Keep us updated. I would be a decision struggle for me and others to also use it, as it requires to take off the lid 😆 |
@popoviciri Keep us updated. I am a bit out of options for now unfortunately I get the feeling that it may not be possible at all to extract data from it locally. |
Hi @ThinkPadNL, after many unsuccessful trials with TTL to RS485 board, USB-serial converters and ESP8266 with the sketch from this repository, I decided to order a Logic Analyzer and inspect the signal that way. Will be delivered today so I'll be able to try it tomorrow. |
Did you also try with Modbus? I hope a logic analyzer brings us new insights. Could still be difficult though, as the inverter could stay silent until it is asked to present his data. |
Hi @ThinkPadNL, |
To be honest, I was already afraid of that 😞 Still makes me wonder how the update procedure works though, especially which pins they use. It could be the TX/RX pins that the wifi module uses (and thus simple TTL serial). But why then the separate black/red cable... As can be seen here there is some 'negotiation' between inverter and wifi-module. Maybe they send a special command which puts the inverter into update mode. Maybe we can try to sniff the serial output during startup of the inverter (and with wifi removed?), maybe it prints some diagnostic info? Or just send a |
Hi Guys https://github.com/cyberjunky/wemosomnikserialsensor/blob/master/WemosOmnikSerialSensor.ino |
Hi @bwired-nl ! (familiar nickname, long time ago from domoticaforum.eu. I remember your cool website 😄 ), I have looked at that code and see it uses port 8899 to communicate with the inverter. I have already tried that (could be that i have not posted that here but on Tweakers.net). There is similar code for Goodwe inverters which also uses this port 8899: here and here. I've tried them both and got no response at all from my inverter. But thanks anyway for thinking along 👍 |
Hi Everyone, Some Info:
Power Adjust 1-100% adress modbus 0100 https://github.com/MiG-41/Modbus-GoodWe-DT |
Hi @gracenho, Which connector / cable do you use for Modbus communication with the inverter? Was your inverter also sold with wifi? And which country are you located in? It could be that there are differences in specifications in each country. Everyone in this thread (including myself) is from the Netherlands I thought. |
Hi @ThinkPadNL, I use this |
The inverter that i (and also the others on this thread) have, only have pins 4 & 5 populated in the connector. The other pins (for RS485) are empty, so there is physically no possibility for us to use RS485. No need for the PDF, i already got it from Goodwe 👍 |
Thanks for the pictures, maybe this gives @popoviciri new insights in a possible way to get RS485 on our inverters. |
My XS1500 (bought in Germany) is equipped with a 14k4 resistor across pin7+8 (beside the remote bridge cable 4+5), which I expected to be rs485. But so far no success getting data out of it :-( |
I have two GoodWe XS inverters, a XS2000 and a XS2500. Bought last month in NL. They also have this resistor and a description of the RS-485 pins in the manual. About the pinout: I used pin 3&7 for A and pin 6&8 for B. (The RS-485+ and RS-485- are a bit confusing in the manual). I removed the resistor, but it also worked with it. |
My XS1500 (FW ver. 1.03.09) is not giving any data on the plug (named 4. in user guide) between mains and WLAN (USB) :-( |
@ThinkPadNL would it be possible to ubload the bin-file from the spi flash? would be great |
@Arut42 I already did that once, for someone who flashed the default HF-LPB100 firmware on his wifi-stick (in order to hide his wifi password from being shown in the webinterface). But by doing that, he broke the upload functionality to SEMS Portal. |
@ThinkPadNL i can understand that. #define SYSTEM_CONFIG_SIZE (0x8000) #define SOFTWARE_CODE_ADDRESS 0x1800C000 #define WEB_ADDRESS 0x18180000 //200k |
@Arut42 I don't know how i can extract only the firmware part. What i have is a |
@No13 @aiolos @popoviciri @Badwater-Frank @gracenho I have great news to share! 😄 A user on 'Tweakers.net' found out that on XS-series inverters with newer firmware, the app 'SolarGo' from Goodwe can be used to retrieve data. This is a app that uses port 8899 UDP on the local network to talk to the inverter (possibly Modbus RTU ?) I asked Goodwe to update my inverter (which was at v1.02.10). They first said it wasn't possible to do remotely and that they often see it would cause issues (???). I then said i wanted to enable Modbus and that i read on a forum (Tweakers) that remote updating should be working. They then proceeded to update, to v1.52.10. Now that is what i call a big bump in updates, and my inverter isn't even that old. However SolarGo still wasn't working. I then asked them again, this time to also update the ARM-firmware. This time my inverter went to v1.52.14 and the SolarGo app immediately worked! The code from the user ('msatter') can be found here: https://gathering.tweakers.net/forum/list_message/67162608#67162608 The script also works for me, but i find it a bit clunky. I prefer something like Node-RED but haven't tried yet to see if i can communicate with the inverter that way. The last few months i had the inverter configured to upload to SEMS Portal, but as soon as i have a stable locally setup working, i think i will block internet access for the Goodwe in my router 😈 |
@ThinkPadNL u can view it with an hex editor like https://hexed.it/ |
@Arut42 In the link you can find the firmware dump from my wifi-module (HF-LPB100). I searched for the (part of) the serial no of my inverter in the code and replaced it with '00000000'. --link removed-- |
@ThinkPadNL thx for your work. |
Unfortunately the support replies after some time, that inverters (mine XS1500) produced before October 2020 do not have the RS485 feature :-( |
@Badwater-Frank Have a look in this topic: https://gathering.tweakers.net/forum/list_message/67162456#67162456 After they updated the ARM-firmware on my 3000XS i was able to read data through wifi using the SolarGo, and that opened possibilities to use other scripts to read the inverter data locally. @popoviciri I think the original question is not so relevant anymore. Maybe it is time to close this issue now. |
Right! Thanks @ThinkPadNL for the info provided. This thread was fun to follow. |
Hi there, I just bought a XS-3000 but without RS-485, I realized it become a optional choose, but it was too late. |
I've been trying for a couple of days to use this code with my small XS serie inverter.
The wifi module uses a HF-LPB100 chip, which according to the user manual has a RS-232 UART interface. The USB3 pins are connected as show in the last column, here next to the standard USB3 configuration:
So it looks like a USB3.0 but has nothing to do with it!
This is how I found the pins:
The comparison with the standard USB connectors:
One should not stick a standard USB device in there. Will likely break it since the standard V+ and GND are reversed.
I did cut a USB cable and connected only the pins I'm interested in Rx and Tx to a ESP8266 Huzzah. I can also power the Huzzah from the reversed pins 1 and 4 and connects fine to my wifi and subsequently mqtt broker.
The serial monitor shows a bunch of these lines:
Obviously this is not right. Incoming data from the inverter is identical with sent packet. So, is it safe to assume that the XS series uses a different protocol than the one this application is based on? How's the data coming from the inverter supposed to look like? When sniffing the port I get only nonsense in the terminal view at all baudrates I can set. Sniffing the wifi module shows nothing in the terminal.
I know this is supposed to be an issue tracker but the repo was found by multiple search engines in relation to the subject, so I post this here.
Goes without saying that I do not encourage anyone to try this. I'm just looking for the obvious detail I'm missing. Thanks in advance for any feedback!
Cheers!
The text was updated successfully, but these errors were encountered: