I need some help creating a circuit to switch from battery to USB power.

Spazmonkey

Another Striker
Joined
Jul 15, 2008
Posts
325
Okay, so I have this project I made, and I want the option to either use a li-ion battery, or USB power. I originally planned to be able to charge the battery by USB, but I couldn't fit the circuit in the enclosure. Anyway, I want it to work so the USB will be priority one, and whenever it's plugged in, only it will be used, and the battery will be used whenever USB isn't present. I was thinking that if I just straight up wired it, both power supplies would feed power at the same time, and that would be bad. Also, I want it to be internal. I know an external double throw switch could solve everything pretty easily, but I would prefer not if possible. Thanks!
 
Last edited:

Xian Xi

JammaNationX,
15 Year Member
Joined
Dec 1, 2005
Posts
27,762
You just need a diode rated at least +5v going from the battery to the device. This way the +5v from the USB won't go to the battery.

Also keep in mind that USB is +5v but has a very low amperage, only .5 amps.
 

Spazmonkey

Another Striker
Joined
Jul 15, 2008
Posts
325
I have diodes in place already, but what I was wondering is if both devices will provide power at the same time, thereby overloading the device with twice as many volts as needed. I hardwired in the USB cord, and it worked fine with a small cap in place, so I know it's compliant.
 

Xian Xi

JammaNationX,
15 Year Member
Joined
Dec 1, 2005
Posts
27,762
They will be but since they are in series the voltage wont be doubled. If you use your multimeter you will see that it will still be +5v.
 
Top