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.
...................
............................................................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.
..................
............................................................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.
............................................................
............................................................Figure 3
............................................................
............................................................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.
.........
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.
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.
...................
............................................................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.
..................
............................................................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.
............................................................
............................................................Figure 3
............................................................
............................................................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.
.........
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.