PV Inverter - monit...
 
Notifications
Clear all

PV Inverter - monitoring and control using Modbus & RS485

20 Posts
5 Users
14 Likes
342 Views
Majordennisbloodnok
(@majordennisbloodnok)
Noble Member Member
3712 kWhs
Joined: 2 years ago
Posts: 327
Topic starter  

I said in another thread that I would put together this post as a chronicle of clean sheet to where we are now, so here it is.

It has been quite a while since my wife and I decided to dip our toes into the world of solar panels and sustainable heating, and boy what a rabbit warren it has been. The reason I've decided to post this new thread is to take our initial install as the starting point and give you an idea of where we've gone from there in case it helps any of you. I'll be bringing in some other topics too where they have a bearing so be prepared for a bit of a "War and Peace" post.

So firstly a bit of background. As you can see from my signature, our home is a bungalow built around the 1920s and since extended by previous owners to give a current floor space of around 105 square metres. It is far enough off the beaten track that whilst it has mains electricity and water, that's about it. No mains gas, no mains sewage and surrounded by a small number of absolutely lovely neighbours and lots of fields and woodland. For us it's idyllic. For someone who likes shops and theatres just round the corner it'd be a nightmare.

When we first moved in the house was heated by a Worcester Bosch oil-fired boiler and there was a 1,000-litre oil tank in the front garden. That needed to be filled twice a year and, with prices as they were then, this meant heating and hot water cost us around £1,300-1,500 per year. Cooking was - and still is - dealt with by means of two 47kg propane bottles which, once again, last us just over a year. Finally, we had a wood-burning stove capable of using the plentiful (once seasoned) supply of firewood from the surrounding area.

My wife and I recognised the oil boiler was coming to the end of its useful life and we didn't want to replace like for like given the patent good sense in trying to look after the planet. We were in a position to be able to spend more than the cost of a replacement boiler and so looked around at what might be a good option. We also thought some solar panels might be a good idea and so researched them too, but weren't sure which we would be likely to do first. In the end, a bit of an expensive hiccup with our boiler convinced us that heating was a higher priority than generating energy and so we concentrated on narrowing down our options; the impending cessation of the RHI scheme also added a degree of impetus to our search. After much eliminating we decided an air source heat pump was the way to go and, once again after discounting several potential suppliers, we found Doré Woodman based in Gatwick. They did a lot more listening than talking and so came up with a plan we felt really did suit our needs with the result we booked an installation ready for December 2021.

Then our local County Council decided to team up with Solar Together to offer a bulk-buy scheme to reduce the cost of the kit and a tendering process to choose an installer - Infinity Renewables in the end - for all the interested people. The cost saving for us meant that effectively we could get a 6kWh battery for free compared with the quotes we'd been getting before so we bit the bullet and said yes to that installation too. As luck would have it, a few customers dropping out meant we were able to be fitted in earlier than expected - December 2021!

So both air source heat pump and solar PV were being fitted at about the same time. I've already mentioned on other threads about our experiences but to summarise I'll simply say that Doré Woodman were outstanding and heartily to be recommended whilst Infinity Renewables were workmanlike; they got the job done but I would neither recommend them nor suggest they be avoided. What it meant, however, was that we ended up with:

  • A Mitsubishi Ecodan air source heat pump controlled locally by a Mitsubishi wall unit and controlled remotely by means of the Melcloud app (both web app and phone app).
  • A 6.5kWp solar array.
  • A 6kWh Growatt battery.
  • A Growatt inverter controlled remotely by means of the ShinePhone app or the Growatt web app.

Having already switched to Octopus Energy as our electricity supplier, we inevitably set up an export tariff with them, choosing the Octopus Outgoing Agile tariff. A bit of a runaround with UK Power Networks meant that this wasn't up and running until March 2022 but this still allowed us to be operational for the summer months. This setup, operated largely as delivered, provided us with a significant saving on our operating costs with our heating and hot water bill going down by about a third but then about £500 being paid back to us for electricity exported. The RHI reduced our ASHP installation costs down to about £4,000 net (into the realms of an expensive gas boiler and tank replacement that we'd largely have had to spend anyway) and the £7,500 we spent on the solar PV was easy to see reflected in an increase in the value of the house.

