# power supply with large capacitance between regulator and 14M2

#### wapo54001

##### Senior Member
I am designing a circuit where I want a 14M2 to continue to operate after power is lost. I need, as a minimum, to a) sense that power is lost and then b) switch two latching relays, each relay 5VDC and drawing 20ma for a minimum of 3ms in order to switch. The power to switch the two relays is stored in capacitors between the relays and ground, and the 14M2 will need to switch pins from high to low in order to sink the power from those two capacitors.

I'm thinking LP2951 regulator, 5V at 100mA, max 30V in. I want to put the storage capacitance on the regulated side because I need to save physical space (6.3V caps vs 35V caps). What I would like to know is this -- when the power fails/cut off, will the stored energy flow back through the regulator, or will it remain available for the Picaxe to continue to function for a few moments after the power quits, and how much capacitance do I need to keep the 14m2 working for "long enough" to do the job? I have space for up to 2x1000uF@6.3V.

Do I need special regulator protection due to the unusually large capacitance between the regulator and the load?

Or should I use smaller capacitors charged to 24V upstream of the regulator?

Last edited:

#### J G

##### Active member
Hello,
Using a linear regulator with an input voltage of 30V and output of 5V is wasting about 80% of the power as heat, so for maximum efficiency of getting energy from the capacitors to the picaxe and relays, I would recommend putting them on the output if this will not affect the stability of the regulator.

