Author Topic: Switching between battery and usb power.  (Read 1048 times)

0 Members and 1 Guest are viewing this topic.

Offline KaishaTopic starter

  • Contributor
  • Posts: 42
  • Country: ca
Switching between battery and usb power.
« on: August 25, 2021, 02:22:19 am »
I need a circuit that will switch between USB and battery power (USB if available, battery otherwise).  The thing is that in this case the battery will be a higher voltage (6.5V-9.5V) than the USB, so the 'normal' method show online doesn't work.  I also only have a SPST switch to turn the entire thing on/off (which is connected to VBAT).

I think the circuit below will work, but I'd love another set of eyes, and any input/ideas you guys might have.
 

Offline ledtester

  • Super Contributor
  • ***
  • Posts: 3036
  • Country: us
Re: Switching between battery and usb power.
« Reply #1 on: August 27, 2021, 03:53:16 am »
Here's a similar EE StackExchange discussion:

https://electronics.stackexchange.com/a/96070/95488

 

Offline vu2nan

  • Contributor
  • Posts: 39
  • Country: in
    • Amateur Radio - VU2NAN - Nandu
Re: Switching between battery and usb power.
« Reply #2 on: August 27, 2021, 09:20:39 am »
A 5V electromagnetic relay may be used to switch between USB and battery.



Nandu.
« Last Edit: August 27, 2021, 09:27:17 am by vu2nan »
 
The following users thanked this post: Zero999

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19529
  • Country: gb
  • 0999
Re: Switching between battery and usb power.
« Reply #3 on: August 27, 2021, 12:38:25 pm »
A 5V electromagnetic relay may be used to switch between USB and battery.



Nandu.
That will work, but there needs to be a fairly big capacitor between +V Out and 0V, otherwise there will be a huge voltage sag, when it switches. You probably need to limit the voltage drop below 0.5V.

The minimum capacitance depends on the switching speed of the relay, the maximum allowable voltage drop and maximum current drawn by the device.

C = Δt/ΔV×I

Also note the voltage drop due to the ESR of the capacitor.

Make the capacitor a little larger, than calculated by the formula above.
 

Offline Peabody

  • Super Contributor
  • ***
  • Posts: 2008
  • Country: us
Re: Switching between battery and usb power.
« Reply #4 on: August 27, 2021, 02:11:28 pm »
Would the battery voltage ever be lower than VUSB?  If it's ever more than one diode drop below VUSB, then USB current would flow through the body diode of the P-channel back to the battery.  You might not want that to happen.

Would you ever need to operate the device from USB with no battery connected?  If so, then the P-channel gate would be floating.  I don't know if that matters if there's no battery.

It's not clear to me what purpose Nchan3 serves.  It seems the diode should be enough.
« Last Edit: August 27, 2021, 02:24:20 pm by Peabody »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf