Low cost, Selecting between Vusb and Battery - Page 1
Forum section: electronics / beginners

author: Vindhyachal.takniki
author_rank: Frequent Contributor
timestamp: December 10, 2020, 03:35:09 pm
content: 1. I have a circuit which has power coming from Vusb or Vbat. Current is 700mA max.2. When power from Usb is coming, device should run on Vbus and Vbat should not come in picture, as soon as Vusb removed, then device should immediately run on Vbat without fluctuation.3. Made this circuit, going to test it, any comments on it?

author: Ian.M
author_rank: Super Contributor
timestamp: December 10, 2020, 05:16:38 pm
content: Its FUBARed. Q1 can never turn on if Vbat is present so effectively its a diode from Vbat to Vusb, with a 100K to ground.

author: PeteH
author_rank: Unknown
timestamp: December 10, 2020, 05:38:48 pm
content: Once the logic is sorted, (VBat flows though to VOUT which turns Q1 off)...You probably also want to ensure you aren't backfeeding VBAT to VUSB if VUSB is attached but "off". This could solve the logic problem and backfeed...

author: Peabody
author_rank: Super Contributor
timestamp: December 10, 2020, 06:54:15 pm
content: Maybe I'm missing something, but it looks ok to me. It's basically a load sharing circuit using a P-channel mosfet oriented strangely. If Vbus is not present, R2 will ground the gate and turn on the mosfet, allowing Vbat to supply the load. If Vbus is present, and Vbat is less than Vbus, then the gate goes high, which turns off the mosfet, and its body diode blocks Vbus current from coming back to the battery.What may be missing is a Schottky diode in the Vbus line to block the battery from back-sourcing Vbus or anthing else that might be connnected to it, such as a charger circuit.http://ww1.microchip.com/downloads/en/AppNotes/01149c.pdfI don't think you need R1.

author: bdunham7
author_rank: Super Contributor
timestamp: December 10, 2020, 07:25:32 pm
content: Quote from: Vindhyachal.takniki on December 10, 2020, 03:35:09 pmStart by defining how you want it to work. I assume Vbusis 5.0V, what is Vbat?If Vbusis less than Vbat, do you still want the device to run on Vbus?What if Vbusdrops to say 3 volts, or 2? What other fault conditions do you want your circuit to handle without dropping out?What voltage does your device need?Start with the obvious easy example of having two 1N4001 diodes on both inputs and then identify what problems that solution has so you know what to improve on.

author: PartialDischarge
author_rank: Super Contributor
timestamp: December 10, 2020, 08:56:30 pm
content: Exactly what Peabody said. Also missing the diode in vbus

author: jdutky
author_rank: Regular Contributor
timestamp: December 10, 2020, 09:15:35 pm
content: Maybe a small capacitor between Voutand ground? To cover any voltage drop while the transistor switches from Vbusto Vbat

author: Peabody
author_rank: Super Contributor
timestamp: December 10, 2020, 09:29:00 pm
content: Actually, what I said about the Schottky diode being needed to prevent back-powering other stuff on Vbus was only the secondary reason for adding it. The main reason is that if battery voltage flows back to an unpowered Vbus, that will raise the gate voltage and turn off the mosfet, which is not what you want. So the diode has to be there so the pulldown resistor will ground the gate. It's all in that Microchip appnote.

author: Vindhyachal.takniki
author_rank: Frequent Contributor
timestamp: December 13, 2020, 12:07:58 pm
content: 1. Here is updated design, battery voltage range is 2.4V to 4.2V2. Vusb is +5V

author: Peabody
author_rank: Super Contributor
timestamp: December 13, 2020, 03:32:01 pm
content: It looks good. But you want to be careful picking D1. Schottky diodes are great for low Vf, but when reverse biased they can leak a good bit. And the leakage current rises exponentially as they get hotter. When USB is connected, D1 will be carrying the entire load current. If it gets hot doing that, then when USB is disconnected the diode may leak a good bit of battery current back through to the gate, raising gate voltage, and not allowing the mosfet to turn on fully. The fix would be to lower the value of R2 to sink the leakage current until the diode cools down.In picking the diode, you want a low Vf to reduce the heating, and low leakage specs. But those two are usually mutually exclusive, so you have to compromise a bit. A high current rating will help because the diode will be bigger and dissipate heat better, and not get as hot. In the last of these circuits I built, I used an SB220, which has a 2 amp rating, but I never go above 1 amp of actual current. And my R2 was 10K, with no R1.So in testing your circuit, the critical point is the transition from USB power to battery power when the diode is hot - there should be no sag or dropout.

author: PartialDischarge
author_rank: Super Contributor
timestamp: December 13, 2020, 03:42:59 pm
content: Use this one for examplehttps://fscdn.rohm.com/en/products/databook/datasheet/discrete/diode/schottky_barrier/rb558vam150tr-e.pdf

author: bdunham7
author_rank: Super Contributor
timestamp: December 13, 2020, 04:28:03 pm
content: OK, so what advantage does this circuit have over just using two diodes?As far as Schottky vs other diodes, if the device will run on a single li-ion cell voltage, then there is absolutely no need for a Schottky on Vusb, a regular 1N400x or any other silicon diode with low reverse leakage will do a better job.If you do just use two diodes, a Schottky would be appropriate on the battery circuit, as reverse leakage would just charge the battery a tiny bit and low voltage drop will extend battery operation.If you still want to use the MOSFET circuit to extend battery life a bit further, just make sure that when Vusbgoes away it goes away completely. If it were to drop to 2V, say, your MOSFET might not turn completely on depending on battery voltage. Also, as battery voltage drops below 3V, your RDS(ON)will start to go up anyway. Where and if this becomes a problem you will have to determine.

author: Peabody
author_rank: Super Contributor
timestamp: December 13, 2020, 05:07:00 pm
content: The primary justification for using a mosfet is to eliminate the voltage drop across a diode in the battery line. Of course it depends on what the load is, but if it's a boost converter to get back up to 5V, then battery life could be materially reduced. The lower the voltage coming into the boost converter the more current it will have to draw from the battery in the first place, and even without that, battery life will be reduced because of the Vf of the diode. Of course if none of that matters in a specific situation, then two diodes would work just fine.As for Schottky vs regular diodes, in addition to the lower Vf, a Schottky will switch much faster. I don't know if that's important in this case, but it might be. In any case, these circuits are always shown using Schottky diodes in app notes, etc.I agree that this circuit requires all or none on Vusb. It wouldn't work on solar.