DIY Mini UPS for WiFi Router / Modem




In my locality, frequent load shading is a very common problem during the summer evening. I am really tired of this problem. I always wanted to have a mini UPS system which can power up my WiFi-Router/Modem for internet purposes and also charge my Smartphone. After some brainstorming and by using my past DIY experience, I have landed to this simple Mini UPS design . The best thing of this UPS is that it uses minimal components and it can easily fit inside my jeans pocket during the traveling.

It is capable of powering either a standard wireless router (that requires 12V DC), a Raspberry Pi/ Arduino, charging a smartphone or any 5V DC-powered device at up to 1A current.

You can visit my website :

My Hackaday Prize 2019 entry

Step 1: Components and Tools Required

Components Required :

1. TP4056 Charger ( Amazon / Banggood )

2. Boost Converter ( Amazon / Banggood )

3. USB Boost Converter ( Amazon / Banggood )

4. LEDs ( Amazon / Banggood )

5. DC Jack- Female ( Amazon / Banggood )

6. DC Jack-Male ( Amazon / Banggood )

7. Rocker Switch ( Amazon / Banggood )

8. 18650 Battery ( Banggood )

9. 18650 Battery Holder ( Amazon / Banggood )

10. 24 AWG Wires ( Amazon / Banggood )

11. Heat Shrink Tube ( Amazon / Banggood )

12. PLA Filament-Silver (GearBest)

13. PLA Filament-Red (GearBest)

Tools Used :

1.Soldering Iron ( Amazon )

2. Hot Glue Gun ( Amazon )

3. Wire Cutter ( Amazon )

4. Wire Stripper ( Amazon )

5. PCB Vise ( Amazon )

6. 3D Printer ( Amazon / Banggood )

7. Hot Air Gun ( Amazon / Banggood )

Step 2: How the Circuit Work?

The working of the circuit is very simple, in normal condition, power from the mains is drawn by a USB charger to charge the 18650 battery and to provide power to the router. When the mains power fails, the stored energy in the battery is used to power up the router.

In the schematic diagram, the 18650 battery is connected to a TP4056 charging module. The output of the TP4056 module is connected to the two boost converter modules: one to power the Router (12V) and another to USB Socket (5V) for smartphone charging. The output voltage of the boost converter (SX1308 module ) can be set by twisting the trimpot on the PCB board. In my case, I have set it to 12V. If your router is running at 9V, then set it to 9V. The output from the boost converter (SX1308) is connected to the external 5.5mm DC jack via an SPST switch.


Please note that you are working on Li Ion battery which is potentially very hazardous. I cannot be held responsible for any loss of property, damage, or loss of life if it comes to that. This tutorial is written for those who have ample knowledge on rechargeable lithium ion technology.Please do not attempt this if you are novice. Stay Safe.

Step 3: Selecting the Battery

First, check the specs of your router/modem, you can get all the information on the specification sticker.

My router input power is 12V and 0.5 A. So, the power requirement for the router is 12 x 0.5 = 6W

I was considered a backup time for 30 minutes. So Watt Hour Required is = 6 x 0.5 = 3Wh

The 18650 Battery nominal voltage is 3.7V

Required Capacity = 3 Wh / 3.7V = 0.810Ah = 810mAh

The same battery also used for charging my smartphone. Let I need to charge my phone up to 35-40% for emergency use only. My Smartphone (One Plus 6) battery is rated for 3300mAh.

The final capacity required is = 810 + 3300 x0.4 = 2130 mAh

By taking the losses in the converter into consideration, I have chosen a 3400mAh Panasonic battery for this mini UPS.

Step 4: Remove the Onboard Status LEDs

The charging status of the 18650 battery is indicated by two LEDs on the TP4056 module. My objective is that the led should be visible to the outside of the enclosure. So I desoldered the onboard LEDs and soldered two 5mm LEDs ( Red and Green ).

Take fine tip soldering iron, and carefully remove the LEDs from the board by taking the help of tweezers.

I have highlighted it in the pictures shown above.

Note: Be careful during the desoldering, otherwise you will damage the soldering pads on the PCB.

Step 5: Solder the Charging Status LEDs

I used 5mm red and green LEDs to indicate the charging status of the battery.

First I trim the legs of the LEDs as shown in the figure. The longer leg designated as the positive terminal.

Then solder 24AWG hookup wires to the LED legs. For solid connection and protection to the soldering joint, apply heat shrink tube on it.

At last, solder the LED terminal wires to the soldering pads of the onboard LEDs on the TP4056 module. The pads which are towards the TP4056 chip is negative terminals.

Step 6: Connect the 18650 Battery Holder

First, apply a small amount of solder to the B+ and B- soldering pads on the TP4056 module.

Then solder the red wire of the battery holder to the B+ and black wire to the B- terminal of the TP4056 module.

Step 7: Connect the Boost Converters

Similar to the previous step, apply a small amount of solder to the Out+ and Out- terminal of TP4056 module.

Then solder the wire from the Boost converters to the TP4056 Module as shown in the schematic.

SX1308 Module:

VIN+ connects to Out+

GND connects to Out-

USB Boost Converter:

VIN+ connects to Out+

VIN- connects to Out-

You can see the above image for better understanding.

Step 8: Prepare the DC Jack and Switch

Solder wires to the terminal of the SPST switch and DC Jack.

The smaller leg of the DC jack is the positive terminal.

At this stage don't connect the DC jack and switch to the Boost Converter module, it will be done after installing them into the 3D printed enclosure.

Step 9: Prepare the DC Output Jack

Now you have to prepare the adapter to connect the UPS output to the router input. First check the specification of your router to confirm the size of the jack ( Sleeve size ) and the tip polarity. Your router will have a small diagram indicating the polarity expected by it; care should be taken to adhere to this, as an improper power supply may damage the device.

In my case the size of the jack is 5.5mm and the tip polarity is positive. According to the size, order two male DC Jack. Then solder red wire to the tip (smaller one ) and black wire to the sleeve.


Step 10: 3D Printed Enclosure

To give a nice commercial product look, I designed an enclosure for this project. I used Autodesk Fusion 360 to design the enclosure.

The enclosure has two parts:

1. Main Body

2. Cover Lid

The Main Body is basically designed to fit all the components including battery. The Cover lid is to cover up the main body opening.

I used my Creality CR-10S printer and 1.75 mm Grey and Red PLA filaments to print the parts. It took me about 5 hours to print the main body and around 1 hour to print the top lid.

My settings are:

Print Speed: 60 mm/s

Layer Height: 0.2mm ( 0.3 also works well)

Fill Density: 25%

Extruder Temperature: 200 deg C

Bed Temp: 60 deg C

Download the STL files from Thingiverse

Step 11: Installing the Components

Insert the components ( TP4056, Boost Converters, LEDs, Rocker Switch, and DC Jack) on the Main Body slots as shown in the picture.

At last, insert the 18650 battery inside the battery holder. Make sure you have to insert with the right polarity. The polarity is marked in the battery holder.

Finally, place the top lid and secure the 4 screws at the corners.

Step 12: Testing and Conclusion

Plug in the UPS to standard micro USB mobile charger (5v/1A). During the charging process, the red LED will be ON and when the charge finished it will be turned off and the green LED will be switched ON.

Now connect the Mini-UPS the to router by using the adapter cable prepared in the earlier step. The router LEDs should lit up.

To test the USB port, I plugged in my smartphone, and checked the charging process by using Ampere app.

Thanks for reading my Instructable.
If you like my project, don't forget to share it. Comments and feedback are always welcome.

This project is entered in to Pocket-Sized Contest, please vote for me.

Pocket Sized Contest

