Author Topic: USB/Battery Switching Circuit  (Read 3190 times)

0 Members and 1 Guest are viewing this topic.

Offline optoisolatedTopic starter

  • Supporter
  • ****
  • Posts: 71
  • Country: au
  • If in doubt, it's probably user error.
    • OpsBros
USB/Battery Switching Circuit
« on: October 10, 2018, 09:32:05 am »
Hi all,
I'm working on a project which uses two power sources (a 9V battery, and 5V USB). My proto design just used two diodes to isolate the sources, but I want something more elegant, and to ensure the best possible life of the battery.

I've whipped up a quick circuit and wanted to see if anyone had suggestions to make it simpler, more efficient, or point out if I've screwed something up.

Note: VBUS is the USB Power Source, +BATT is the Battery.

Cheers  :-/O
« Last Edit: October 10, 2018, 10:03:16 am by optoisolated »
 

Offline mariush

  • Super Contributor
  • ***
  • Posts: 5140
  • Country: ro
  • .
Re: USB/Battery Switching Circuit
« Reply #1 on: October 10, 2018, 10:42:31 am »
Get a low quiescent current LDO or buck regulator (since you say you want long life) after the battery to get 5v and then you can use chips like TPS2115A : http://www.ti.com/lit/ds/symlink/tps2115a.pdf

There's also chips like TPS22933 which automatically selects the highest voltage from 3 inputs and has a built in LDO that does 3.6v at up to 75mA

But it would probably make more sense to replace your 9v battery with 2 or 3 AAA batteries, 2 rechargeable batteries and a tiny boost regulator will most likely give more life to your product and rechargeable AAA batteries are cheap and easier to find compared to 9v batteries.
 
AAA batteries are ~ 10.5mm x 44mm, 9v batteries are ~ 26mm x 48mm ... area used is similar.

You can use boost regulators like XC9142B50DMR-G  to boost to 5v with over 90% efficiency... only need a surface mount inductor and a couple ceramic capacitors so practically you can fit the whole circuit between the batteries or in the back of the area you have for battery contacts.  And for this particular chip, the quiescent current is super low, something like < 25uA (not that you care much with rechargeable batteries)

The 1-2$ you spend in extra components for the boost regulator, you save in a few months when you don't have to buy a new 9v battery...
« Last Edit: October 10, 2018, 10:44:36 am by mariush »
 
The following users thanked this post: optoisolated

Offline Peabody

  • Super Contributor
  • ***
  • Posts: 2150
  • Country: us
Re: USB/Battery Switching Circuit
« Reply #2 on: October 10, 2018, 02:10:28 pm »
I don't understand your circuit.  First, it looks like you need a base resistor for  the NPN.  Second, it looks like power at VBUS would turn the battery on, not off.  Well, as I said, I don't understand it.
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13119
Re: USB/Battery Switching Circuit
« Reply #3 on: October 10, 2018, 03:58:34 pm »
I understand it well enough.
I've whipped up a quick circuit and wanted to see if anyone had suggestions to make it simpler, more efficient, or point out if I've screwed something up.
As Peabody notes, its totally screwed up.   On when its meant to be off and visa versa, and that's if the BC547 survives having 500mA or more dumped into its base.

Mariush has a good point about using a boost regulator and cheaper batteries.  2x AA are almost exactly the same mass and take up a similar volume as a single PP3, are a fraction of the price and will have about 50% more energy.   A PP3 regulated down to 5V just isn't cost effective unless its either very rarely used or you only need a fraction of a mA for memory backup.
« Last Edit: October 10, 2018, 04:00:40 pm by Ian.M »
 

Offline Peabody

  • Super Contributor
  • ***
  • Posts: 2150
  • Country: us
Re: USB/Battery Switching Circuit
« Reply #4 on: October 11, 2018, 02:45:54 am »
The problem is that you're trying to turn off a P-channel mosfet when VBUS is connected, but you have no way to bring the gate voltage up to 9V, which is what you need to do to turn the mosfet off.

I think the answer is to move all of this down to the negative rail, and switch to an N-channel mosfet.  The attached circuit may work, but you would have to test it out.  When VBUS is not connected, the NPN is off, which lets R2 bring the gate voltage up to turn on the mosfet, and conventional current flows from the system ground back into the negative battery terminal.  But when VBUS is connected, the NPN turns on, which grounds the mosfet gate, which turns it off.

I'm a bit queasy about the isolation of the mosfet source and negative battery terminal in the Off situation.  The negative terminal may pretend to be -4V, which would turn on the mosfet.  Maybe an expert can rule on whether this circuit will work.

Edit:  Indeed, I don't think my negative rail circuit will work at all.  But see my next message below for a positive rail circuit I found online that looks like it would work.
« Last Edit: October 11, 2018, 05:18:27 am by Peabody »
 

Offline optoisolatedTopic starter

  • Supporter
  • ****
  • Posts: 71
  • Country: au
  • If in doubt, it's probably user error.
    • OpsBros
Re: USB/Battery Switching Circuit
« Reply #5 on: October 11, 2018, 04:08:05 am »
Yeah I see where i've screwed up.

I was trying to implement a NOT gate, triggered by the VBUS line being present, disconnecting the Battery via the P-Ch FET. I've been looking down the path of dual power source switching ICs now and will probably go down that path for my final design, as they are sub 70c for the parts in qty, and far more elegant. I am also definitely ditching the 9V battery now too in favour of a lithium primary or some other such cell.

The draw of the design in idle mode (whcih it is in for ~95% of the time) is < 50uA and when active, its peak is 100mA with a duty cycle of approx 20%.. The 9v battery just doesnt have enough capacity for something that should stay functional ideally for about 6-9 months. I also need to write more optimisation into my MCU to reduce the load of the LED indicators.. they are currently configured to draw about 15mA and likely for the brightness needed, prolly would be comfortable on about 3-5mA.

Much more to do, more breadboarding... but I will also play around with moving the circuit on to the negative rail just to see if I can get my head around implementing that original design, and make it work as I originally intended.
 

Offline Peabody

  • Super Contributor
  • ***
  • Posts: 2150
  • Country: us
Re: USB/Battery Switching Circuit
« Reply #6 on: October 11, 2018, 05:14:43 am »
I've concluded that my negative-rail circuit won't work.  The problem is that the negative battery terminal isn't referenced to the rest of the circuit.  Anyway, I found the circuit below online.  It uses three mosfets, and there is some current drain from the battery via the resistors even when USB is plugged in.  But it looks like it should work.
And of course the resistors could be much higher values.

I should also say that this is easier if the battery voltage is lower than USB, such as a single cell LIPO. and both are driving a downstream voltage regulator.  Then all it takes is a Schotty diode, a p-channel mosfet, and a resistor.
« Last Edit: October 11, 2018, 05:32:55 am by Peabody »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf