Go Down

Topic: automated switching between solar/inverter supply and grid supply (Read 763 times) previous topic - next topic


I've had a search but not found exactly what I need. Apologies if I have missed any answers to this, but most of them I read seem to work in a different way like sensing a grid outage and switching to a solar back-up, or something else.

What I want to do is supply solar power to equipment via an inverter during the daylight period, when there is sufficient PV power created, and, when the power drops below the required amount, switch over to the grid - hopefully seamlessly.

My PV array ostensibly supplies 2.1 Kw. 24 volt. My threshold for the supplied equipment is 1200 watts.

So, I am thinking some sort of voltage check of my PV output and, using an Arduino, switch from one source to the other using a relay when the voltage changes above or below the threshold.

I do not want to grid tie my supply, just use it when the sun shines to save money, then use the grid as a back up, switched in when necessary.

Does anyone know of any existing setups and coding out there [or here] that can achieve this?


Hi, I do something similar.. but basically just a "UPS : Uninterruptable Power Supply" 

I have a 12V Inverter that powers my (120V) network and DSL modem, plus an Arduino system that monitors and controls my home.    It also powers my small propane furnace that is used to keep the house (log cabin in Vermont: -5F last night!) from freezing when we travel. 

I have a small battery bank of some 12V batteries. 

If the grid goes down (4.5 days so far this Winter!) then the battery/inverter powers the net/communications/Arduino System and Furnace.

The question is: Where does the power come from?  I understand you want it to come from two places:

Priority 1:  Solar when available
Priority 2:  Grid when available
Priority 3: ?? Battery backup 

I have a high quality grid powered 12V battery charger (LINK HERE) that can charge my batteries at 45 amps from the grid. This is a very efficient power converter/charger as used in many Recreational Vehicles.  I have 3 of these on my RV, on my Tiny House off-grid and in the home here as mentioned.

So: If I had solar here I would have the solar charge controller feeding (some) battery, backed up by the grid if necessary, backed up by the battery if necessary.

Remotely monitoring all this and controlling this by an Arduino makes sense to me. See my example Here:


(I'm updating that to show grid voltage and battery voltage)

Let us know what you think would be best for you...
Regards, Terry King terry@yourduino.com  - Check great prices, devices and Arduino-related boards at http://YourDuino.com
HOW-TO: http://ArduinoInfo.Info


Thanks for the reply. I want to use the sun as a primary source, then when it gets dull or dark, to automatically switch to the mains. Then when the sun comes out again, or the next day, switch back onto solar power.

I would of course have batteries in the system which could be trickle charging when the sun is not strong enough to give me the required power for the connected load, that is when the mains electricity is being used to power the load but when there is still something being output from the PV panels.


A couple of things come to mind. My inverter has a signal output that provides a closure for exactly the purpose.  It is programmable as to power threshold and also time, so if that is available to you it is easy to monitor via arduino and switch supplies as you need.  If that isn't available, then you could use sunlight as a proxy, for example measure the sunlight intensity (LDR, photodiode etc) and switch accordingly.   This would need a bit of experimentation to set up appropriate switching conditions. 

In terms of set up, I'd build the fail condition to be grid supply, so that the solar is available it is pulled on, especially if the continuous operation of the supported equipment is important to you. 

That also raises the question of the changeover arrangements. The simple approach is to depend on the reaction of the monitoring process and changeover time of the relay contacts, but that assumes the equipment is tolerant of any dropouts or spiking that may occur at changeover.  In addition relay contacts bounce causing spikes to be fed towards your equipment.  Some form of filtering on the equipment side of the relay contacts may be needed. 

It's an interesting challenge, and one that I think needs a bit of thought and design input.


Would it be possible to incorporate some large capacitors to cover the dropout during changeover? I am slightly outside my knowledge field with this question, but I have the feeling capacitors can store and release charge, thereby smoothing the flow. Anybody?


In short, yes, although it is a bit more than a couple of large capacitors.  You have a battery of cells in the system, and they are perfectly suited to acting as surge protectors.  I'd look at having those running the equipment if that's possible, then charging the battery either by solar when available or grid when solar is off.  In that way, the equipment is always powered, and is efffectively isolated from any transients on the supply side. 


Its difficult to run a conventional  inverter directly from Solar panels, as Solar panels behave like a current source, and inverters need a voltage source like a battery, so you will need a battery of some sort between the Solar panels and the Inverter, and also some kind of charge controller to charge the battery.

Go Up