After that first year of bedding in, we started looking at areas we still felt could be improved. The first of those was to look at our tariffs and, whilst we were very happy sticking with the Agile export tariff we decided to switch to an Agile import tariff as well. At the time we were paying about 46p per kWh imported and whilst we were being paid handsomely for exports (at times in the region of 35p/kWh) that was only when the sun was shining. Switching to Agile throughout has meant a reduction to a net average price per imported kWh of around 20p.

All well and good, but my wife and I identified several areas where we could do with using this new kit a bit more intelligently.

  1. The ASHP was set up already to use weather compensation but was there anything we could tweak to significantly improve its cost effectiveness?
  2. The solar PV solution was already set up so that it would follow a hierarchy of generation and consumption i.e. if it was generating it would fulfill our consumption first, then pile excess into the battery and then, if the battery was full, export the remainder to the grid. Similarly, if it was not generating it would allow us to pull from the battery first and only fall back on the grid after that. However, it was not reacting to times of negative energy prices and it was not husbanding the battery charge to fulfill load at times of highest prices.
  3. We were sure there were ways in which the kit could be operated differently during times of sunny weather and times of overcast weather which would maximise the benefits and minimise the costs.
  4. We knew we could get all manner of information from Octopus about historic and future prices, about historic imports and exports, about current and upcoming saving sessions, plunge alerts and so on. However, we had no way to make use of this since neither Mitsubishi nor Growatt provided any equivalent to GivEnergy's Octopus integration.
  5. We knew it was perfectly possible to retrieve all manner of environmental information from the Internet including weather forecasts and so forth. Once again, could we integrate that information in with the other data to produce something significantly smarter than what we had already?

Contrary to the views of several well respected members on this forum, I was not significantly concerned about the kit communicating with manufacturers' cloud solutions as long as it didn't involve my or my family's personal data being transmitted. As such, I was in no great fight to try to ensure all measured data stayed locally.

Our first step was to create a custom schedule for heating the hot water. My wife reasoned that during the summer it makes little sense to heat the water at night time rates after someone has had a shower just before going to bed (or early in the morning) when you can let the water in the tank stay cold until around 10am and heat it using home grown electricity. I have yet to measure the effect of that but I think it was worthwhile albeit not a huge inroad. It did, however, underline that our thinking was now moving to how best to get the different bits of kit working in unison rather than just how to tweak each separately. As a result, we decided the sensible next step was to get some form of home automation system; a central brain, if you will, that could interact both ways with various different pieces of kit and perform logical changes based on different scenarios. In IT speak, that's IFTTT (If This Then That).

There are several contenders for home automation systems but many need one to buy a hub and many others are rather limited in their support across a range of brands. The one that stood out to us was Home Assistant based on its ability to integrate with a huge range of manufacturers' products. Being open source, it required me to download some stuff and actually install it, and it needed me to have a chat with my work to see if they had an old PC that was being replaced (they had and were kind enough to give it to me instead of scrap it) so that I had something to install it onto. After that it was all pretty straightforward to get up and running. The idea with Home Assistant is that if you have something you want to monitor or automate you tell Home Assistant to install an integration for that device, so I immediately installed the Melcloud integration meaning Home Assistant could then do what I can do with the Melcloud app.

Adding in integrations for Octopus, a couple of weather forecasts and a solar generation forecast (who knew one existed, eh?) meant we were able to get plenty of the kind of data needed to make decisions and we just needed to integrate the solar PV. Unfortunately we found Growatt were making regular changes to the way their systems work which, whether intentionally or not, were frustrating the integration's ability to connect at all. Moreover, Growatt's web and phone apps are fine for a visual representation of what's going on but despite having functionality to change settings manually that functionality doesn't always work - I can't even change the inverter's date and time! No integration, no control, no automation.

At this point I should explain that my and my wife's jobs rely heavily on our computers and our Internet connection. As a result, instead of just using an ISP's router and WiFi and hoping for the best we've got something a bit more robust. We have some structured cabling installed (network sockets in the walls with hidden wires routed back up to a central point) just as you might expect in an office building and that all comes together at a patch panel in a small network cabinet in the loft. Also in that network cabinet is our network switch, meaning we can plug our computers into the wall with a network cable and attach to the local network and the Internet at far better speeds than WiFi would allow. This is all relevant in this posting because of where the inverter is installed - outside.

The inverter itself is a Growatt SPH5000 and the installation manual shows that it comes with several interface connections inside a waterproof cover, allowing the inverter to communicate with other devices - the battery is an obvious example.

image

The inverter also has a WiFi module connected to the serial port allowing the inverter to communicate via our network back to Growatt's servers. I hoped I might be able to in some way talk with this WiFi interface but all attempts tended to suggest communication is one way - the inverter pushing and pulling, not something else pushing to and pulling from the inverter. This meant my only remaining choice was to talk with the inverter using Modbus. I won't go into detail about what Modbus is since that has been covered by other threads on the forum, but suffice to say it needs a physical connection to the inverter so there's some line over which to talk.

I was fortunate enough that the installers left the 485 interface free. The 485 interface itself is presented as an RJ45 socket so it is possible to plug a standard network cable into it. However, whilst you might well use a network cable, it is most certainly not a network interface and if you were to plug the other end of the network cable into a network switch or router you would kill the port you plugged it into, so DO NOT do that. Instead, think of the RS458 port as a weirdly shaped serial port which, in fact, it is. Given the inverter and battery are installed outside, I couldn't just put a Raspberry Pi or similar next to it and simply wire it into the RS485 socket. Similarly, my home automation box currently sits in a completely different location. Net result is that even with a long cable it would not be practical to just plug one end into the inverter and the other into a computer serial port.

My solution was actually simple even if it sounds complicated. A long network cable with an RJ45 connection on one end was plugged into the RS485 socket on the inverter. That cable was routed in a nice hidden way back into my loft where the other end of the cable was wired into the patch panel. In effect, that meant that the inverter's socket had been "moved" into my loft without moving the inverter itself. From there I plugged another wire into the patch panel and could connect the other end of that wire into either a computer's serial port or, as I did in the end, an RS485 to Ethernet converter. The one I used was a WaveShare box as shown below

image

The awkward bit was that there are eight wires in a standard network cable and only two wires needed for the Modbus connection. What little documentation was available on the Internet was quite conflicting so there was quite a bit of trial and error to find which two wires were needed and which way round to connect them. For avoidance of doubt, I found the two wires are the middle two (i.e. wires 4 and 5) and wire 4 (normally the blue wire) connects to RS485B terminal and wire 5 (normally blue and white) connects to RS485A terminal. In addition, I needed to spend some quality time in front of the inverter itself pressing buttons to change the RS485 port to VPP mode. With this done, I was able to plug the converter into my network switch, follow the documentation to access its configuration and do the sensible stuff (give it a static network address and change the admin password). I also changed its serial settings to slow down the baud rate to 9600 since I'd read Growatt boxes aren't happy with rates higher than that.

Finally I turned my attention back to Home Assistant and installed the Solax Inverter Modbus integration and configured it to connect to the WaveShare box. Once again, for avoidance of confusion the details are that the inverter type was "growatt" (lower case), the modbus address was 1, the IP address was the one I gave it and the mode was "Modbus TCP"; I wasted a lot of time trying various combinations of wires and addresses whilst choosing "Modbus RTU over TCP" since that's what was suggested in other helpful posts, but "Modbus TCP" did the trick.

That leaves me now with a Home Assistant server that:

  • knows what my past, current and future Octopus prices are for import and export,
  • knows what the weather is predicted to be,
  • knows what the temperature is outside
  • has reasonably comprehensive control of my ASHP (knowing room and DHW temperatures and being able to tell it to heat or not) and
  • has proper control via local connection of my inverter (knowing how much solar is being produced, battery state of charge and so forth) with the ability to decide where the generated electricity should go and whether or not to discharge the battery to the grid or not.

