Automatic PSU changer

Thread Starter


Joined Jan 7, 2016
I want to supply power to a device that runs on 12VDC and needs about 2 Amps. Preferably it will be fed by a 24V (solar) battery. But when the battery voltage drops under e.g. 25V, it should automatically switch to a PSU 240AC-> 24VDC. The detection of the battery voltage is done by a µcomp. (ESP32) It switches a relay (double pole) ON when the battery voltage is above 26.4 V (battery full) and switches the relay OFF when the voltage drops to 25V so that the PSU takes over.
Important is that my device needs constantly 12V. So I came up with following diagram :
View attachment 271917
When the voltage rises above 26.4V, the relay comes ON, and the 240VAC falls off. The 24 -> 12V converter gets its power from the battery. Works perfect. The capacitor is large enough to maintain the feed to the converter while the relay is switching. (As long the converter gets more than let's say 13 or 14 Volts, it will deliver the 12V at its output.
When the voltage goes below 25V, the relay falls off and switches on the 240VAC over its NC contact. I would suppose that the capacitor AGAIN would maintain the 24V to the converter, but it doesn't... I know that it takes some time before the PSU reaches 24V, but the capacitor together with the input capacitor in the 24->12 converter should keep up at least 12V. The voltage over the capacitor drops to +/- 6VDC and slowly builds up to 24V. (Although it WAS charged to 25 to 29V by the battery) My device is without power during approx. 1 second. And that is unacceptable... No matter how big I make the capacitor, I always get the voltage drop... (If the capacitor gets too big, the PSU cannot charge it at all, although the capacitor is not "empty" : 25V ...)

Where is my mistake ? Aren't the diodes supposed to keep the stored power in the capacitor from going in the wrong direction ?

Thanks in advance for your advice !!!



Joined Feb 24, 2006
The capacitor is discharging through a low impedance. Knowing the value of the capacitor and the time it takes to discharge will allow you to estimate the impedance of the discharge path.

Note: Your schematic is deficient because there are no reference designators or part numbers/values on the components. Makes it hard to speculate on what is happening. At the moment, I do not suspect that the diodes are conducting in the reverse direction, but until we have more information everything is on the table.


Joined Nov 6, 2012
The trick here, is first-off, don't use a Relay if You don't have to.
( although using 2 Relays and a few other components could be done )

Second, adjust the "cut-in", and "cut-out" Voltages so that they overlap, which will cause
both Power-Sources to be "On" during the transition period.

This can be done by monitoring the Output Voltage of the "Solar-Battery", and
when it drops below a specific, set Voltage, the Line-Powered-Supply is turned "On",
then if the "Solar-Battery" further drops to an unacceptably low level, it will be disconnected.
Then there is the least possibility of loosing Power.

Doing this with a gigantic-Capacitor is not a practical plan.

Can You construct a relatively simple Electronic-Circuit ?

Does your "Solar-Battery" BMS-Circuit have a "Low-Battery-Warning-Light" Output ?,
that provides an indication that the Voltage is getting too low,
and the BMS may soon turn-off the Output to protect the Battery ?


Joined Jan 30, 2016
As already said, we need to know component values, type & spec of PSU, etc.

However, very few PSU will start at full output volts into a capacitive load as it looks like a short circuit. You say your load consumes 2A@ 12v, thats approx 1.2A at 24v. You say your capacitor drops to 6v during the switchover which takes about 1s in total. So we can surmise, as a 1st approximation, crudely, that your capacitor is around 30 - 50,000uF? To recharge the capacitor back to at least 14v and continue to drive the buck converter without a dropout is going to need potentially several 10s of amps. Its the wrong approach!

As @LowQCab has said, you need to soft start the PSU before the solar battery disconnects. With the diodes in place as you have them whichever is the higher voltage will deliver power to the converter, the other will just be idling, and junk the capacitor. A good PSU with no load will consume virtually nothing.

Thread Starter


Joined Jan 7, 2016
Sorry for my late reply. Nevertheless : thanks to all who replied to my question and tried to help me.
But I decided to go with different approach : instead of switching from battery power to mains power at the load, I'll simply start a battery charger (with build in diode! and capable to feed my load) at a certain point (23V). The load (24->12V converter) will be constantly on the battery. I'll switch the charger OFF after a certain time and the sun hopefully will take over. If there's not enough sun, the charger will start again.

For those who are still interested :
The diodes are MUR420 (5A diodes)
The capacitor : I tried from 1000µF to 10000µF but as said before : if I go over 4700µF the power supply (24V/4A) sees a (semi) short-circuit and goes in protection mode (=OFF).
The whole system is build around an ESP32 + TFT that gets info from the solar panel controller over RS232.