Basically I'm looking to use a simple transistor circuit to diconnect one V+ (or ground) when another is connected and automatically switch back when the switching source is removed. Like having a small lithium batt in a device with charge circuit external. When the charge supply is connected I'd like to run the device from the external supply while charging the battery and automatically swap back to battery supply when the charger is removed. Planning to work with 5VDC.

Basically looking for pointers on how to setup such a switch? already have the external charger worked out.

For clarity's sake: I'd like to charge the battery while still in circuit with the load device while powering the device. Wouldn't the batt need to be removed from load to do this safely? Could this be achieved by detecting the charger input with transistor switching and how?

  • \$\begingroup\$ What's the question? \$\endgroup\$
    – Tony Ennis
    Oct 20 '12 at 3:13
  • 1
    \$\begingroup\$ Figured it was pretty simple to gather that the question is how to achieve the described effect. \$\endgroup\$ Oct 20 '12 at 3:18
  • \$\begingroup\$ Sometimes simple, proven solutions tend to be omitted, would this simple setup be good for you: electronics.stackexchange.com/questions/43227/… ? Just your average jack-plug. \$\endgroup\$
    – Vlad
    Oct 20 '12 at 6:57
  • 1
    \$\begingroup\$ Can't you use diodes? (Use Schottky diodes for low forward voltage.) \$\endgroup\$
    – starblue
    Oct 20 '12 at 9:48
  • \$\begingroup\$ Hadn't thought of using diodes. Would that be safe to charge a lithium battery while still connected to the load? The goal is to keep the battery permanently in the device while automatically switching supply voltage whenever the external charge controller is connected. \$\endgroup\$ Oct 20 '12 at 10:44

This is often called "Power Path" and you use FETs connected as ideal diodes. Many chargers have this functionality built in, like the LTC4160 from Linear. TI also have a number of battery chargers with Power Path. (No direct link, you have to search the TI site).

Microchip has an app note about load sharing if you want to roll your own simple version.

You can also get ideal diodes nicely packaged.


If you can live with a diode drop on the battery, then using two diodes is the easiest approach. Use Schottky diodes for lower voltage drop. For such low voltages and modest currents you can probably get down to 200 mV or so. If the 200 mV drop is acceptable, then I would just go with that.

If the diode drop is not acceptable, then you still use diodes but put a FET around each one. The circuit then has to sense whether the external source is available and enable/disable the appropriate FETs. This is more complicated, and you have to consider how fast the circuit can react, but you should be able to find FETs with Rdson of a few 10s of mV, so the drop is virtually eliminated at modest currents.

Perhaps you only need to do this accross the battery diode if the external source can be arranged to have high enough voltage. After all, the battery will vary in voltage with state of charge and temperature, so even after a Shottky diode drop you could arrange for the external supply to provide at least as much voltage as the worst case battery level the circuit has to operate with.

  • \$\begingroup\$ That sounds about like what I'm looking for. The battery will actually be running to a 5v step-up then to the load circuit anyway so as long as the battery or external source isn't less than 1V all should be fine to keep the target MCU chugging along happily. Any examples or schematics of this in practice? I'm much more of a visual learner. Thank you. \$\endgroup\$ Oct 20 '12 at 15:17
  • \$\begingroup\$ Also, could this be done using the schottky across the base and collector of an NPN as well? I'm using parts on hand and I'm not sure if I've got any FETs but I've got a ton of NPNs. \$\endgroup\$ Oct 20 '12 at 15:24
  • \$\begingroup\$ @Backy: A bipolar accross a Schottky diode won't help much if at all. The right Schottky can have a drop nearly as low as a saturated bipolar transistor, and with the transistor you will have loss in supplying the base current. If you're not careful, this could cost more efficiency than just a good Schottky diode. It sounds like from your first comment you can use two Schottkys and be done with it. \$\endgroup\$ Oct 20 '12 at 18:30
  • \$\begingroup\$ Would that allow the MCU load to keep receiving power while the battery charges? \$\endgroup\$ Oct 20 '12 at 18:49

What you are asking for is an Exclusive OR switch (diode or transistor) when all you may need is Inclusive OR. This is already done by simply running off the battery all the time and relying on the charger manager to decide if the battery needs to float or receive charge by testing its capacity momentarily when connected. Explicit with this design logic is that the load will get its power from the same connector and the charger OR battery will supply power from whichever is higher in voltage.

However if your charger does NOT determine when/how to float the charge voltage your battery may NOT get a change to rest at full charge and the thus continual leakage charging current may reduce lifetime. Smart chargers are designed to shutoff when full charge is reached.

After thinking about this, now it seems this is how mobiles and laptops are designed with smart chargers. So it depends on your charger. If it is not a smart switch then you may need to research this more or use an Exclusive OR switch such as the contact in the DC power jack (gnd) or diode bridge or FET bridge.

  • \$\begingroup\$ The charger is actually meant to charge the battery out of system so I would imagine that once the battery reaches charge it floats and waits. I'm looking for a way to connect the battery permanently in the target device and retain use of the charger without physically removing the battery to do so. So, yeah. Like a cell phone. \$\endgroup\$ Oct 20 '12 at 16:59
  • \$\begingroup\$ there may be a smart reason why the battery must be removed to charge it. Your load current may affect the power source regulation a lot and diode drop may rise significantly. More details are needed for best solution, but Diode OR bridge seems like a cheap test to see if it works and if not report the PN and voltage drop. \$\endgroup\$ Oct 20 '12 at 17:09
  • \$\begingroup\$ This may sound stupid but after rethinking your answer... If the charger can determine when to float the batt couldn't it be connected to the batter through an NPN acting as switch to ground so that when power is applied the charger either supplies the batt or power goes through to load? \$\endgroup\$ Oct 20 '12 at 17:13
  • \$\begingroup\$ Perhaps something like this? i5.photobucket.com/albums/y177/Midiot/DIY/oring.jpg (not my image but looks similar to what I'm thinking) where supply one would be the battery and supply two would be the external charge voltage and a transistor between the three leads at the load side of this schematic? \$\endgroup\$ Oct 20 '12 at 17:27
  • \$\begingroup\$ If the battery is loaded, the dumb charger can't tell if it is undercharged or not. A smart charger may use the interrogate and response pulse method. \$\endgroup\$ Oct 20 '12 at 20:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.