SMART Energy Tracking for my DIY SOLAR POWER SYSTEM!
|In the last episode I built my own DIY Solar Power System – if you haven’t seen that video yet definitely check it out first – but to round off my setup for now I want to add some “smarts” to it. Namely, a way to measure how much energy I’m using, and a way to keep an eye on how much power I’m producing and plus a bit about the battery’s health too. The bits I’ll need for that are this Samsung SmartThings plug, and this ESP8266 based RS232 bridge for the Renogy charge controller I’m using. I do have a second ESP8266 I’m testing out connected to my battery’s BMS, but that one isn’t working yet so I’ll stick with this setup.
I picked the Samsung SmartThings plug because it’s a Zigbee device which means it works out of the box with my self-hosted Home Assistant setup. If you haven’t seen my DIY smart home series I’ll leave that in the cards above too as it’s worth a watch and what I’m extending here too. Anyway, this plug can both act as a smart plug that I can switch it on and off through Home Assistant, and also act as an energy monitor to track on the spot and continuous energy usage. This is great as it means I can track how much power I’m using throughout a day and track how much money I’m saving on energy bills!
As for the controller board, this is a self-assembled kit from tindie, which uses an ESP8266 as its brain, and connects to Home Assistant with MQTT over WiFi. It used an RJ12 cable to talk to the charge controller and get a surprising amount of data. Everything from the charging current to the battery to the power from the solar panels. It’ll even report the battery and controller temperatures! This’ll be really useful to track how much power I’m generating, and should even be good to let me say automate notifications for when the output isn’t great and I should move some loads off the system.
As a note on the BMS controller too, I’m using ESPHome to connect an ESP8266 to the UART port on the BMS. That should let me get all the info from the individual cell voltages to state of charge and lots more. Again the more info the better really! The thing that doesn’t work about that is the chip on the BMS that handles the UART isn’t strong enough to communicate with the ESP on it’s own, so I’ve bought an isolator/repeater board that’ll solve that. I’m just waiting on that being delivered to actually get the data working.
So I’ve got the two that I do have working connected – with the SmartThings plug it was just a case of adopting it like any other Zigbee device, and the RNGBridge board was just a soldering job to get it working. I did have to crimp my own RJ12 cable because the commercially available ones all have messed up pinouts which blew up an ESP for me. Woo. Anyway, with both connected, let’s have a go at making some use of them.
Just being able to see the instantaneous usage from the SmartThings plug has actually been really useful – knowing not to put the AC and dishwasher on at the same time to not overload it, or even just seeing how much power I’m using at any time is great to see. The cumulative count it gives is probably the more useful metric for knowing how much money I’m saving, so let’s fire up NodeRED and make an automated flow to calculate the cost savings based on the current price of electricity and the accumulated usage. I’m sure there’s blocks I could use for this, but I’m much more comfortable programming in javascript so I’m just going to use a function block.
I’ll save you the effort of explaining this mess, but in short I have this output four metrics – total cost savings, total usage, daily cost savings and daily usage. It takes into account the current price of energy and the upcoming change. I’ve since set up InfluxDB to log all my sensor data from home assistant, so the data from the SmartThings plug is being saved to the database for future reference.
As for the charge controller data, that’s something I haven’t done too much with yet. Something that’s on the cards is basically monitoring the production and usage throughout the day and send a push notification if the production isn’t exceeding usage – ie the battery isn’t being charged enough to run overnight. It could also tell me when the battery is full so I can swap loads onto solar and off grid power to save more. If you’ve got any ideas for things I should do with this data definitely let me know in the comments!
So that’s a look at adding some “smarts” to my DIY solar power system. There’s plenty more I want to do, but that’s it for now. Like I said if you have any suggestions for things I should do with all this new data do let me know in the comments below, and definitely check out both the earlier videos in the series and the DIY smart home series if you are interested!