USB / Battery Switchover Circuit

Background: I am a non-EE (an 0x11? :^) thrust into the world of embedded systems design. I started this project with a only college physics-level understanding of circuits, but I'm gradually learning.

The design I'm working on consists of several sensors, an SD card, and a TI CC1111 SoC. The CC1111 includes an 8051 core, a USB controller, and an RF transceiver. My design is based on a reference USB dongle design provided by TI.

The device will typically operate on battery power, using 2 AA batteries in series (or potentially 4 AA batteries in parallel pairs), unless connected to a USB port. I'd like the device to switch over seamlessly between USB and battery, without a microcontroller reset.

I'm looking for a circuit to switch between the two power sources (batteries or USB bus). From what I can tell the simplest thing would be to use OR-ing diodes. The problem here is that I'd be wasting power (current x forward voltage drop of diode), and that's something I want to avoid.

One option I'm considering is the LTC4412 power controller, recommended in answer to someone else's question.

Question 1: Does this look suitable?

One concern I have is the delay in switching over from USB bus power to battery power when the device is disconnected from USB. According to the LTC4412 datasheet, the turn-on time for the MOSFET gate can be up to 175 us. I don't want the CC1111 (or the digital sensors) to reset. Looking at Figure 1 in the datasheet (see too the discussion of bypass capacitors on page 5), the trick is to properly choose a value for the output capacitor, C_out. I calculated a value, but I'm not sure if my approach is valid. If you'll bear with me:

The CC1111 is normally operating at 3V from 2 AA batteries. Suppose it could operate at only 90% of that (2.7 V). I use the current drawn by the load (my device) and the nominal voltage (3V) to come up with an equivalent resistance (V/I). Based on my measurements and summing currents taken from datasheets, the device can draw a current somewhere between 35 mA and 70 mA. This gives me an equivalent resistance in the range of 43 Ohms to 86 Ohms.

If I want the voltage to drop to no less than 90% after 175 us (the LTC4412 gate turn-on time), then after doing the math I get a time constant (RC) of 1.66 ms. Using 40 Ohms to be safe, I come up with C > (1.66ms/40 Ohms) = 42 uF. Maybe add another 10% or 20% for safety, so say 50 uF.

Question 2: Is that approach and calculation valid?

I pulled that 90% number out of thin air. The CC1111 datasheet says that 3.0 V is the minimum voltage, so I'm not sure what I'm doing is kosher. Should I use some kind of step-up converter to get, say, 3.3V out of the batteries?

-
About the capacitor calculation: You should take into account tolerances of capacitors. They can for in some cases for aluminium electrolytics go as low as -30% and as high as +40 % and the capacitance can decrease with time. –  AndrejaKo Jul 11 '12 at 21:23
Also beware, USB devices are only allowed to draw a certain amount of inrush current (although this will be less of a problem when batteries are installed and already charged the battery). Can you use 3 batteries, that will get your voltage closer to VUSB (which is ~5V), and you won't have trouble when the batteries deplete or if someone sticks in rechargeable batteries (1.2V per cell). –  Ben Voigt Jul 11 '12 at 22:07

No, like you already may have feared this isn't kosher. The 3 V is indeed the minimum, and the AA batteries' voltage will quickly drop below that. If you're using NiMH rechargeables you even get only 2.4 V, so that won't do, unless you can use 3 of them in series. (Don't use batteries in parallel like you mention in your question.) So three NiMH cells will give you 3.6 V. Fine.

That 3.6 V is the maximum VDD for the device, so if you want to run it off USB power you'll need an LDO (Low Drop-Out) voltage regulator to get 3.6 V. The LP2981 is a good part for this.

Now the switching. 175 µs seems like an eternity to me, but we'll have to live with that. Ben gave you already the right equation for a constant current discharge:

$\Delta V = \dfrac{I \cdot \Delta t}{C}$

or

$C = \dfrac{I \cdot \Delta t}{\Delta V}$

NiMH cells have a fairly constant 1.2 V, which only drop to below 1.1 V when they're nearly discharged.

So we can use that as a limit. With a minimum voltage of 3 V and a worst-case current of 70 mA you get

$C = \dfrac{70 mA \cdot 175 \mu s}{300 mV} = 41 \mu F$

which is what Ben also found. If you think you won't go below 1.15 V then that would become 27 µF, so that's not going to change very much, but it gives you some headroom if you want to use a 47 µF cap. AndrejaKo rightly points out that electrolytic capacitors have large tolerances, usually -20 %, and then I would just go for a 68 µF/6.3 V cap.

-
Thanks so much. I'm digesting your answer. Does my general approach, i.e. using the LTC4412, make sense? Also, is it never OK to have batteries in parallel? I know this is bad for different voltages, or even different batteries of the same type, but I thought it was OK for identical, new batteries. By the way, the reference design for the USB dongle already includes a regulator to bring down the 5V USB bus power, specifically the TPS76933. –  David Jul 12 '12 at 17:45
@David - Without having read the datasheet thoroughly the LTC4412 looks like a good solution. I wanted to suggest the ICL7673, but that's for very low currents (high on-resistance). The datasheet shows a solution with 2 external transistors, though. Batteries are never identical, and a small voltage difference will cause a relatively large current from 1 battery to the other. Especially bad for non-rechargeables, but also power-loss. –  stevenvh Jul 12 '12 at 17:54
Just for the record, p. 229 of the CC1111 datasheet says it has an LDO voltage regulator "used to provide a 1.8 V power supply to the CC1110Fx/CC1111Fx digital power supply. ... The voltage regulator input pin AVDD_DREG is to be connected to the unregulated 2.0 V to 3.6 V power supply. The output of the digital regulator is connected internally in the CC1110Fx/CC1111Fx to the digital power supply." It can't be used to power external circuits, but this makes it sound as if the CC1111 could work with an input voltage as low as 2V. At least one other component needs at least 3V, though. –  David Jul 13 '12 at 16:12
@David - Interesting. But if you would allow the voltage to drop to 2 V the core may continue uninterrupted, but I/Os may see a negative spike. Isn't that a problem? –  stevenvh Jul 13 '12 at 16:19
It's me again. I don't think I'd let it get down to 2V -- I'll take your word on the spikes. However, I'm thinking of ditching the LTC4412. If you recall the LTC4412 requires an external PFET and a 47 uF cap. As Ben noted, the big cap would exceed the allowed USB inrush current limit. I think I could address that with a soft-start RC circuit around the PFET gate, but what if I instead used a TI TPS2113 (ti.com/lit/ds/symlink/tps2112.pdf) to mux between the USB VBUS and 3 AA batteries in series? –  David Aug 8 '12 at 19:36

No, you shouldn't use a resistive time constant equation for active electronics. Just assume a voltage-independent current draw, along with the capacitor equation:

I = C * dV/dt


and solve for C.

C = I * delta-t / delta-V
= 70mA * 175uS / .3V = 41 uF


(ok, that's pretty much the same, because R-C discharge current is above 90% of the starting value while the voltage is above 90%)

The USB specification states that the maximum capacitive load that can be placed at the downstream end of a cable is 10 uF. You're going to have a problem if your batteries were discharged, unless you current-limit the USB source.

-
Thanks, Ben, and @stevenvh. I would have missed the USB capacitance issue, and I'm investigating solutions. By 'voltage-independent power draw' do you mean constant power? Assuming P = IV is constant, I come up with C(dV/dt) = -I = -P/V = -I0*V0/V, where I0 and V0 are the initial current and voltage. Solving this diff. eq. I get V(t) = sqrt(V0^2 - 2t*I0*V0/C) Solving for C when V = 0.9*V0, I have C = 2*70 mA * 175 uS / (3V * (1-0.9^2)) = 44 uF. I guess they're all in the same ballpark. –  David Jul 12 '12 at 17:37
@David: Sorry, I actually meant constant current, not constant power. –  Ben Voigt Jul 12 '12 at 20:35
I'm thinking of avoiding the LTC4412 and going with TI's TPS2113 power mux instead (see comment above). It looks like I'd need less capacitance to protect from voltage droop, avoiding the inrush issue. What do you think? –  David Aug 8 '12 at 19:38