Using a relay to switch between mains and battery

Hi Guys

I am currently running a system where I have 12v mains and 12v battery as power sources.
I am using a toggle switch to manually switch between mains and batter when the power fails.

I have been considering using a relay to automatically switch over. The relay can be powered by mains, thus when that power fails, it will automatically fail over to batter.

The ideal situation is that the switch over is not noticeable and I have put some fairly large caps at the load to absorb spikes as well as hold the load while the switch is switched over.

However if I now put the relay on the 12v mains, it will only switch over once the load caps have depleted, and after that any caps on the 5v regulator will also take a little time to discharge, there will be a noticeable switch over.

One solution is to put a diode on the mains line, but won’t this cause a drop in voltage and about a 5% loss? My load can be up to 3A, so I’ll need quite a hefty diode.

Are there any other solutions, suggestions ?

12v is far more than is needed , you can go down to less than 9v. Use the diode. The loss is current times 0.6V, so 0.5A x 0.6v gives negligible power loss.

Weedpharma

weedpharma: 12v is far more than is needed , you can go down to less than 9v. Use the diode. The loss is current times 0.6V, so 0.5A x 0.6v gives negligible power loss.

Weedpharma

It sounds like there are other things on this supply which might not be as tolerant of a voltage drop if they're consuming 3A. 1.5W is a considerable power.

Can you generate a switching signal digitally based on sensing the mains output voltage?

If you have a diode on each supply these can take the load temporarily while the relay is switched, 1ms?

"It sounds like there are other things on this supply which might not be as tolerant of a voltage drop if they're consuming 3A. 1.5W is a considerable power."

I did miss the load of 3A. However 1.5W from a mains source is still negligible. When on battery, it is for a relatively short time so the battery should take the power into account.

The capacitor needs to be rated to supply 3A for the changeover time.

Weedpharma

Either way I think the required change boils down to driving the relay control from a digital signal, instead of directly using the mains supply voltage.

The simplest version is a comparator against a minimum cut off voltage (divided from the battery supply).

Relay control = Vmains > 0.9* Vbattery

There is probably an automotive IC that does this all automatically, but that might take the fun or of it.

Is the battery a re-chageable battery?
If so it should be possible to organize things so there is no need for a switch - mains charges battery, battery powers Arduino.

…R

That's a simpler solution I'll admit, but with the diode Jasonkaler seems to be concerned power will flow back into the mains supply when off, is this a real issue?

CommonRodent: That's a simpler solution I'll admit, but with the diode Jasonkaler seems to be concerned power will flow back into the mains supply when off, is this a real issue?

Why I don't want power going back to the mains side is because this will cause the relay to still be active for a while after the power has failed and it will only switch over once all the capacitors have depleted.

Where on the datasheet of diodes do I see the voltage drop? Is that the instantaneous forward voltage table?

Forward voltage, yes. Should be in the area of 0.3v for schottky diode, 0.7v for normal.

Robin2’s suggestion was for the case the battery is recharged by the mains supply and didn’t need any switching relays.

I think you’re suggesting the relay control current comes directly from the mains supply and a resistor. One op-amp/comparator could set an arbitrary threshold on when you switch such as 11V, so you don’t have to wait for it to fully discharge.

This is a very crude diagram of what I have in mind

mains — battery charger ---- battery ---- Arduino

If the battery charger stops charging the Arduino won’t know until the battery runs flat.

Obviously this needs a battery charger that can be left on continuously - basically one with a low enough voltage so that it can never overcharge the battery.

…R

Thanks for all the input so far. Here is a basic diagram: |500x260

Load is 12v 3A When power fails, because of caps c1 and c2, the relay will take a while to turn off after power has failed. So that's why I think I need diodes, with two possible placements identified.

position "diode 1" looks like a good place as this only drops the mains voltage and leaves battery to run at full efficiency. This should work, right?

Also, batteries and mains rated at 12v are quite often a bit more, usually 12.5 or 12.7, so some voltage drop may not be noticeable to the load.

@Robin2 - battery is solar charged.

jasonkaler: @Robin2 - battery is solar charged.

I can't see the logic of that if the battery is just a standby in case of mains failure - but it's your project.

I could understand a solar powered system that used the mains as a standby if the battery voltage fell too low.

...R

Robin2:
I can’t see the logic of that if the battery is just a standby in case of mains failure - but it’s your project.

I could understand a solar powered system that used the mains as a standby if the battery voltage fell too low.

…R

Here in South Africa our electricity supply is not guaranteed - in fact it is out about 10% of the time, so solar power is a backup.
Think of it like a UPS on a PC, it’s primary use is for when the power cuts out.

jasonkaler: Here in South Africa our electricity supply is not guaranteed - in fact it is out about 10% of the time, so solar power is a backup.

I completely see the need for backup. I'm just not clear why solar power is relevant.

Whereas it would be easy to understand the use of solar power to reduce the demand for expensive mains power.

However these are just idle thoughts to do with economics rather than programming.

...R