To stop the current flowing back through the regulator, could you use a diode on the input seeing as you have plenty of voltage to drop and the regulator will not be running for long if something weird does start to happen with the input having a voltage but the output not (I have worked on (switchmode) regulators that do really strange and potentially destructive things when power is applied to the output and not the input, but linear regulators at least can't boost voltages...).

Looking at this datasheet under section 8.2.2.1, I read this:
COUT can be increased without limit and only improves the regulator stability and transient response. Regardless of its value, the output capacitor should have a resonant frequency greater than 500 kHz.
I am not too sure how to calculate the resonant frequency in this case, but I think that this will be the limit as to how large the capacitors can be before the output voltage starts to get unstable.

Section 9 also has this:
Place input and output capacitors as close to the device as possible to take advantage of their high frequency noise filtering properties.
One thing to note however is that a 25V drop at 100mA means that the regulator will be dissipating 2.5W as heat. I am not sure if this regulator will be able to cope with this continuously as to me it looks fairly small and I haven't seen a power rating in the datasheet. If power efficiency or thermal management is important, then would using some form of switching regulator be an option that converts excess voltage into current? Otherwise for simplicity, would a fairly standared 7805 or LM317 with decent sized heatsink work?
If the full 100mA is only for brief spikes, you might be able to get away with it with the LP2951.

Good luck and have fun.
P.S. I haven't done too much with analogue electronics, so there are probably other factors that influence this as well and stuff I have stuffed up

#### PhilHornby

##### Senior Member
I am designing a circuit where I want a 14M2 to continue to operate after power is lost.
I did something similar, to interface my RF controlled 'table lamps', to originally, a plug-in timer and these days to a Sonoff S20 smartplug.

This is the circuit I came up with :-

(Ignore everything to the left of the Picaxe - that could definitely be improved!)

The 4700uF capacitor came out of my bits box and may well have been something I took out of a television in the 1970's

The idea of the 10K divider as to sense the loss of external power as soon as possible - the circuit being powered by an external 'power brick/mobile phone charger' (I have no idea why I labelled the input as 5.7V!)

The program constantly monitors the voltage at the divider - but it may be possible to generate an interrupt instead (different divider resistors, input set to schmitt ... that sort of thing).

D1, R3 supposedly handle inrush currents (I'm no hardware expert!) and D2 was definitely required in my case.

MIght be give you some ideas, if nothing else

#### AllyCat

##### Senior Member
Hi,
Or should I use smaller capacitors charged to 24V upstream of the regulator?
IMHO definitely YES ! The energy stored in a capacitor is 1/2 * C * V2, so calculate the amount of energy recovered when the voltage falls from 25v. to 7v., i.e. 1/2 * (625 - 49) * C . Compare that with the "regulated" voltage falling from 5v to (say) 4v (which is probably required to drive the relays?), i.e. 1/2 (25 - 16) * C , (although the PICaxe will keep working down to 2.5 volts or less). That suggests the output capacitor needs to be about 575 / 9 = over 60 times larger than on the input side ! Furthermore, use a switching-mode regulator and the input current will be only about 25% of the Input = Output current of a linear regulator. Thus the voltage will (initialy) fall about 4 times more slowly, for any given capacitor value; and of course no need for heatsinks.

Generally, the voltage "square law" makes the energy density of capacitors higher at higher voltages (even though the capacitance will be lower for a given can-size). The possible exception are "supercaps", but they have such a low voltage rating that you may need to connect several in series even for 5 - 7 volts.

Cheers, Alan.

J G

#### wapo54001

##### Senior Member
Hello,
Using a linear regulator with an input voltage of 30V and output of 5V is wasting about 80% of the power as heat, so for maximum efficiency of getting energy from the capacitors to the picaxe and relays, I would recommend putting them on the output if this will not affect the stability of the regulator.

To stop the current flowing back through the regulator, could you use a diode on the input seeing as you have plenty of voltage to drop and the regulator will not be running for long if something weird does start to happen with the input having a voltage but the output not (I have worked on (switchmode) regulators that do really strange and potentially destructive things when power is applied to the output and not the input, but linear regulators at least can't boost voltages...).

Looking at this datasheet under section 8.2.2.1, I read this:

I am not too sure how to calculate the resonant frequency in this case, but I think that this will be the limit as to how large the capacitors can be before the output voltage starts to get unstable.

Section 9 also has this:

One thing to note however is that a 25V drop at 100mA means that the regulator will be dissipating 2.5W as heat. I am not sure if this regulator will be able to cope with this continuously as to me it looks fairly small and I haven't seen a power rating in the datasheet. If power efficiency or thermal management is important, then would using some form of switching regulator be an option that converts excess voltage into current? Otherwise for simplicity, would a fairly standared 7805 or LM317 with decent sized heatsink work?
If the full 100mA is only for brief spikes, you might be able to get away with it with the LP2951.

Good luck and have fun.
P.S. I haven't done too much with analogue electronics, so there are probably other factors that influence this as well and stuff I have stuffed up
Thanks for the reply -- some good info here to consider. The 100mA is the capability of the regulator, I will be drawing -- typically -- only the power needed to run the 14M2 to monitor power on/off and check an input selector as high or low. Only additional draw will be from the relays when they change state -- requiring 20ma each but one at a time, and only for about 3~5 milliseconds each. Power requirement is very low.

The resonant frequency thing is a show stopper for me -- no idea how to figure that -- so will put the capacitance I can upstream of the regulator. So it'll be two 470uF/35V capacitors storing the supply voltage of 24 volts. Hope that'll be enough to run the 14M2 long enough to switch two relays.

#### wapo54001

##### Senior Member
Hi,

IMHO definitely YES ! The energy stored in a capacitor is 1/2 * C * V2, so calculate the amount of energy recovered when the voltage falls from 30v. to 7v., i.e. 1/2 * (900 - 49) * C . Compare that with the "regulated" voltage falling from 5v to (say) 4v (which is probably required to drive the relays?), i.e. 1/2 (25 - 16) * C , (although the PICaxe will keep working down to 2.5 volts or less). That suggests the output capacitor needs to be about 850 / 9 = almost 100 times larger than on the input side ! Furthermore, use a switching-mode regulator and the input current will be only about 20% of the Input = Output current of a linear regulator. Thus the voltage will (initialy) fall about 5 times more slowly, for any given capacitor value; and of course no need for heatsinks.

Generally, the voltage "square law" makes the energy density of capacitors higher at higher voltages (even though the capacitance will be lower for a given can-size). The possible exception are "supercaps", but they have such a low voltage rating that you may need to connect several in series even for 5 - 7 volts.

Cheers, Alan.
Alan, as always, you have the incontrovertible FACTS. Everything seems to be pointing in that direction so I'll do it that way. I'll insert a diode to allow supply sensing to be unaffected by the capacitor storage, so the actual capacitor voltage will be about 23 volts. This solution takes a lot of uncertainty away for me, I just don't have the background to assess oddball configurations like my original idea.

#### wapo54001

##### Senior Member
I did something similar, to interface my RF controlled 'table lamps', to originally, a plug-in timer and these days to a Sonoff S20 smartplug.

This is the circuit I came up with :-

View attachment 24645

(I have no idea why I labelled the input as 5.7V!)
Probably to compensate for the voltage drop across D1?

#### rq3

##### Senior Member
I am designing a circuit where I want a 14M2 to continue to operate after power is lost. I need, as a minimum, to a) sense that power is lost and then b) switch two latching relays, each relay 5VDC and drawing 20ma for a minimum of 3ms in order to switch. The power to switch the two relays is stored in capacitors between the relays and ground, and the 14M2 will need to switch pins from high to low in order to sink the power from those two capacitors.

I'm thinking LP2951 regulator, 5V at 100mA, max 30V in. I want to put the storage capacitance on the regulated side because I need to save physical space (6.3V caps vs 35V caps). What I would like to know is this -- when the power fails/cut off, will the stored energy flow back through the regulator, or will it remain available for the Picaxe to continue to function for a few moments after the power quits, and how much capacitance do I need to keep the 14m2 working for "long enough" to do the job? I have space for up to 2x1000uF@6.3V.

Do I need special regulator protection due to the unusually large capacitance between the regulator and the load?

Or should I use smaller capacitors charged to 24V upstream of the regulator?
Most linear regulator manufacturers strongly suggest a reverse diode across the regulator I/O if an output capacitor larger than 10-20 uF (regulator dependent) is used. The reason is that, should you short the regulator input, the large cap will discharge back through the regulator, and destroy it. The reverse diode gives the cap a path to discharge through, without otherwise affecting the regulator.

#### wapo54001

##### Senior Member
Most linear regulator manufacturers strongly suggest a reverse diode across the regulator I/O if an output capacitor larger than 10-20 uF (regulator dependent) is used. The reason is that, should you short the regulator input, the large cap will discharge back through the regulator, and destroy it. The reverse diode gives the cap a path to discharge through, without otherwise affecting the regulator.
I knew something like that guidance existed, wasn't sure of the specifics at all. I don't have to worry about it now because I'm installing two 479uF capacitors upstream of the regulator with a ceramic following it.

#### papaof2

##### Senior Member
You can check the impedance (in ohms) of a capacitor at any frequency here:

That might help.

#### erco

##### Senior Member
Consider powering your project from a LiPo or Li-Ion battery like a 18650 which is perpetually charged from a 5V USB brick. All the parts are cheap and abundant. Something like:

AC supply >> USB 5V Brick >> Li-Ion charge regulator >> Li-Ion >> 5V booster (if required) >> Picaxe circuit

Most of my projects work just fine without the 5V booster.

There are cheap powerbank circuits available which combine the charge regulator and 5V booster, but many of them won't charge AND output 5V simultaneously, and some turn off +5V unless your load draws a minimum current.

Edit: ~30 cents each, charge regulators: https://www.ebay.com/itm/265078354412
5v boosters ~60 cents each : https://www.ebay.com/itm/233987653418

Last edited:

#### premelec

##### Senior Member
Given the OPs original statement and parameters... estimate 20ms .04amp .5 voltage drop.... Q=CV=IT or C = IT/v hence .(04x.02)/.5 = .0016 Farad [hopefully this is 1600uF...] so 2 x 1000uf could work... ;-0

#### inglewoodpete

##### Senior Member
I used 2 x 5F high current capacitors (in series) to run an 08M2 at 3.3v. The 08M2, in turn, drove the 'operate' winding of a 4 ohm 3v solenoid, before switching to a 230 ohm 'hold' winding. Once I sorted out the ground and power runs, the circuit ran fine. 2.5F of capacitance keeps the 08M2 running for quite a while, provided the solenoid does not need to be operated. 2 x 5F 2.7v capacitors do not take all that much space.

However, when turning the power on to charge the super caps, there was a tendency to blow fuses! A low-value resistor on the input side of the super caps fixed that, though.

#### erco

##### Senior Member
However, when turning the power on to charge the super caps, there was a tendency to blow fuses! A low-value resistor on the input side of the super caps fixed that, though.
Yes, classic gotcha problem. Big caps are dead shorts when first turned on.

#### The bear

##### Senior Member
Hi wapo54001,
There is an auto shutdown circuit somewhere on the Picaxe forum, possibly from "hippy".
It might be worth a search.
Good luck, Bear..

Bear..

#### erco

##### Senior Member
The schematic is missing from that Auto-shutdown Regulator thread. It was from 2009.

#### inglewoodpete

##### Senior Member
I am using an L4931 low dropout, low quiescent current regulator in a current project. The SO-8 package version has an enable pin that needs to be held low to keep it on. Ideal for a PIC or PICAXE to self-control its power. This regulator is available in a whole range of different output voltages.

Last edited: