I have looked around for some way of having a 5 volt power supply that acts like a UPS.

Basically want to use a micro usb connector for +5 have a battery and li-ion or other charging circuit that will maintain uninterrupted power on the output.

I found these 2 that are really what I need- but they charge Lead Acid batteries in cars or something and I do not know how to integrate a charging circuit into this.

6volt UPS with 6 volt input i think?

enter image description here

  • R1, R3 - 560 ohms 1/4W
  • R2 - 1 kilo ohms 1/4W
  • D1 - 1N4736A or any 6.8V zener diode
  • D2 - 1N4001 or similar diode
  • LED - red LED or any low power LED
  • C1 - 47uF electrolytic capacitor rated 16V
  • Q1 - 2N3440 or similar NPN transistor
  • BAT - 6V battery

5volt ups with 12volt input for lead acid battery charging

enter image description here

  • R1 - 39 ohms 1/2W
  • D1, D3, D4 - 1N4001 or similar diode
  • D2 - 13V zener rated 1W
  • C1 - 220uF electrolytic capacitor rated 25V
  • C2 - 10uF electrolytic capacitor rated 10V
  • IC - 7805 or similar 5V regulator
  • BAT - 12V lead acid battery rated 1.2Ah minimum
  • DC INPUT - 12volt DC

And i have found 2 charging solutions one for ni-cd and the other for Li-ion


enter image description here

  • R1 - 1.2 kilo ohms 1/4W
  • R2 - see R2 and D2 table below
  • R3 - 2 kilo ohms 1/4W
  • Q1 - TIP41C or any NPN transistor min 1A current and 3W power
  • Q2 - 2N2222, CS9013, or similar NPN transistor
  • LED1 - Red or any LED with forward voltage around 2V (see LED)
  • LED2 - yellow or any LED color except Red
  • D1 - 1N4001 or similar diode
  • D2 - see R2 and D2 table below
  • DC supply - 12V to 15V DC supply or battery

Li-Ion (nice single chip solution)

enter image description here

So I can connect the dots- the charging circuits require an input voltage and they are specifically picked to stop charging at certain currents to over over charge.

Would it be as simple as taking the + from the charging point and replace it with the BAT symbols in the UPS designs? I suspect I need to decouple it somehow, to prevent voltage from the always on power going to the + of the battery (and essentially bypassing the charging circuit) would a diode be needed here to stop the main supply (but how do I tell the battery to kick in when the mains is off?) Is there something missing here to switch between supplies as needed?


2 Answers 2


If I understand you correctly, you want a charger than can switch between battery and input source (i.e. when adapter is plugged/unplugged) to power the load.

There are plenty of charge control ICs and circuits around that can do this. The MCP73831 is a nice cheap little Li-Ion charge IC, and with the addition of a PMOS/Schottky, can switch between adapter and battery. Here is an example circuit:

MCP73831 circuit

The output is at the top right where the wire disappears (from the PMOS/Schottky)
Here is an Microchip app note which goes into some details on such a circuit.

The way it works is when the USB power (or adapter) is not present, the VUSB_IN line gets pulled to 0V by R4. This brings the gate of the PMOS (G on the symbol) to ground and turns it on (i.e. opens the Source-Drain, marked S and D) allowing the battery to power the circuit. The Schottky (marked A and K) stops the battery raising the VUSB_IN line and turning the PMOS off again.
when the adapter is plugged in, the gate is pulled to +5V and the PMOS turns off, leaving only the adapter voltage powering the circuit and letting the battery charge.

  • \$\begingroup\$ That is fantastic :) Looks really good. Just quick question C3- is that used to smooth power when mains is unplugged?(or as i see now the hexfet-never used that befreo -read the data sheet-used for switching power) BT1 - that is the actual battery? and +bat is just a pin out yes? and what is the purpose of the ferrite bead on usb +5? Sorry for all the questions I am just no familiar with some of those things. \$\endgroup\$
    – Piotr Kula
    Jul 31, 2012 at 20:24
  • 2
    \$\begingroup\$ No problem, ask away - C3 is just a filter cap, yes. It's recommended in the datasheet so the voltage monitor doesn't see any sudden changes and change modes unnecessarily. BT1 is the battery. +BAT just goes to a battery monitor circuit (if desired) The ferrite bead + C4 is to help filter noise from the supply (e.g. if plugged into a PC) but it's not absolutely necessary if you wish to leave it out. \$\endgroup\$
    – Oli Glaser
    Jul 31, 2012 at 20:31
  • 4
    \$\begingroup\$ Thanks a million Oli! Your answer will prove to be very interesting for many people tinkering with low power devices. It is a really easy and neat schematic. Superb! \$\endgroup\$
    – Piotr Kula
    Aug 1, 2012 at 10:52
  • 2
    \$\begingroup\$ The charge voltage will be at 4.2V set by the MCP73831, but the circuit voltage will be either the USB voltage (minus the schottky drop in the IRF7526D1) or battery voltage. For the maximum current available for the attached circuit, ignoring USB current limits (e.g. 500mA for USB 2.0 etc) or battery capability, the limit is set by Q2. So in this circuit the limit is 2A for the IRF7526D1 (with adequate thermal design) For the charge current, the maximum is 500mA (the limit for the MCP73831) \$\endgroup\$
    – Oli Glaser
    Jun 26, 2013 at 0:37
  • 1
    \$\begingroup\$ Beware, as stated by @Robotbugs, the circuit does feedbacks (tested) full voltage from VBUS to Battery terminal, solved the problem applying a diode between battery and IRF device. Its working but will double check circuit. NIce circuit althoug thanks for posting. \$\endgroup\$
    – user76390
    May 13, 2015 at 6:35

I share my experience, which took a long time of googlin and testing but finally I found a cheap, compact and nice solution. My goal was to build up a 5V UPS for Raspberry Pi, to avoid SD writing problems due to power cuts; anyway this tutorial can be suitable for anyone who wants to build up his own power bank too.


  • Lithion Battery (I used my old Jiayu G3T 3000mAh battery)

  • 5V to 3V Logic Level converter

  • 3.7V Li-ion Battery Mini USB to USB A Power Apply Module 5V 1A Charge Module (find it here)


  • Battery: depends on your needs, in my example I took a 3000mAh which means that with a load of 1000mAh (average RasPi consumption) it can last up to 3hrs. Cost: 5,50€

  • Level converter: the cheapest, 1,50€

  • Power module: ca. 3€

Total: ca. 10€


I used the battery as mounting surface because it's nice and squared; a little bit of isolating sponge and sticky tape and some basic soldering and I get a 6 x 6 x 1,5cm little UPS package.

enter image description here

  • \$\begingroup\$ Logic Level Converter: ebay.it/itm/… Another Pic: [4]: i.stack.imgur.com/9Slef.jpg Schematic: [5]: i.stack.imgur.com/9oviB.jpg \$\endgroup\$
    – ilguSo
    Mar 2, 2016 at 16:15
  • \$\begingroup\$ The original question deals with a scratch-built charging circuit. On the other hand, your design uses an off-the-shelf charger board. Yours is an alright how-to post. But this is an answer to some other question. \$\endgroup\$ Mar 2, 2016 at 17:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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