Phew!

It so happens there are also integrations for other things as well and I use Home Assistant to monitor my network and other fun stuff as well. I am now happy I have a modular and extensible system that can integrate all my smart devices as comprehensively or not as I want - CCTV, propagation lights attached to smart switches, printer and so on. My next job is to actually put in the rules to decide exactly how I want the weather, the time of day and the fluctuating energy prices to influence what my solar PV and ASHP do, but that's another story.

 

This topic was modified 1 month ago by Mars

105 m2 bungalow in South East England
Mitsubishi Ecodan 8.5 kW air source heat pump
18 x 360W solar panels
1 x 6 kW GroWatt battery and inverter
Raised beds for home-grown veg and chickens for eggs

"Semper in excretia; suus solum profundum variat"


   
Mars reacted
Quote
Transparent
(@transparent)
Famed Member Moderator
7934 kWhs
Veteran Expert
Joined: 2 years ago
Posts: 1318
 

Is there a possibility that the title of this topic could be changed to attract those who, in future, would like to learn about using Modbus/RS485 for control of a heat pump?

That could probably also be achieved with appropriate keyword tags. But I'm unsure how the search system is tuned to these. @editor ?

Save energy... recycle electrons!


   
ReplyQuote
Majordennisbloodnok
(@majordennisbloodnok)
Noble Member Member
3712 kWhs
Joined: 2 years ago
Posts: 327
Topic starter  

Posted by: @transparent

Is there a possibility that the title of this topic could be changed to attract those who, in future, would like to learn about using Modbus/RS485 for control of a heat pump?

Not to be pedantic (well alright, yes it is being pedantic) I'm using Modbus to control an inverter. I'm still umming and ahhing about getting a Modbus module for the heat pump since it currently does what I need through the Melcloud sevice.

All that said, happy for the topic title to be adjusted as much as deemed necessary to help people and also for the thread to be moved to whatever section might help if I picked the wrong place initially.

 

105 m2 bungalow in South East England
Mitsubishi Ecodan 8.5 kW air source heat pump
18 x 360W solar panels
1 x 6 kW GroWatt battery and inverter
Raised beds for home-grown veg and chickens for eggs

"Semper in excretia; suus solum profundum variat"


   
ReplyQuote



Mars
 Mars
(@editor)
Illustrious Member Admin
15972 kWhs
Veteran
Joined: 3 years ago
Posts: 2269
 

@transparent happy to do that. What do you think would be good title?

Buy Bodge Buster – Homeowner Air Source Heat Pump Installation Guide: https://amzn.to/3NVndlU

Follow our sustainability journey at My Home Farm: https://myhomefarm.co.uk


   
ReplyQuote
Transparent
(@transparent)
Famed Member Moderator
7934 kWhs
Veteran Expert
Joined: 2 years ago
Posts: 1318
 

What about "PV Inverter - monitoring and control using Modbus & RS485"

It's descriptive, but doesn't exactly roll off the tongue.

But that's what happens when I try to be creative after 9pm 🤨 

Save energy... recycle electrons!


   
ReplyQuote
Mars
 Mars
(@editor)
Illustrious Member Admin
15972 kWhs
Veteran
Joined: 3 years ago
Posts: 2269
 

@transparent done, and you’ve clearly got a lot more brain juice left after 9pm than I have. There’s a lot of good SEO stuff packed into your title suggestion. 😀 

Let the modbus conversation begin.

This post was modified 1 month ago by Mars

Buy Bodge Buster – Homeowner Air Source Heat Pump Installation Guide: https://amzn.to/3NVndlU

Follow our sustainability journey at My Home Farm: https://myhomefarm.co.uk


   
ReplyQuote
cathodeRay
(@cathoderay)
Famed Member Moderator
6758 kWhs
Joined: 2 years ago
Posts: 1381
 

Posted by: @editor

Let the modbus conversation begin.

Don't forget I have been talking about it for ages! It has many advantages. It is (if your heat pump/inverter/whatever has a modbus interface, which many do, once you have worked out how to do it, which is often the hardest part given typically sparse documentation) and very simple and reliable two wire plus earth if needed connection over which you can read your device's data and set its controls using basic python scripts. The result is you have a custom monitor and controller for your heat pump/other device(s), which can be extremely useful, for example, you can chose what data to collect, rather than being limited to what your device's manufacturer thinks you should have access to. If it is in the modbus registers. you can get it.

Furthermore, the fact you can set register values means you can control your heat pump. This opens up all sorts of possibilities, including auto-adaption (adjusting output depending on certain criteria). For example, i currently have  script that compares my actual room temp with my desired room temp, and if they too far apart, then the script adjust the heat pump output up or down to move the room temp back to where it should be. I could do the same thing for solar gain - if it is sunny, drop the output a bit, or cold wet windy days - up the output a bit. Or whatever you want, withing the limits of what is available.

At the risk of re-igniting the Home Assassin wars, it is important to be aware you do not need Home Assistant do do any of this. It is simply a personal choice, either you like Home Assistant or you don't. The key point is it is not essential, it is an add-on that some find useful. Some, like me, prefer to use their own basic python scripts, and when I say basic, I mean basic, if you can read and understand English, you have everything you need to read and write these scripts. Even if you have never done any scripting, the ideas are not complicated, for example much of the logic is contained in if-then-else statements (if this is the case, then do this, else do that eg if it is sunny, then lower the LWT a bit, else leave it where it is). In passing, the easiest way to control the LWT in these situations and still have weather compensation is to adjust the end points of the curve up or down, and then let the weather compensation do its normal thing.

Likewise, using wired ethernet or wifi is an option. Both add complexity, and if you are not a network engineer you will have to learn the basics, and you may or may not gain some advantages, or suffer some disadvantages. The beauty of the basic wired connection is that is is just like using a USB cable, which is hardly surprising, because USB and RS485 (the standard (protocol) modbus uses) are first cousins, with RS485 having the advantage it can work over far longer distances than USB.      

Midea 14kW (for now...) ASHP heating both building and DHW


   
Mars reacted
ReplyQuote
Mars
 Mars
(@editor)
Illustrious Member Admin
15972 kWhs
Veteran
Joined: 3 years ago
Posts: 2269
 

Posted by: @cathoderay

Don't forget I have been talking about it for ages!

🤣 You have the definitive modbus topic, bordering on encyclopaedic. That should have read "let a new modbus conversation begin".

This post was modified 1 month ago by Mars

Buy Bodge Buster – Homeowner Air Source Heat Pump Installation Guide: https://amzn.to/3NVndlU

Follow our sustainability journey at My Home Farm: https://myhomefarm.co.uk


   
ReplyQuote
cathodeRay
(@cathoderay)
Famed Member Moderator
6758 kWhs
Joined: 2 years ago
Posts: 1381
 

@editor - Mars, don't worry, I wasn't in any way put out, just wanted to plug some of the reasons why I think modbus has a lot to offer!

Midea 14kW (for now...) ASHP heating both building and DHW


   
Mars reacted
ReplyQuote



Majordennisbloodnok
(@majordennisbloodnok)
Noble Member Member
3712 kWhs
Joined: 2 years ago
Posts: 327
Topic starter  

Posted by: @cathoderay

Don't forget I have been talking about it for ages!

You have indeed and what you’ve been saying was invaluable for me.

Posted by: @cathoderay

… 

Furthermore, the fact you can set register values means you can control your heat pump.

….

That for me is the key. Not some philosophical discussion about local data vs cloud data but the practical one of functionality.

Posted by: @cathoderay


At the risk of re-igniting the Home Assassin wars, it is important to be aware you do not need Home Assistant do do any of this. It is simply a personal choice, either you like Home Assistant or you don't. The key point is it is not essential, it is an add-on that some find useful. Some, like me, prefer to use their own basic python scripts, and when I say basic, I mean basic, if you can read and understand English, you have everything you need to read and write these scripts.

….

