I have the following:

  • DC Generator
  • 5V regulator
  • lipo charger (5v input),
  • 3.3v regulator,
  • lipo battery
  • device requiring 3.3v power

I only want the battery to be connected to the 3.3 regulator (and thus powering the thing) when there is a voltage from the generator. So the generator is effectively a switch and power source for the battery charger.

I have considered using relays and n type mosfets but don't understand enough to know which one to choose and how to wire it up.

Any advice much appreciated (I am new to this).




simulate this circuit – Schematic created using CircuitLab

  • 2
    \$\begingroup\$ The 5V regulator is not going to work well from a 4V generator! The easiest way to do this is to get a regulator with an 'enable' pin. \$\endgroup\$ – pjc50 Aug 4 '16 at 9:15
  • \$\begingroup\$ Where is your li-ion battery protection? \$\endgroup\$ – Chupacabras Feb 23 '17 at 6:02

Not a good idea, your battery charger will get very confused by the current draw of the 3.3V thing.

Assuming we are talking low current devices then the simple solution is two schottky diodes from battery+ and the 5V rail to the input of the 3v3 regulator. That way when 5V is present the 3v3 regulator will use the 5V source, when there is no 5V it will use the battery.

The down side is that you lose a 0.2-0.3V which for 3.3V doesn't give you much margin when running from a 3.7V nominal battery. If you can drop the voltage on your 3.3V thing to 3.0V then you get a lot more headroom.

You can avoid this voltage drop by using a FET connected as an ideal diode, replace the diode from the battery to the regulator with a p channel MOSFET, connect the gate of the MOSFET to the 5V rail. When the 5V is high the FET is off and the battery doesn't power anything. When the 5V is low the FET is on and the battery is connected to the regulator with minimal losses.


Warning - I am assuming you are using a LiPo battery with built in protection circuit rather than unprotected cells. Unprotected LiPo cells are very dangerous and prone to unscheduled highly energetic self disassembly if you do anything that they don't like. You should never connect them to anything you have designed unless you know exactly what you are doing.

Note - This is all assuming we are talking about a simple solution for a home project where simplicity is more important than maximizing functionality. There will be issues with low temperatures and without a proper low voltage shut off there will be long term damage to the battery that will reduce it's capacity over time. For a full commercial product this entire approach is inadequate and you need to use a more advanced method of power management.

| improve this answer | |
  • \$\begingroup\$ The headroom is a problem regardless of the diodes. The "3.7V" battery output drops in use, you must disconnect the load before it falls below 2.5V to protect the battery. \$\endgroup\$ – Brian Drummond Aug 4 '16 at 10:19
  • \$\begingroup\$ I am assuming that the battery pack has under/over voltage protection, most do. Yes for maximum battery life in terms of cycles you should avoid hitting those limits but anyone looking to maximize battery life shouldn't be looking to hack their own power system together to start with. It's not good practice but it works for hobby stuff. Similarly I've skipped the issue that the 3.7V will be 3.1V with an almost full charge at low temperatures. I'll add a note to this effect to the answer... \$\endgroup\$ – Andrew Aug 4 '16 at 10:31

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.