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

This is an entry in the
Pocket Sized Contest



    • Tape Contest

      Tape Contest
    • Trash to Treasure

      Trash to Treasure
    • Arduino Contest 2019

      Arduino Contest 2019

    49 Discussions


    3 days ago

    Very simple project in a very very good explanation, I love it.

    1 reply

    10 days ago

    Does this also help to filter "not clean" electricity from the wall? So does it all go through the battery or only when the input power is cut out?

    4 replies

    Reply 10 days ago

    Yes and no.

    The device only do DC-DC, so unclean power from the wall will go into the AC/DC power supply BEFORE this device. Since it have been regulated in DC before entering the UPS, it will "clean" the bad wave from the AC...

    But, typically, device using DC have the exact same setup as this, but without any battery in case of "lost of power".

    When we are talking about UPS "cleaning" noise from AC, it's because those UPS are doing AC to DC, then DC to AC, doing a full sin wave. In this case, there's no return to AC.


    Reply 9 days ago

    OK. I want to power my Laptop for at least 24hours during outages now what modifications do I need?


    Reply 7 days ago

    See my post above. I guessed the laptop draws 2A. If I’m wrong, adjust my numbers accordingly.

    With my assumed 2A, you need one hundred 18650 cells.
    you also need a boost regulator that can handle 10A in and 2A out.

    If I was trying to do what you want to do, I’d definitely go with deep cycle car batteries.
    I think a large car battery is something like 100Ah. At 12V, that’s 1200Wh.
    We “only” need 864Wh, so one large car battery could do the job.
    smaller car batteries are more like 40Ah, so you’d need three.

    get a battery (sears)
    get a trickle charger (harbor freight)
    get your boost regulator - which now only has to handle about 3A in (eBay)
    some connectors...

    a lot lot cheaper and easier than 100 18650’s.
    and perhaps safer (100 18650’s multiplies that risk of a LiIon cell doing something nasty by 100).

    Or you could just buy a commercial UPS that is rated at 1000Wh.
    Hmmm. After some googling to see how expensive that would be, I see that UPS vendors rate them by Watts and/or VA - which is how big a load it can handle.
    it gives you no indication of time.


    Reply 9 days ago

    You will have to change pretty much everything. A laptop with need about 70 to 120W at 16-20VDC, depending on a model (that's about 4A).

    So you will have to change pretty much everything to handle and provide 5A and higher DC voltage at bare minimum. Then, you will have to hook a pretty big battery that will last atleast 20 hours (cause the laptop will last 4 hours on itself I guess?).

    It's not an easy project.


    9 days 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.

    5 replies

    Reply 9 days 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 9 days 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 7 days 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.


    Question 8 days ago

    I think you are out-of-spec for both a router battery and, definitely, for a UPS.
    The specification for your items are:
    - Battery: 3.7V, 4.8A current max
    - 12V step up: max 2A
    - Lithium battery charger: 1A

    If you want to use the 12V output only, the router you have has a 12V 1A input. This means that the current required from the battery is 12V*1A/3.7V = 3.2A. The battery can sustain that, but I'm not sure about the boost (the maximum output current of 2A is probably at very low voltages, not at 3x the input voltage). Probably the 1A current for the router is the absolute maximum one, but some more calculations are needed. For sure you can't charge your mobile while the router is powered...

    Regarding the UPS usage, so using it while it is plugged in, the charger output of 1A will never be able to sustain the 3.2A current required. For this reason, you can't use it as a usual UPS.

    1 answer

    Agreed. After a power outage that drains the battery (hopefully the device does it’s job and gets you through the blackout), when power comes back the charger will be putting out 1A - probably at a lower voltage than 3.7v. But your boost regulators are drawing more than an amp. Which means... you’re going to continue to discharge the battery.

    In fact, starting out with a full battery, it will discharge during use, even if charger is plugged in.

    (for me, it’s easier to convert everything to watts, then you don’t have to keep putting voltages into your calculations.).

    in this case, you’re charger is putting in 5W.
    your router (if it really draws an amp at 12v) is drawing 12W.

    As Frarugi87 points out, the math just doesn’t work for using it as UPS.

    The router would need to draw less than about 0.25A for the math to work.

    it will make a very nice power bank, though.


    10 days 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.

    2 replies
    Open Green EnergyGTO3x2

    Reply 10 days 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.)