Making an uninteruptable +5VDC Power Supply

Thread Starter

Wendy

Joined Mar 24, 2008
21,929
Many times we would like a project to have a battery backup if power goes out. Digital clocks are an obvious example. I am going to show how to do this using a USB power supply, I am aiming this project to beginners in electronics since this is something most experienced people already know how to do.


Why 5V?


I believe the 5V standard was born due to a logic family called TTL that came out around 1966 and captured a lot of the IC digital market in the later years. They are still used by many hobbyists. The actual voltage spec for TTL ICs is +5V ± .25VDC. While I have never tested USB power supplies, but I assume these units have the same specs. USB power supplies are not adjustable, which makes them slightly harder to use for this application. Figure 1 shows a first draft to have a battery array back up power if the AC power dies, but because it won’t meet the +4.75VDCto +5.25VDC specification I would not recommend using it. This is because diodes have a forward dropping voltage (Vf). Silicon diodes start around 0.6 Volts. The Vf goes up as current through the diode goes up. Schottky diodes start at 0.3 volts, as do Germanium diodes. Diode types are the only way to change voltage as USB power supplies are not adjustable. Even a tenth of a volt will affect how well steering diodes work. A diode that is only slightly back biased is firmly off. A diode that is on is a bit mushy on its Vf. However, USB power supplies they are incredibly cheap, too cheap to ignore.

...................UPS 5V f1.png
............................................................
Figure 1
Figure 2 shows a scheme that is slightly simpler, but has the same problem as Figure 1 will be 4.7V or 4.4V.

..................UPS 5V f2.png
............................................................
Figure 2

So we will have to do this another way. Many devices work well down to +2VDC, among these are digital comparators. The LM393 is a quad comparator, and goes down to 2VDC for power minimum spec. Figure 3 and Figure 4 Both use the 1.2 voltage of NiCads and lithium batteries to good advantage, Figure4 has a nod to keeping the NiCads charged with the addition of R1. NiCads do go bad after time. If I were to pick a schematic I’d use Figure 3.



............................................................UPS 5v F3.png
............................................................
Figure 3


............................................................UPS 5v F4.png
............................................................
Figure 4

Theory of Operation

Figure 4 adds R1 (100Ω) to keep the NiCads charged if you choose to use them. I selected a resistor that could handle fully discharged batteries without smoking at ¼W. Personally I am not a fan of NiCADs, as I find their shelf life a bit short for my tastes. Lithium, while expensive, last much longer. Alkaline batteries produce more voltage, which is not convenient for this application. As the illustration below shows. When the transistor is tuned on the emitter voltage is brought to the collector as the transistor conducts and becomes the equivalent of a closed switch. Examples 1-4 show some worst case scenarios. A common rule of thumb is to use 1/10 base current as you would have collector current, this would mean the ß was 10. Example one shows the standard illustration we use when talking about a common emitter design, while Examples 2-4 show a configuration I am using for the circuit. Since I need as much gain as I can get for this I will plan for a 2N2907a, whose minimum Beta is 50 and max is 300. Max current for this transistor is 0.6A. Some USB power supplies are rated for up to 1A but if you need the maximum current and regulation you will have to find a higher gain transistor with higher current specs. I am sure they are out there but I am using parts I would have in stock. The LM393 is speced for 16ma drive, and is represented in the Examples as S1. Examples 2-3 show why low gain or low drive current is a problem. In example 2 the transistor is not in saturation, which is a problem. This transistor will get very hot, if a transistor is fully on or fully off, a transistor will generate very little heat. It is therefore best to design the circuit to keep the transistor in saturation. Examples 2 and 3 shows the transistors in their linear region, neither on nor off. If we drop our current requirement to ½A, all our problems go away (as illustrated in Example3), and our transistor stays saturated. So this design is speced for ½A.If your application makes the transistors hot either current or transistor gain could be the problem.

.........Examples.png
In case you missed it CR1,CR2,CR3 makes sure U1 stays powered if the USB power supply goes down. If you need more current you will have to find a better transistor for Q1 and Q2. Sometimes this is how designing goes, the design criteria of using a USB power supply created the need for compromise. Use a power supply that is adjustable and we could use the steering diodes. The comparators U1a and U1b turn Q1 and Q2 on or off depending whether backup power is needed. Comparator U1d compares the battery voltage to 4.75VDC and alerts the user if the batteries drop below this level, you may want to bump R5 down to 200Ω, (4.9VDC) to alert the user sooner if the batteries are going to be a problem. When the batteries are in use this circuit goes passive.

