Jump to content

Featured Replies

Posted

Hi All

Hope someone could help me in my confusion to connect a Raspberry pi 3b+ to my inverters

I have 3 x 3phase 12kw deye inverters connected in parallel. Rj45 cables come from the bms port of each inverter to a rs485/can hub and then to my master battery. 

So my question, how to connect the raspberry pi? 

Inverter model number : sun-12k-sg04lp316443283715439214927691614369484.thumb.jpg.75926283469d6fd4ba13a7d02ca359de.jpg

 

You connect where the data logger normally goes, using a special RS232 to USB cable. Solar Assistant sells the right type and I've seen them on Takealot as well.  You could also use a special RS485 to USB cable, but that is only available from Solar Assistant.

SunSynk WiFi RS232 portSunSynk RS232 DB9 interface

 

  • Author

Great thanks for the quick response. So If understand correctly my bms connection to batteries stay the same, the wifi dongels get replaced with the cables. Each inverter gets a cable which connects to the rasbe3pi interface?

  • Author

Sorry I am a bit confused now.. 

Is there two methods of wiring the pi to my inverters?

1.with the rs485 to usb cable (wire all thee my inverters to the pie) 

or

2. With the rj45(labeled meter 485) of the master inverter to the pi. 

19 hours ago, Chris Jensen said:

Scabadude I'm not sure if your method is going to work. My inverters do not say wifi/rs232 only wifi. 

The dongles are all RS232 - under that cover sits an RS232 port.  There are some Solarman dongles going cheap - if you need basic functionality it is quite ... erm ... functional.

  • 2 months later...

Does anyone perhaps have the modbus addresses for the sun-12k-sg04lp3, I have tried the 5/8kw addresses, but they differ.

I have made contact with Sunsynk but they don't know what I am referring to.

 

  • Author

My Deye 12kw 3phase inverters are set as :

Master - 01

Slave 1 - 02

Slave 2 - 03

 

The coms cable positions are quite important. 

On mine it is as follows. From master it should be in parallel port B to slave 1 in port B and then from B to port A on slave 2.

Hope it helps. 

  • 7 months later...
On 2022/02/10 at 4:49 PM, Kalahari Meerkat said:

With a RS485 to USB adapter for the PI you could wire up to the internal RJ45 that's labeled Meter-485...

Hi @Kalahari Meerkat, I have tried in vain to read  valid  measurements from a Deye 12KW 3 phase machine using Modbus RTU . The port I  am using is the one you describing as Meter-RS485 .      I have started the Modbus RTU session successfully as you can see from the output below

root@lfrocks:/home/rock/modpoll/aarch64-linux-gnu# sudo ./modpoll -b 9600 -p none -m rtu -t 4:hex   -a 1 -r 1 -c 100 /dev/ttyS0
modpoll 3.10 - FieldTalk(tm) Modbus(R) Master Simulator
Copyright (c) 2002-2021 proconX Pty Ltd
Visit https://www.modbusdriver.com for Modbus libraries and tools.

Protocol configuration: Modbus RTU, FC3
Slave configuration...: address = 1, start reference = 1, count = 100
Communication.........: /dev/ttyS0, 9600, 8, 1, none, t/o 1.00 s, poll rate 1000 ms
Data type.............: 16-bit register (hex), output (holding) register table

-- Polling slave... (Ctrl-C to stop)
[1]: 0x0500
[2]: 0x0001
[3]: 0x0104
[4]: 0x3232
[5]: 0x3036
[6]: 0x3138
[7]: 0x3730
[8]: 0x3931
[9]: 0x0000
[10]: 0x0000
[11]: 0x0000
[12]: 0x1807
[13]: 0x0000
[14]: 0x0000
[15]: 0x2005
[16]: 0x1108
[17]: 0x0000
[18]: 0x0000

 

The contents of registers 1 to 8 are correct , 4 to 8 assembles into an  ascii serial number of the machine and it reflects the serial id on the machine's label .

But for the rest  , no output makes any sense . example for register 79 I expect AC frequency in .1 or .01 hz , but the numbers are not in limits . Same with AC voltages , Battery voltages etc. I am using the Sunsynk modbus documents widely used and available here on the forum. I even looked at battery pack data starting from reg address 600 , but its hogwash .

Any pointer you might give as per why i am not getting machine measurement data ? Thank you in advance.

EDIT : I have even meticulously implemented modbus function code 03 (holding registers read) in my own c++ app , to make sure the test utlity i am using is ok , and i get the same results . response frame is pure , crc ok and no negative ack's returned.

Edited by BritishRacingGreen
Extra info

25 minutes ago, BritishRacingGreen said:

I have started the Modbus RTU session successfully as you can see from the output below

Ok, the problem, from what I can tell and I might be wrong here, is that the info on what registers/coils/whatever we have had are ok, for the 5kW single phase and probably also for the 8kW single phase units, but I suspect strongly that these register numbers don't line up on the 3phase units and may not even be ok for the single phase 16kWatter... but that more likely closer to the 16kW unit, but it has more MPPT's, I think, so... won't match up 100%, someone with one of those will have to let us know about this...

The 3phase units after all, has to give us 3 voltage readings as opposed the one for the single phase units per AC end and 3 current or power readings as opposed to one for the single phase unit per AC end... so all I can suggest that you read everything it gives you and then try and figure out what register contains what, but that will be hit and miss and you could end up with wrong conclusions... I'm hoping someone can twist someone's arm in China to supply the details we are looking for, here...

Thanks Meerkat , yes indeed it appears in the protocol document that the 3 phase metrics are not enumerated in detail , cause one would for instance expect individual power metrics ,amongst other, for each phase.

I will endeavor to search for known binary patterns which may expose eg. ac voltage , frequency etc. But I am also going to try and connect with Deye to possibly get hold relevant documentation.

Thanks again and cheers.

Would ask Sunsynk/DEYE in SA if they have a Modbus Registers document for the 3 Phase inverter as it i8s definitely different to the 8kw/5kw inverters ones.  would be a bit of a ball ache to work it all out yourself but could be done. 

My suggestion would be to use ESPHome and and ESP32 with a RS485/TTL board, is definitely the easiest way to get all the data into Home Assistant and leave the Solarman dongles in place

 

Thanks @Sc00bs for the latest Modbus docs .

@Sc00bs, @Kalahari Meerkat here's a very interesting piece of info on solarassistant.io  site , which @Steve87 has drawn my attention to . 

image.thumb.png.c08884fa82c3b4051fa99aaa5a88f45e.png

So for some reason it was in order to use meter-RS485 connection before a  certain firmware upgrade . After that , it appears that its no longer supported . The RJ45 splitter is no option for me to use the BMS RS485 for Modbus , as the attached battery works via RS485 and not CAN . So the only other option I have is RS232 port , but that is occupied  by SolarMan dongle.

Yet another options available for me , also courtesy of info from  @Steve87 , is there is a Git thread that would suggest that the SolarMan Wi-Fi dongle entertains MODBUS TCP on the local wifi subnet . This is apparently for dongles with serial numbers greater than 17xxxxxxx  . But it is also my understanding that if this does not work , it should still be possible to tunnel Modbus messages over the SolarMan V5 protocol . So this is the  avenue will be my next attempt .

Maybe these options are known to you , I am an absolute beginner here as far as Deye is concerned. So any additional help will be met with gratitude.

 

 

 

 

 

Hi @BritishRacingGreen

My understanding (I am sure someone will correct me if I am wrong on anything 🙂 )  is that the main difference between RS232 & RS485/Modbus is that the RS232 connection is a point to point connection whilst the RS485/Modbus protocol allows for multipoint connections. 

RS485 is the physical connection protocol between the devices whilst Modbus is the data communication protocol. 

At the moment the only communication on the RS485 connection is between the Inverter and the battery, you would just be adding another device onto the chain with the "splitter"

https://en.wikipedia.org/wiki/RS-485 

https://en.wikipedia.org/wiki/Modbus

https://en.wikipedia.org/wiki/CAN_bus