Runner Up in the
Pocket Sized Contest



    • Games Contest

      Games Contest
    • Barbecue Challenge

      Barbecue Challenge
    • Growing Beyond Earth Maker Contest

      Growing Beyond Earth Maker Contest

    59 Discussions


    10 days ago

    Hi! Congrats on your project. I'm working on something very similar but instead of a router, I want to power up my Raspberry Pi.

    What I've done is what you can see in the images attached. I'm using a P-Channel MOSFET to switch from mains to bat. Currently it is not working because of the transistor (I need to find the appropriate part #).

    Reading your project description I noticed you do not use that kind of switching, you're powering the DC boost module from TP4056 directly. Would't that affect the way the battery is charged? I'm asking this because the module will be charging the battery while powering the Raspberry (or router in your case).


    2 replies

    Reply 8 days ago

    the concept of the ups is to make the battery always available during power failures. im working also on a similar project for a digital atomic clock which always hooked to outlet which draws 12v 1amp. so a 3s 1p bms setup would be enough. as for charging, the bms protect the batteries from over charging hence cutting the current supplied to the batteries.


    Reply 7 days ago

    So when the battery is charged, the TP4056 won't charge it anymore?


    17 days ago

    I need 4 hours backup for 12 volt router..please suggest features of battery ( howmuch volt ?? mah??)
    Reply plssssss


    3 months ago

    Good job there.
    Please, I want to power my Laptop for at least 24hours during outages now what modifications do I need?
    Remember, Laptops have only AC adapters.

    6 replies

    Reply 5 weeks ago

    In the ideal case for a battery, it is best to use LiFePO4 cells, like 32700. It's much safer than lithium batteries. 32700 has 3.2V and a capacity of about 6500 mAH. It's can supply a current about 30 A.


    Reply 3 months ago

    That depends on the power consumption of your laptop. For example, if the laptop battery lasts 8 hours and it's 72 Wh, then you need a 72 * 24/8 = 216 Wh battery (pack), plus losses, say 250-300 Wh. That's quite a big (and expensive) one, but you can buy/make one, with the same voltage as your laptop. You also need to set your boost converter to your laptop's voltage, and you're done.

    Nice idea of an easy way to determine Watts of laptop without having to measure Amps. How long does the known quantity battery lasts... I like it.

    of course if laptop battery is not fully charged when power goes out, the laptop will consume (significantly?) more than the approximately 8W in your example because we need to power the laptop and charge the battery.

    of course in this scenario, the laptop was plugged in all the time, so the battery would be fully charged. But if it’s not... I guess you need to determine how long it takes to fully charge to determine the watts going into the battery while charging and add that to the number you determined for the laptop.


    Reply 3 months ago

    Laptops don't have AC socket, they have AC-DC "power brick" therefore you'll only need a big DC power bank. You definitely can't use a TP4056 (or several ones), no matter of how much capacity can be provided by your cells (connected in parallel), you'll have no more than 5W (1.2A) at the TP4056 output. At first glance you'll need at least a "big" buck converter and a boost converter, a BMS (with cell balance feature) a couple of mosfets and several cells. That's not something that should be handled by everyone, lithium cells are not a joke.


    Reply 3 months ago

    A buck and boost converter?
    Couldn’t you wire them all in parallel and eliminate the BMS/cell balancing?
    (just run the whole thing at 3.7V like his design now).

    calculate the watts of the laptop. Volts (18?) times the current (which you’ll have to measure because it’s less than what the power brick says it’s capable).
    lets say your laptop draws 2A at 18V. That’s 36W.
    24 Hours... 864Wh.

    as an aside, 36W load on the boost converter backs out to an input of 36W (if life were 100% efficient. Your boost is probably more like 80%)
    so we need 36 watts into the boost. That’s at 3.7V (assuming you put all the batteries in parallel to avoid cell balancing issues) . 36W at 3.7V is, of course 10A.
    keep that in mind when choosing your wire etc.

    a single 18650 cell is usually around 2000mAh I’ve found that any that claim more than 2000 are totally lying and are probably less (much less) than they say.
    2000mAh at 3.7V is 7.4Wh Oh, wait. We need 864Wh.

    crap. That’s over one hundred 18650 cells!

    (some things might be easier if you put them in series/parallel, some things will be harder. But in either case, the Watts and Watt Hours are the same).

    Volt - unit of potential
    Amp - unit of “flow”
    Watt - unit of power (volts times Amps)
    Watt hour - unit of energy. ( volts times amp Hours)
    Amp hour - is just confusing by itself because without knowing the voltage, it kinda is meaningless.

    thats why converting everything to watts makes life easier.
    you do t have to carry all the voltages through your calculations.


    Tip 8 weeks ago

    I would use a bi-color LED, common anode, either leave the 10k SMD resistor on the grounds or use a resistor on the positive and wire the 2 cathodes to the TP4056. Ideally this thing should take 12V input and 12V output, a switching charging IC may be better in that case (eg TP5000)


    3 months ago

    Nice project!

    a couple quick comments. The charger may not put out enough juice to charge the battery and power the router. Could be a problem after a power outage. If the battery is really low, it will put out less than 3.7v while it’s charging, slowly going to 4.2v where it should shut off.
    the charger probably charges at a constant current until you get to 4v.
    problem is, during charging your router is pulling current from the charger and so is the battery. I don’t know what your router draws or how much current the charger can put out.

    over discharging a lithium ion cell will ruin it. It looks like your charger may have discharge protection (two + and two - pads) and you wired it correctly. But you should make sure and perhaps mention this issue in your instructable.
    or you could use a “protected” 18650. They have a tiny circuit under the false negative contact. It prevents over charging, over discharging, and short circuit/over current protection. The circuit is cool. Pull the wrapper off a dead protected battery. There is a thin strip of metal acting as a wire from the positive pole of the battery, down to the circuit.
    the negative metal circle can be pulled off the actual battery minus and reveal the tiny circuitry.

    not a bad idea to pay a little extra and get protected cells.

    Your switch is in the output which is good.
    have you measured how much current flows out of the battery when the thing is just sitting there, not connected to anything?
    if it’s significant, you might consider a second switch in the red wire from the battery.
    (one of the LEDs is on? The two boost converters are on, even though they’re not connected to anything. It’s called quiescent current. What something draws when it’s not actually doing what it’s supposed to do).

    in your stated use, you don’t need it.
    but you mention traveling and your pants..
    itd be a shame to get where you’re going and have a dead power bank.

    if I could teach you how to twist wires together your cable would look nicer.
    twisting wires is exactly like how they twist three small “ropes” together to make a larger rope.
    trick. Solder one end to the connector. Do not solder the other yet!
    twist the wires tightly together. While you do this, the individual wires will want to “spin” the other way - you have to let them in order for it to work. That’s why you didn’t solder the second connector yet.

    your case looks like you may get be able to fit a second 18650 (wired in parallel) for double the fun.

    1 reply

    An UPS would need a proper load sharing/power path, just need a schottky diode+mosfet to disconnect the cell when power is present/applied.


    3 months ago

    A bit off-topic, but I've been wanting a mini UPS that is enough to sustain 120V/60Hz power (maybe 10 watts) for up to 10 seconds. I keep a VCR in use, and occasional power blips clears the time setting.

    5 replies

    Reply 8 weeks ago

    I would try to open up the VCR to identify the time keeping component and only power that instead, just like radio clocks that keep times using a single coin cell battery for the RTC chip.

    Open Green EnergyGTO3x2

    Reply 3 months ago

    I will try to make one if possible in future.
    Thanks for putting this point.

    Amazon now carry’s a line of small UPS.
    from the comments, they don hold much energy.
    but they’d keep the clock going on you VCR (what’s a VCR:)
    what’s a vcr without a blinking clock?

    i doubt the inexpensive amazon ones I reference could power a 3D printer for very long.
    in the comments, people have wildly different opinions of how long a pc will last on each model. Most of them have no clue. They do not know the difference between Volts, Amps, Watts and most importantly Amp Hours and Watt Hours.
    (they make strange, but authoritative, estimates based on the VA rating of the device. Which has no relationship to the capacity of the battery). That’s where the Amp Hours (Ah) of the battery are multiplied by the voltage of the battery (probably 3.2V or 12V) to get Watt Hours. Then you determine how many watts you’re drawing (amps to router times volts to router is watts to router - and voila. Watt Hours (available) divided by watts (being consumed)... drumroll... is Hours.
    of course the regulators are probably 80% or so efficient so you should derate for that.

    (if you’re confused by my math, remember that Amp Hour Ah is not Amps per hour (which would be A/h) it’s more like Amps for hours. 4Ah means you can draw 4A for an hour. Or 1A for four hours etc.)


    Reply 3 months ago

    Yep, that could also be used for 3D printers. Fortunately power outages are rare in my location but if one happens during a long 3D print...


    Reply 3 months ago

    I would think a commercial UPS is justified there - higher power consumption.