Note: Articles like this are my idea of fun, if it happens to be useful for you, you’re Welcome.
 

Thread Starter

Wendy

Joined Mar 24, 2008
21,929
I'll keep it in mind. I've never used the technique.

Is it a diode? what is the PIV (Peak Inverse Voltage)? Gotta know the limits before I use it.

Part Number recommendation?

If you don't know the answers, I may try it and test it to destruction.

And then, post the results on AAC...
 
Last edited:

Tonyr1084

Joined Sep 24, 2015
4,017
@Wendy If the USB goes down all together, doesn't pin 3 of the LM 339 go cold? The comparator can't do anything at zero volts. No? Or does U1B go to ground when all power is lost?

Also, a side note, figures 3 & 4 have two R2's. Not being picky, just the inspector side of me coming out.
 

Thread Starter

Wendy

Joined Mar 24, 2008
21,929
@Wendy If the USB goes down all together, doesn't pin 3 of the LM 339 go cold? The comparator can't do anything at zero volts. No? Or does U1B go to ground when all power is lost?

Also, a side note, figures 3 & 4 have two R2's. Not being picky, just the inspector side of me coming out.
I assume you are talking about Figure 3, I gave the illustrations names for the same reasons I gave the parts designations. Look at CR1, CR2,CR3. They allow the battery to take over the comparator power supply, and to switch back when the USB power supply comes back online, if you want an audible alarm add a sonalert to the output of U1a.It will sound the entire time the circuit is on standby but not allow enough current to turn Q1 on. Probably ought to add a switch inline to turn it off for sanity's sake.
 

Wolframore

Joined Jan 21, 2019
1,514
It’s a P channel mosfet. Make sure you’re careful that the body diode is in the correct direction. The last one I used was for a low power circuit that only needed about 250mA with 12vdc to a 5v regulator. I used a SOT-23 smd part. Si2307 was a good trade off between price and Rds it would have easily passed 2-3A. I believe the Rds was about 80mΩ. It drops 0.02v max. Make sure your gate voltage is ok otherwise you need a divider. It’s super efficient. Reverse polarity causes gate voltage to be positive which shuts off the mosfet.

I have a few I use depending on how much current I need to pass.

Datasheet https://www.vishay.com/docs/70843/70843.pdf
 
Last edited:

Thread Starter

Wendy

Joined Mar 24, 2008
21,929
Missed the pip connecting the two lines leading to pin 3. Unless you shook back and added it in while I wasn't looking.
So, did you catch R4, R6, and R8?

No?

Did you download the attachments?

No?

Then you can't prove a thing.
 
Last edited:

MrAl

Joined Jun 17, 2014
6,935
Hi,

Just a couple notes.

First, mosets can be had that have much less voltage drop than regular bipolars. One exception is the type of bipolar made by Zetex which is now part of Diode Inc. Those bipolars have very low Vce drop when turned on.

Second, if the USB port comes from a USB hub, the voltage may already be lower than 5v because some of them use a Schottky diode. So you may already have one diode drop to contend with.

Third, if you do use transistors to switch instead of diodes, try to make sure one turns off before the other turns on to reduce the chance of one power source connecting directly to the other for any length of time.
 

Thread Starter

Wendy

Joined Mar 24, 2008
21,929
I am currently fighting my inability to build and test circuits, but I have a plan.

Dallas MakerSpace, I expect it will be a month minimum before I get up to speed there, which is much better than indefinite. You have no idea how frustrated I have been.
 

Thread Starter

Wendy

Joined Mar 24, 2008
21,929
So, does anyone have an idea for a next project from me? I actually did enjoy making this one, drawings included. If I don't get work any other way, maybe I can be a technical writer.
 

Wolframore

Joined Jan 21, 2019
1,514
Try the BS250 in the TO92 package. It has even lower on resistance.

The power comes in from the left on the diagram forward biasing the body diode. So on the reverse it blocks power.
 
Top