In theory 🙂if you can find the communication protocol for your battery, your ESP32 device, using esphome could query the battery as well as the inverter and send that data to Home Assistant.  

https://esphome.io/components/canbus.html

38 minutes ago, Sc00bs said:

the RS485/Modbus protocol allows for multipoint connections. 

RS485 is the physical connection protocol between the devices whilst Modbus is the data communication protocol. 

 

From my limited understanding, the basic Modbus protocol have one master and multiple slaves. Modbus TCP does allow for multiple masters but then they need to implement some form of collision detection and re-transmission, but somehow doubt that to be implemented on  batteries and inverters. Esphome does not implement modbus TCP. ESPHome also expects to be the modbus master.

CANbus have a completely different electrical signalling but allow multiple devices all able to talk on the same bus without needing a single master. 

Thanks @iiznh  

So that explains why the inverter has to be changed to slave when you want to connect the ESP32 using ESPHOME 🙂  as it is using the Modbus protocol to communicate with the inverter.

@Chris Jensen  Was thinking that there is also the option to just query the Solarman dongle directly. 

There is an integration for Home Assistant that will do it and you won't need to have any extra connections. 

https://github.com/StephanJoubert/home_assistant_solarman

I suspect that you may need to customise the query parameters for the 3phase but it is pretty easily done. 

17 hours ago, BritishRacingGreen said:

So for some reason it was in order to use meter-RS485 connection before a  certain firmware upgrade . After that , it appears that its no longer supported . The RJ45 splitter is no option for me to use the BMS RS485 for Modbus , as the attached battery works via RS485 and not CAN . So the only other option I have is RS232 port , but that is occupied  by SolarMan dongle.

You should still try and co-exist with the batteries on the BMS RS485 connection and see whether that will work... the inverter should not be overly chatty with the batteries and RS485 is also a bus, multiple devices... only... there can be only one, no, not the Highlander, but one bus master, which, for the batteries would have to be the inverter, so it might ignore you, since it would have to be in master mode to talk to the batteries... still worth trying, though... else turf the SolarMan dongle and keep it around if you want a firmware update, but use the RS232 port for your modbus comms instead...

I have gotten data from the SolarMan dongle, wirelessly in the past, but this is more like 18months ago en ek kan nie meer onthou nie, somone had details about it on the forum, but this was not all that reliable and the query frequency was fairly low, as far as I can recall... I think there was more info via a github page...

At one stage I was contemplating writing a RS232 switch, using a blue pill/ARM cpu based micro board with 3 serial ports, one for the inverter, one for the SolarMan dongle and one for local logging/queries via a RPi, but then ended up with a RS485 connection instead... the switching code would have to ensure that the SolarMan query would get buffered until other traffic could be stalled and all SolarMan's back and forth could then be sorted and once done with that, the other traffic from the RPi could carry on again... one would have to be intelligent about actually decoding before passing on to the inverter to know whether an answer was required from the inverter and if so, what the answer should be in terms of how many bytes to expect in return etc...

6 hours ago, Sc00bs said:

Would try connecting your Raspberry Pi using a USB/RS485 adapter onto the RS485 port with the battery and inverter and see if it works. 

Were about are you located?

Hi Sc00bs, both you and Meerkat suggesting the same, so ill be checking itout when i am on site again. 

I am in Germiston, the site is Bryanston, but I have OpenVPN to use SSH via  remote  access. So i can pretty much do everything, except  moving physical connections. But i am there next week again and will try split bms connector. 

Thank you. 

7 hours ago, Sc00bs said:

At the moment the only communication on the RS485 connection is between the Inverter and the battery, you would just be adding another device onto the chain with the "splitter"

 

Thank you for all your info .  In terms of multi-master , multi-protocol  entertained on a single RS485 bus is really something  new to me , but I do understand that it can be done because the pylontech protocol and the modbus protocol has significantly different framing binary structure , so the Deye would be able to pick up on the fly what the message protocol is . Ii is just the first time I see somethin like this this . More reason to actually give it a try.

Thanks.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...