Changes To Solar Controller Setup
A few days ago, we got the exterior of our house painted. I had to move a lot of things out of the way for the painters so they can paint in every nook and corner. During that time I had to disconnect my solar controller electronics setup. What that means is that the solar charge controller takes over the responsibility of deciding when to charge my battery and when to disconnect the grid and let the load run from the battery + solar etc. Unfortunately the way it handles switching between battery, solar and grid is not as optimal as I’d like. Don’t get me wrong, it does a good job, but I always want something better which is why I built my own electronics and software intelligence to go with it to optimize the hell out of the solar panel output.
For those of you who don’t already know, I have a hybrid solar setup. Basically I have a battery which is connected both to the grid via a UPS and a solar panel via solar charge controller. Which means when there is sun, the battery charges from the solar panel and in the night the battery get charged by the grid. So when does the battery discharge? When there is no power from grid. But what if there is power all the time and the battery is already fully charged? The power generated by the solar panels goes to waste? No. The solar charge controller is smart enough to divert the energy from the solar panel + battery to run the household electricity requirements like fans, TV etc (aka load).
What if the load is lower than what is being produced by the solar panel? Let’s say the solar panel generates 200W but my load is only 150W. What happens to the 50W that the solar panel is generating in excess? Well it is lost, wasted, unused and so on. Which is why I built some electronics and some software smarts to make sure the battery is not fully charged before the sun comes out. Basically my electronics simulates a power outage at around 6 am which causes the UPS to divert power from the battery to the house. The battery will slowly drain to may be about 90% when the sun is up at around 8 am. From there on, the solar panel and battery share the load. Since the sun is not bright enough yet to deliver enough power to manage the load.
Later, by around 11 am, the battery would have drained to 80%, but there is more power generated by the solar panel than can be used by the load. So the excess power is used to charge the battery. By around 3 pm lets say the battery is charged to about 90% and then starts to go down from there because the solar panel is unable to generate enough power from the setting sun to match the load. Once the battery level starts to go down, the electronics will simulate grid availability at which point the battery charges via grid for the rest of the evening until it becomes fully charged to 100% by midnight or so. That way I am not losing any excess energy from the sun.
Of course if I had net metering I wouldn’t have to go through this circus and instead send the power back to grid and offset my electricity bill. Anyway, this was the electronics setup that I had to remove during the painting work. After about 10 days of painting work I reconnected my electronics and there was a problem. If you know my setup, my electronics (arduino) outside the house collect data (solar, grid, load voltages and currents) and send them to an android device inside the house. That android app is the brains. The communication between the outside electronics and inside android happens over bluetooth.
Before the painting work, the distance between the inside and outside devices was just about at the end of bluetooth range. After the painting work somehow they went out of range from each other and would not communicate. So I had no choice but to change my design. Instead of using an arduino and a bluetooth device, I replaced them both with an ESP8266. Now instead of sending data to android via bluetooth, the ESP8266 opens a network port and communicates via server socket. I changed both the android and arduino code to use wifi network instead of bluetooth. This greatly simplified both my code and wiring.
However, there is a problem – my router was out of range of ESP8266. So it could not connect to wifi. Fortunately I have a backup router (I almost always have backups for various things) which I added to the home network and kept it close to the outside wall so ESP8266 can connect to it. Yet that was still not the end of my problems. I noticed that the communication between android and arduino keeps timing out in spite of having good network connectivity. After much troubleshooting I finally found out that if I have a lot of SoftwareSerial
communication on ESP8266, it messes up the wifi data because the CPU is starved.
I use SoftwareSerial
to get data from PZEM004-T sensors which collect voltage and current values of grid and load. Long story short, I had to rewrite my code to reduce serial data communication when there is an active wifi data transfer happening. That fixed all the problems finally. So thanks to the painting work my solar controller design has changed again. Have to see how long it takes to make another change. I have been changing my design in one way or the other every 6 months or so since installing the solar panel in 2021. These are the kind of projects that keep me super busy even after early retirement :).
If you are interested, here are some of the previous modifications I’ve made to my solar setup:
- Collecting Data From Solar Panel Setup
- Getting The Most Out Of Solar Panels
- Solar Panel Project Update - Part 1
- Solar Panel Project Update - Part 2
- Solar Panel Project Update - Part 3
- Solar Panel Project Update - Part 4
- Solar Panel Project Update - Part 5