Closed PhillyGilly closed 1 year ago
Hi @PhillyGilly
I picked up this from Ebay UK - from a seller called Puretek. They seem to be reasonably generic - the only gotcha being the silkscreen for the RS485 cables is marked back to front - so if it doesn’t work - swap the cables.
XY-017 3.3v 5v 12v RS485 TO TTL RS485 SP3485 RS-485 Breakout For Arduino RPi
https://www.ebay.co.uk/itm/274273632839
The Arduino seems more than cabable of relaying 1 second resolution across 10-12 attributes + even storing data locally to an SD (which I’ve not debugged as yet). Certainly plenty of oomph to integrate an MQTT library and post there.
I thought about home assistant - nothing wrong with it; but went this route for a few reasons:
I’ve also found a thing called a Arduino Wemos D1 - which is a perfect client too this and can display simple red/amber/green lights + operate an external relay depending on solar availability.
I’m sure you could well do this with home assistant etc - I guess at the end of the day I preferred debugging a few hundred lines of code than configuration files :)
Regards;
Hello @RichardL64. Thanks for the helpful reply. I got the Puretek part thanks and am waiting on delivery of 50(!) sockets from China. I like to do Fritzing sketches for all my Arduino projects and it it's any use here is one for this project (although I may have the TX to RX wrong bearing in mind your comment about the screen printing.)
My Solis inverter is a six month fix to non-availability of GivEnergy G2 kit, and it's there working away without either a dongle or meter/CT which I don't want to buy. So my only option to get data is to work locally with the RS485. As I've got HA up and running (RPi4 with SSD) with a lot of my energy consumption data it suits me best to get the inverter data in there too.
The coding approach I used for my Arduino energy meter was to use the MQTT pubsub.h then; 1. on initialisation publish a json file containing the HA auto-discovery data, and 2. periodically publish the json data to be read by HA. It looks like I can merge this approach into your code.
However before I get on with it, I am wondering about whether or not it will actually work without a meter/CT. So I think I'll probably knock up an exact copy of your project and If it doesn't produce the data I need, decide if I just use my Arduino MQTT energy or have fun adding the ADS115 adc as well as the MQTT. Happy days!
Cheers.
Hi, Your diagram of the circuit looks excellent.
Re merging code I have no problem if you want to re-use anything I wrote - I do continually tweak and update it - currently working on historic data saving at various intervals to a local SD card.
Just a reference/link to where it came from is fine.
Re MQTT It doesn’t really mesh with where I want to go. The whole cloud based, or even local based, complexity of an automation server/home assistant is a separate thing - for me.
Layers of O/S alone on the R.Pi platform is over complex for just presenting data IMHO.
I think your suggestion of a copy of the project is the way to go - please share the link with me so I can link to it and we can continue to share any insight on how to talk to the inverter.
Regards;
R I C H A R D L I N C O L N @.***
On 20 Oct 2022, at 13:49, PhillyGilly @.***> wrote:
Hello @RichardL64 https://github.com/RichardL64. Thanks for the helpful reply. I got the Puretek part thanks and am waiting on delivery of 50(!) sockets from China. I like to do Fritzing sketches for all my Arduino projects and it it's any use here is one for this project (although I may have the TX to RX wrong bearing in mind your comment about the screen printing.)
https://user-images.githubusercontent.com/56273663/196941680-7278477c-b6dc-43b9-b9a6-dd054d3ff4bc.png My Solis inverter is a six month fix to non-availability of GivEnergy G2 kit, and it's there working away without either a dongle or meter/CT which I don't want to buy. So my only option to get data is to work locally with the RS485. As I've got HA up and running (RPi4 with SSD) with a lot of my energy consumption data it suits me best to get the inverter data in there too.
The coding approach I used for my Arduino energy meter was to use the MQTT pubsub.h then; 1. on initialisation publish a json file containing the HA auto-discovery data, and 2. periodically publish the json data to be read by HA. It looks like I can merge this approach into your code.
However before I get on with it, I am wondering about whether or not it will actually work without a meter/CT. So I think I'll probably knock up an exact copy of your project and If it doesn't produce the data I need, decide if I just use my Arduino MQTT energy or have fun adding the ADS115 adc as well as the MQTT. Happy days!
Cheers.
— Reply to this email directly, view it on GitHub https://github.com/RichardL64/Solar/issues/1#issuecomment-1285486618, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWDECNTIYNYBHWTZL7HROH3WEE5UVANCNFSM6AAAAAAREDOCDM. You are receiving this because you were mentioned.
Hi Richard. I just got delivery from Alibaba of the plugs. When I tested the +5V on my inverter its dead. I'm assuming that's because it goes to sleep when there is no PV? Is that your experience? I'm not sure how I feel about my nano33 rebooting multiple times per day. Cheers. Phil
Hi I don't recall any issues with power - my arduino stays up all the time - Solar or not?
I do have batteries though - don't know if that makes any difference?
My inverter never goes to sleep.
On Thu, 10 Nov 2022 at 18:47, PhillyGilly @.***> wrote:
Hi Richard. I just got delivery from Alibaba of the plugs. When I tested the +5V on my inverter its dead. I'm assuming that's because it goes to sleep when there is no PV? Is that your experience? I'm not sure how I feel about my nano33 rebooting multiple times per day. Cheers. Phil
— Reply to this email directly, view it on GitHub https://github.com/RichardL64/Solar/issues/1#issuecomment-1310749284, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWDECNXVB7LJ7QIICF7EREDWHU7KTANCNFSM6AAAAAAREDOCDM . You are receiving this because you were mentioned.Message ID: @.***>
Hi @RichardL64 . I tested my inverter with a voltmeter across the pins (Blue: pin4 = 1.6v, Yellow: pin3 = 3.2v) and it definitely powers the RS485 down if the sun isn't shining so I'll probably keep the nano USB powered for the time being. I also finally got delivery from China of the Exceedconn plugs and sockets. (I have put the remainder on sale on eBay http://ebay.co.uk/itm/195464332269 although I don't expect to make money on it, somebody else might want/need these parts). Before attempting any serious coding, I got the example ModbusRTUClientKitchenSink sketch from the IDE, cut out all the calls apart from requestFrom, and compiled it to the nano. It runs and returns 1 to ModbusRTUClient.begin(9600), but the requestFrom fails with an error "Connection timeout" whatever register address used and for both combinations of AB inputs. I'm really scratching my head, but there's no point in going any further until I can get the underlying comms working. I have ordered a USB/RS485 plug to test the comms directly from my laptop. But meanwhile, any ideas however basic would be appreciated. TIA.
Hi,
Thats odd your inverter is not supplying power - if you had the standard Solis Wifi ’stick’ that would need juice and as far as I know theres only one wifi logging stick.
R I C H A R D L I N C O L N @.***
On 17 Nov 2022, at 10:25, PhillyGilly @.***> wrote:
Hi @RichardL64 https://github.com/RichardL64 . I tested my inverter with a voltmeter across the pins (Blue: pin4 = 1.6v, Yellow: pin3 = 3.2v) and it definitely powers the RS485 down if the sun isn't shining so I'll probably keep the nano USB powered for the time being. I also finally got delivery from China of the Exceedconn plugs and sockets. (I have put the remainder on sale on eBay http://ebay.co.uk/195464332269 http://ebay.co.uk/195464332269 although I don't expect to make money on it, somebody else might want/need these parts). Before attempting any serious coding, I got the example ModbusRTUClientKitchenSink sketch from the IDE, cut out all the calls apart from requestFrom, and compiled it to the nano. It runs and returns 1 to ModbusRTUClient.begin(9600), but the requestFrom fails with an error "Connection timeout" whatever register address used and for both combinations of AB inputs. I'm really scratching my head, but there's no point in going any further until I can get the underlying comms working. I have ordered a USB/RS485 plug to test the comms directly from my laptop. But meanwhile, any ideas however basic would be appreciated. TIA.
— Reply to this email directly, view it on GitHub https://github.com/RichardL64/Solar/issues/1#issuecomment-1318415417, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWDECNWTNSRGLUDQM45WZHDWIYBX7ANCNFSM6AAAAAAREDOCDM. You are receiving this because you were mentioned.
Agreed, the display is also off when not generating. I will re-check the 5V line tonight, but when I "commissioned" it, I worked in the evening to minimise DC risks. After it was all set up, I closed the MCB and turned on the AC isolator and nothing happened. I was convinced I'd made a mistake, but the next morning when I tried again it was working. I guess that Standard Stick is designed to power down and then power up?
It's a configurable option in the Advanced settings. 24H Switch. Default is Disabled, but if you Enable it the inverter doesn't go to sleep.
Nice - result!
R I C H A R D L I N C O L N @.***
On 17 Nov 2022, at 16:16, PhillyGilly @.***> wrote:
It's a configurable option in the Advanced settings. 24H Switch. Default is Disabled, but if you Enable it the inverter doesn't go to sleep.
— Reply to this email directly, view it on GitHub https://github.com/RichardL64/Solar/issues/1#issuecomment-1318875659, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWDECNUMXUN7IFPGSVPTPNDWIZK7NANCNFSM6AAAAAAREDOCDM. You are receiving this because you were mentioned.
Mixed result.....
It looks like enabling the inverter gets it to draw 60 W when the inverter isn't generating (that's the drop off in the raw purple line). It could be a bit less as my Arduino CT doesn't know about the power factor, but I can't match it exactly to the smart meter out put as both are on 10sec samples but not aligned.
So enabling the inverter overnight could use up to 1kWh which is the opposite of what I want to achieve.
I'll get the basic 485 working next week and then devise a strategy to deal with the inverter going to sleep...
I had the rx-tx wires crossed. Here is my revised Fritzing sketch.
The example is running although I am having to offset the address by one, which I don't know if you are doing.
Sounds good…
Are you reading a 2 word register - the first word will be 0 unless the lower word overflows - i.e. big endian format.
This is my snippet that reads a particular address The address is in 3xxxx format, size is 1 or 2 depending on its size
The if (size==2) stuff is shifting the first word 16 bits then adding int the second. You can equally read the address+1 if you ‘know’ the high word is 0 and get the same result.
if (ModbusRTUClient.requestFrom(1, cmd, address, size)) { long value = 0; if (size == 2) value = ModbusRTUClient.read() << 16; // 32 bit High 16 value |= ModbusRTUClient.read(); // Low 16 bits
R I C H A R D L I N C O L N @.***
On 20 Nov 2022, at 11:01, PhillyGilly @.***> wrote:
I had the rx-tx wires crossed. Here is my revised Fritzing sketch. https://user-images.githubusercontent.com/56273663/202898400-7e22401d-ae58-434a-bf2d-cbbf537fc2d1.png The example is running although I am having to offset the address by one, which I don't know if you are doing.
— Reply to this email directly, view it on GitHub https://github.com/RichardL64/Solar/issues/1#issuecomment-1321101015, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWDECNQ5HC2ARPFJENTDXODWJIAKPANCNFSM6AAAAAAREDOCDM. You are receiving this because you were mentioned.
Hi @RichardL64, I thought I'd give you a quick update:
Hi,
Looks good
Re code complexity - yes MQTT on the server end means your app can be a lot simpler.
I haven’t got into OTA updates - is that prt of MQTT or something on the Arduino?
I doubled up on arduinos to have one in test (in the house) with the other one running - production on the inverter to avoid downtime while I debug.
Regards;
R I C H A R D L I N C O L N @.***
On 25 Nov 2022, at 22:23, PhillyGilly @.***> wrote:
Hi @RichardL64 https://github.com/RichardL64, I thought I'd give you a quick update:
Up and running! https://user-images.githubusercontent.com/56273663/204039086-357a0617-a606-4495-a3a4-b5a859b52a34.png In the end my code isn't that similar to yours, because: a) I'm not a very good coder, and b) the arduino just posts out the modbus data by mqtt as soon as it reads it, so there isn't any need to hold it locally. I just keep it in global variables. If your interested I can share it with you via Github. I haven't really tried to make the functions efficient as I don't need to, so I'm not going to hold it up as an example of how to do it. My inverter S6 uses different modbus addresses from your hybrid inverter. So if I want to know what is at address 3000, I have to interrogate address 2999. This is what I meant by offsetting the address. I solved the "inverter asleep at night" problem by working on the idea that if the modbus stopped communicating it meant the inverter had powered down. When that is detected "dynamic" values are set to 0 and "integrated" values are set to their last known value. That seems to placate my Home Assistant. As the arduino is in my loft next to the inverter which is five flights of stairs up from my office, so I use OTA and don't bother with any serial print for error traps. If I do want to know what's happening, I publish a mqtt message. I still need to work out how to write into the modbus time registers as I need to synchronise times so that "daily" values are for the same 24hrs. I have no idea how to take the time values as strings and convert the right bits into unsigned-16 but I'm sure that somebody somewhere has cracked it already. Cheers and thank you! — Reply to this email directly, view it on GitHub https://github.com/RichardL64/Solar/issues/1#issuecomment-1327914197, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWDECNX2LI2ACXF24RXQAALWKE34PANCNFSM6AAAAAAREDOCDM. You are receiving this because you were mentioned.
Here is my first attempt at a repository https://github.com/PhillyGilly/SolarisS6ArduinoMqtt I am going to have to work on formatting my reade.md and adding pictures.
OTA is part of #include
Hello @RichardL64 this is a really neat project. I am going to install a Solis S6 inverter next week (whilst waiting ever longer delayed GivEnergy hybrid inverter) and have a crack at this. I have used the Arduino nano33 to monitor power in circuits via a Clamp Transformer so this looks like a good next project. Which RS485 interface did you use? I can see HW-0519 on the circuit board but need another pointer. I had trouble sourcing the Exceedconn plug but think I may have found a reliable UK source for those. And to the point....my power meter publishes data via MQTT so that I can view/log in Home Assistant. Did you ever consider that? When I have made a bit of progress on the local version I may be able to create an MQTT capable version to feed-back if that helps?