Here I think you’re missing the point slightly, @cathoderay. It’s not about how easy it is to script stuff, it’s (at least for me) about pulling everything together. Whilst I no doubt could write scripts to work with my CCTV and NVR or scan my network or retrieve some diagnostic info about my printer or control my smart plugs that’s a lot of work when someone else has already done it. Nor does it need to be Home Assistant; there are several others that offer similar modular functionality. Integrating three or four things together is reasonable with custom scripts but integrating twenty or thirty is not. And before you think that’s an outrageous number, remember that most people have a printer, a router, an Internet connection, several computing devices, a smart TV and so on let alone the big ticket items like heating and solar kit.

Posted by: @cathoderay

Likewise, using wired ethernet or wifi is an option. Both add complexity, and if you are not a network engineer you will have to learn the basics, and you may or may not gain some advantages, or suffer some disadvantages. The beauty of the basic wired connection is that is is just like using a USB cable, which is hardly surprising, because USB and RS485 (the standard (protocol) modbus uses) are first cousins, with RS485 having the advantage it can work over far longer distances than USB.

….

And the downside is having to route that cable. If that’s not a problem, why add complexity? If it is a problem, why not recognise there are other options? Eventually, I’m not a fan of advocating one solution above all others; I prefer to choose the best solution after identifying what I’m trying to achieve and any constraints that come with it.

 

105 m2 bungalow in South East England
Mitsubishi Ecodan 8.5 kW air source heat pump
18 x 360W solar panels
1 x 6 kW GroWatt battery and inverter
Raised beds for home-grown veg and chickens for eggs

"Semper in excretia; suus solum profundum variat"


   
IanMK13 and Mars reacted
ReplyQuote
cathodeRay
(@cathoderay)
Famed Member Moderator
6758 kWhs
Joined: 2 years ago
Posts: 1381
 

@majordennisbloodnok - I'm not in the business of telling anyone they must do something a particular way, but I am in the business of saying there are different options, and what some (not all, because I don't know them all!) of the pros and cons are (I even said wired ethernet/wifi are options, and you might gain some advantages, and perhaps disadvantages). HA does have a lot of modules/add-ons, but they are not always easy to configure; the scripts, on the other hand, are so simple that once you have got the hang of them, they are easy to configure. Not everyone (and that includes me) has everything in their home (including that smart chip in their left buttock) hooked into their home network... I also think if someone rules out an option, then it is very useful to know why they ruled it out (so the reader can make their own assessment of whether the reason also applies to them).

By the bye, another advantage of using python scripts I forgot to mention is they allow you to store the data in csv files, while HA uses sqlite or in some cases full blown relational databases to store the data. This immediately makes the data less accessible, and furthermore, in my experience, HA can randomly corrupt its database, causing major headaches. Short of over-writing the file, it is very difficult to corrupt a csv file, and if by chance corruption does occur (has yet to happen to my Midea monitoring system), the file can be opened in a text editor to see what happened, and what can be recovered. Another relatively recent discovery is a program called 'q text as data', an absolutely brilliant bit of software that allows you to run sql queries on multiple csv (and tab separated) files, including the use of joins. It's available for most operating systems, and can be found here. That way you get the best of both worlds, the simplicity of csv files, plus the sophistication of sql queries.    

One of the great things about this forum is we get posts detailing different options, usually with comments on the pros and cons, and some practical details. That's exactly how I think a forum like this should be, a resource, and that is what I like to think we achieve with our post (our being all contributors, not just us two). 

Midea 14kW (for now...) ASHP heating both building and DHW


   
Mars reacted
ReplyQuote
Mars
 Mars
(@editor)
Illustrious Member Admin
15972 kWhs
Veteran
Joined: 3 years ago
Posts: 2269
 

I’ve missed the boat now, but this autumn I’m going to try and figure out our monitoring and will be revisiting the related topics.  

Buy Bodge Buster – Homeowner Air Source Heat Pump Installation Guide: https://amzn.to/3NVndlU

Follow our sustainability journey at My Home Farm: https://myhomefarm.co.uk


   
ReplyQuote
Page 1 / 2



Share:

Join Us!

Latest Posts

x  Powerful Protection for WordPress, from Shield Security
This Site Is Protected By
Shield Security