Best one yet. Brilliant video. It really helps the visual learners when you laid out the components on the diagram. My son finally got it! This really put all the pieces together in a great package. It is a wee bit fast, but honestly no issue since you can pause and play as needed. Well done!
I am sooo beginner for your projects most of the time. I wish i fully understand. But when i am not that a beginner you are like an enclopedia for me :)) thanks again man
Great video as always. I like how your videos are structured, it explain things at the beginning, then do the practical stuff. As usual, your video give me better understanding on electronics.
Awesome man, love your videos! I can't really keep up with them all the time, so I have to pause and research every so often, but that is way, way better than having a 30 minute video that goes into every excruciating detail.
I can say that the rather low efficiency of ur circuit is due to the 7805 linear regulator used to power the attiny with 5 volts. You could use a smaller Buck converter module for that but that'll totally destroy the diy aspect. Great work as allways
The main problem with switching power supply is the noise ( the impulsive ripple which can reach very high values ) do you think you can make a video about that, maybe analyzing the best low pass filter yo make it more " linear "? :D
An approach to solve this is to set the output voltage 2-3 V higher than what you want, and the use a linear regulator/LDO in series. They have very little noise. So the linear regulator would be a post-regulator, and the buck/boost would be a pre-regulator.
@@thephlophers That would be with a regulating LDO like the LM317, keep the same deal of a little above wanted voltage and drop the rest with the LDO, now, how to control both at once is another story...
Just found your channel today and subscribed, I will need to see all your old movies now :) Thanks for sharing them with us.... Note: not all of us have an +11K euro oscilloscope, 500 Euro multimeter, etc.... I assume this is not only an hobby for you.
Deine Videos sind simple und gut zu schauen. Und dein Vorgehen ist super, erst Grundlagen, dann Bau ist genial. Nutzung der Englischen Sprache hilft auch ne Menge.
Scott can you make more projects in one week . I will be very thankful to you if you do. your projects are worth apprectation. It is very learning for students.
The designs problem is, that the output has always the mosfet/inductor switching voltage as an offset to the input. that can lead to serious emc/radiation problems. by switching the diode and the cap, you solve the problem, ending with a standard boost topology which has the input+ voltage as gnd- for the output voltage. just the absolute opposite to the flyback. the main differences between all 4 possible combinations are if the input can be capacitor referenced to the output, if we need high side switching and if we need galvanic isolated dc voltage level to power on an additional "output on/off" mosfet. there is not the best design (otherwise the others were not in use). Thanks for your guides and tips :)
Well, I think the low efficiency is because the capacitor always discharges through R4 and R3 in off time, and although the value of R3 and R4 are high, the capacitance of C4 is very low, so a considerable loss per cycle contributes in an overall reduction in efficiency.
Great video man! Thanks for sharing practical knowledge. The position of the switch must be on the low side for practical reasons. With high side switch, there will be negative voltage on the source when diode is conducting and you can not use bootstrap method to drive the MOSFET than. You saved me time, thanks again.
4:58 You don't even need an OP-AMP! Just create a voltage devider between the +5v rail and the output, read the voltage and scale it in software😎 Works just as well and saves time, money, space and power!
@@nielsdaemen acutually, I checked, and yes, you could in theory use a voltage divider for suck a task, the problem is that the voltage divider would load the output, thus decreasing output stability.
Thanks for your contribution to the development of knowledge, I have learned a lot about this type of switched sources. Tip: You may be able to extend your tutorials to design half brigde or push pull converter topologies. Thank you!!
Hi Great Scott, can you make a video about a UPS design for providing battery backup for DC devices such as routers, switches, access points etc? Kind of like a battery charger circuit combined with a SMPS
Could you please make a video about how to build your own cc/cv power source? I mean building it from scratch. Thank you a lot. Btw. Your videos are so good and helpful. You brought me into electronics.
I have to say, everytime I see you explaining and creating diagrams of circuitry, it sparks my interest in learning more about it and being able to reach that knowledge you have as well (someday) Any recommendations of things to learn to be able to be on the right track?
But the electrons are really flowing from the negative to the positive side of the capacitor. Not from positive to positive. I really don't like "conventional current" it makes everything more difficult. I wish everyone could just agree that electrons and current flow from negative to positive.
This is that i search for weeks, and is best, i want to convert an ATX power supply in lab source and intelligent charger, with this I feel that i can reach my purpose
Gee.. i am still learning LTspice and setting up various circuits for some practical experience? Soo... greatscott... this seems like a good one to simulate... thanks...:)
Great video and explanation. Thank you, I really appreciate it. I wonder in the same time if ATTINY85 could be replaced with something else and increase the efficiency through that solution?
wow!love it! I will be building one this week. Questions: 1 what is the frequency? Increasing frequency might be helpful to efficiency and you can do it with Arduino. 2 why not use a resistor valtage devider for feedback? 3 will you please uplode the code for multi chanal version on instructbles? Thankyou.
+GreatScott! Some questions: 1. How did you measure the inductance of a coil? (equipment) 2. Can there be an IC which uses MOD function? i.e. which gives value of the voltage irrespective of polarity 3. Can there be an IC which inverses the voltage value? i.e. +5.5 V to -5.5 V 4. What is the maximum current rating of the circuit you built? Btw, I am a student of Elec. Engg and a huge fan of your video channel.
1. Got mine off eBay. Search for lc200a. Cheap and measures a very wide range of inductance. For 3, you can use a boost converter to boost the 5.5 V to 11V. Connect your target circuit with its ground to the power's 5.5V, the target circuit's +5.5V connected to the power's 11V and the target's -5.5V connected to the power's ground.
Hi. Very nice video, GreatScott! As always. I have a doubt, though: i may be wrong, but isn't "flyback" the name given to the "transformer" in a buck-boost converter topology? As long as i know, you implemented a buck-boost converter only. The flyback converter should have a transformer between circuits, shouldn't it?
Please make video about buck/boost converter with output voltage and current adjustment. How to adjust the output current and support constant output voltage simultaneously?
nice project again... a opamp in the output it is nice to control voltage by reference.. but what about current? can we have good current in the output from it?
Another great video... Question: You calculated the efficiency of your own buck/boost converter at 80% on the boost or buck side... is that about the same as a standard commercial buck/boost? If not.. .how do commercial manufacturers accomplish higher efficiency? ... and thanks for the insights.
HI scott can you do a tutorial on how to make a cheap regulated power supply that can deliver low voltage like max 12v down to 0v with 1 amp, with a lm317 plzz i think it would be the best for beginners cause the lm317 is very common and most beginners like me xD want to power circuits like logical gates with loads attached to relays or transistors. I already watch the video from the diy psu but the components like the main buck boost isnt available in my country and its very expensive to buy from online stores. hope you take this in count, this channel is amazing, my best regards dude.
Not an expert personally, but I'd gather from the formula: V = L * di/dt that for higher frequencies where di/dt is going to be much higher, a relatively lower inductance value is necessary (e.g. for radio frequency chokes). Regarding anything else, all of my electrical engineering friends tend to just guess an appropriate value when they're prototyping and work it out further from there, it seems. At least, I couldn't get a straight answer from them.
A linear voltage regulator has a dropout voltage. So it could work with voltages of (for example) 12.6V and above. A linear regulator can also not step up voltage and they are not efficient.
When using this in a flashlight, I guess it is smarter to rather use two LiIon Cells in series and a buck converter, right? But then, charging is more complicated...
That's awesome! i never thought that inverting buck converter can function as a boost converter as well, but is it possible to replace the opamp by optocoupler as a feedback to the ATtiny?
Yes it is, but the voltage won't be so stable after it. Btw you don't have to use a microcontroller, I have built a buck-boost converter using an op amp, an optocoupler and a 555 timer as a control chip.
@@davidfelipecastroarias8137 You have to connect the optocoupler between pins 8 & 7 of 555 with a resistor in series, gate of the mosfet is connected to the output of 555 via for example 10ohm resistor. Then, diode of the optocoupler can be driven by TL431 or an opamp, by varying the current flowing through it, you change the duty cycle. I have already built several converters this way, and they work flawlessly
Would it be possible to use the Buck/Boost Converter for a solar cell to actually create a regulated constant output voltage? I'm asking since I'm actually interested in loading LiPo cells over a solar cell with a non MPPT BatteryCharger IC I have laying around. I know that you already showed a possible way to charge a LiPo cell with a CNXXXX-IC but I actually want to use the Buck/Boost Converter for other projects too and since it has a probrammable ATtiny85 it would be also usefull to implement other functions too.
Marius Ammann I would also like to see a schematic or video of a UPS that outputs 12v dc. It seems really inefficient to use an inverter UPS when you only want to provide battery backup to devices that work off of 12v dc
Thats quite easy. Your router plug will have the voltage and current requirement written on the power adapter. Mine runs at 9v 0.5A. Take a buck-boost converter or a voltage regulator and hook it to the battery. Adjust the voltage to your requirement and buy a plug which will suit your router power port. When power goes out, simply pull out the adapter from router and attach your DIY adapter. Hope it helps :)
Kirtik Soni, you could simplify it further, if you trickle charge a lead acid battery while the mains supply is there, then when the supply drops out, the battery will continue to supply power to the regulator. Just make sure the battery does not discharge through its charger when the supply fails, by using an isolatoon diode.
Best one yet. Brilliant video. It really helps the visual learners when you laid out the components on the diagram. My son finally got it! This really put all the pieces together in a great package. It is a wee bit fast, but honestly no issue since you can pause and play as needed. Well done!
pm me can you to install do solar panel of charger,
Since I'm already pursuing EE, your videos and its depth of knowledge are always ready to put me in action. Thanks for your existence.
pm me can you to install do solar panel of charger,
Your videos changed my life! I wouldn't be where I am at this point if it weren't for these amazing tutorials.
pm me can you to install do solar panel of charger,
You seem to have your passion, friend. And you're damn good at it.
pm me can you to install do solar panel of charger,
I am 100% Sure That Great Scott Will Go really really Far.
Best wishes man. :))
He is near one million subscribers now.
He's at 1 million now.
@leafonabreeze 1.19
1.25
@@joa4935 1.47
Im not building anything, no fking clue what hes talking about...still love to watch these videos. :D
hes talking about buck rogers and the temple of doom
I am sooo beginner for your projects most of the time. I wish i fully understand. But when i am not that a beginner you are like an enclopedia for me :)) thanks again man
pm me can you to install do solar panel of charger,
Great video as always. I like how your videos are structured, it explain things at the beginning, then do the practical stuff. As usual, your video give me better understanding on electronics.
pm me can you to install do solar panel of charger,
We appreciate the work you put into preparing and drawing those schematics while explaining it. Never doubt that.
pm me can you to install do solar panel of charger,
Day by day he is progressing and his english akcent is much much improved ..............
pm me can you to install do solar panel of charger,
Awesome man, love your videos!
I can't really keep up with them all the time, so I have to pause and research every so often, but that is way, way better than having a 30 minute video that goes into every excruciating detail.
pm me can you to install do solar panel of charger,
I can say that the rather low efficiency of ur circuit is due to the 7805 linear regulator used to power the attiny with 5 volts.
You could use a smaller Buck converter module for that but that'll totally destroy the diy aspect.
Great work as allways
Your truly great , left when the channel had 100 k subs , Great man now your have Half a mil . Keep up the great job scott .
pm me can you to install do solar panel of charger,
Great video! I love these videos because they pack so much information into a relatively short video. Keep up the great work!
pm me can you to install do solar panel of charger,
Finally somebody explained what voltage feedback means! Keppp up the good work!
pm me can you to install do solar panel of charger,
The main problem with switching power supply is the noise ( the impulsive ripple which can reach very high values ) do you think you can make a video about that, maybe analyzing the best low pass filter yo make it more " linear "? :D
it would be interesting to see output on harmonic analyzer
An approach to solve this is to set the output voltage 2-3 V higher than what you want, and the use a linear regulator/LDO in series. They have very little noise. So the linear regulator would be a post-regulator, and the buck/boost would be a pre-regulator.
@@thephlophers That would be with a regulating LDO like the LM317, keep the same deal of a little above wanted voltage and drop the rest with the LDO, now, how to control both at once is another story...
This dude is Einstein the second :) keep up the good work!
Just found your channel today and subscribed, I will need to see all your old movies now :) Thanks for sharing them with us.... Note: not all of us have an +11K euro oscilloscope, 500 Euro multimeter, etc.... I assume this is not only an hobby for you.
pm me can you to install do solar panel of charger,
Deine Videos sind simple und gut zu schauen.
Und dein Vorgehen ist super, erst Grundlagen, dann Bau ist genial.
Nutzung der Englischen Sprache hilft auch ne Menge.
You deserve more subscribers. Superb quality videos that are very informative and easy to understand.
pm me can you to install do solar panel of charger,
Scott can you make more projects in one week .
I will be very thankful to you if you do.
your projects are worth apprectation.
It is very learning for students.
pm me can you to install do solar panel of charger,
Another fantastic video. I am going to try all three projects; Buck, Boost and the Buck/Boost. Very nice instructions.. Thanks
pm me can you to install do solar panel of charger,
The designs problem is, that the output has always the mosfet/inductor switching voltage as an offset to the input. that can lead to serious emc/radiation problems. by switching the diode and the cap, you solve the problem, ending with a standard boost topology which has the input+ voltage as gnd- for the output voltage. just the absolute opposite to the flyback. the main differences between all 4 possible combinations are if the input can be capacitor referenced to the output, if we need high side switching and if we need galvanic isolated dc voltage level to power on an additional "output on/off" mosfet. there is not the best design (otherwise the others were not in use). Thanks for your guides and tips :)
I was expecting this video to release finally it has come
pm me can you to install do solar panel of charger,
I had no idea such a thing existed. Thank you!
it is incredible the way you clearly make things easy
pm me can you to install do solar panel of charger,
This is an excellent project for an engineering student.
pm me can you to install do solar panel of charger,
Very nice video. Now I know, how are the China boost converters exactly working. Thanks for it!
Well, I think the low efficiency is because the capacitor always discharges through R4 and R3 in off time, and although the value of R3 and R4 are high, the capacitance of C4 is very low, so a considerable loss per cycle contributes in an overall reduction in efficiency.
can you explain more about this, why the capacitor can discharge for r3 r4 during close cycle. thank u
No soy muy bueno con el inglés, pero es emocionante ver tus vídeos. Saludos!
pm me can you to install do solar panel of charger,
I have no idea But I really enjoy you soldering.great vid
Great Scott! You just earned yourself a new subscriber. Your videos are so informative.
Great video man! Thanks for sharing practical knowledge. The position of the switch must be on the low side for practical reasons. With high side switch, there will be negative voltage on the source when diode is conducting and you can not use bootstrap method to drive the MOSFET than. You saved me time, thanks again.
pm me can you to install do solar panel of charger,
4:58 You don't even need an OP-AMP! Just create a voltage devider between the +5v rail and the output, read the voltage and scale it in software😎
Works just as well and saves time, money, space and power!
The output is inverted
@@baoxuezhang3300 Yes, but if you make the devider so that even at the max negative output it does not go below 0v on the analog input it works fine!
@@nielsdaemenhow though? The “voltage divider” you are describing is capable of inverting voltages, and that is no different to an op-amp
@@nielsdaemen acutually, I checked, and yes, you could in theory use a voltage divider for suck a task, the problem is that the voltage divider would load the output, thus decreasing output stability.
Gee, that is quite innovative. very clever, and the video fast yet very informative. Thanks, I enjoyed it...
Thanks for your contribution to the development of knowledge, I have learned a lot about this type of switched sources.
Tip: You may be able to extend your tutorials to design half brigde or push pull converter topologies.
Thank you!!
pm me can you to install do solar panel of charger,
I don't know what you are doing, but it looks fun
Hi Great Scott, can you make a video about a UPS design for providing battery backup for DC devices such as routers, switches, access points etc? Kind of like a battery charger circuit combined with a SMPS
Could you please make a video about how to build your own cc/cv power source? I mean building it from scratch. Thank you a lot.
Btw. Your videos are so good and helpful. You brought me into electronics.
I have to say, everytime I see you explaining and creating diagrams of circuitry, it sparks my interest in learning more about it and being able to reach that knowledge you have as well (someday) Any recommendations of things to learn to be able to be on the right track?
thank you very much. please keep making these videos. they are very appreciated!
But the electrons are really flowing from the negative to the positive side of the capacitor. Not from positive to positive. I really don't like "conventional current" it makes everything more difficult. I wish everyone could just agree that electrons and current flow from negative to positive.
We can blame Ben Franklin.
As long as you understand the situation you should have no problems.
Still watching! Great vids!
interesting working principle of boosters circuitry. many thanks !
Very interesting video, I had no idea you could create a buck/boost with only one inductor.
easy eda
This is that i search for weeks, and is best, i want to convert an ATX power supply in lab source and intelligent charger, with this I feel that i can reach my purpose
Awesome engineering & teaching as usual!!
Dude's great effort then this video making my day with my project. Good Luck Scott! and thanks!
I just noticed that you are a lefty! Lefties Unite! :D
Sensational! I love this kind of content. Congratulations for the video!
FYI, the module you've shown is most likely a SEPIC, not a buck-boost. Buck-boost uses just one choke. Correct me if I'm wrong.
what can I say more? GREAT SCOTT!
echt schade, dass die Videos nicht auf deutsch sind, trotzdem einen Daumen nach oben
Nice Video as always ! 👌😀
Thanks ;-)
what pens do you use
thanks
👍👈👉✌😐😕😶😯😟😦😧😎😘
fineliner
Gee.. i am still learning LTspice and setting up various circuits for some practical experience? Soo... greatscott... this seems like a good one to simulate... thanks...:)
Scott you are the best .
Ich feier dich! Man hört richtig das du deutsch bist :3
ja ist er
OwnElectronics Dat is einer wie kein Zweiter
Eine Triedrich von Voltriech ehrt talers
so sie randalieren.
*, dass
First best youtuber
Hola saludos desde Guatemala muy buen canal!!!
WELL! i watches this video, understood the basic concept,nothing else
Great video and explanation. Thank you, I really appreciate it. I wonder in the same time if ATTINY85 could be replaced with something else and increase the efficiency through that solution?
wow!love it! I will be building one this week.
Questions:
1 what is the frequency? Increasing frequency might be helpful to efficiency and you can do it with Arduino.
2 why not use a resistor valtage devider for feedback?
3 will you please uplode the code for multi chanal version on instructbles?
Thankyou.
2: I think because its inverted, so it is -5V and not 5V. This damages the ADC
You are right, thankyou
You're welcome :)
I believe you can use a capacitor for feedback. Not the best, but will work with a little bit of conpensation while coding.
So.. what is the frequency value he is producing?
Fantastic Video Dude. Keep up the great work. Nick.
03:43 "a small load of a milliohm"
bidirectional dc-dc converter please 😊
+GreatScott!
Some questions:
1. How did you measure the inductance of a coil? (equipment)
2. Can there be an IC which uses MOD function? i.e. which gives value of the voltage irrespective of polarity
3. Can there be an IC which inverses the voltage value? i.e. +5.5 V to -5.5 V
4. What is the maximum current rating of the circuit you built?
Btw, I am a student of Elec. Engg and a huge fan of your video channel.
A full-wave rectifier, or an operational amplifier setup the right way, IIRC.
I did not understand. Elaborate please.
1. Got mine off eBay. Search for lc200a. Cheap and measures a very wide range of inductance. For 3, you can use a boost converter to boost the 5.5 V to 11V. Connect your target circuit with its ground to the power's 5.5V, the target circuit's +5.5V connected to the power's 11V and the target's -5.5V connected to the power's ground.
Thanks for info.,
Keval Pandya he uses a transistor tester to measure inductance of a coil. Btw all the best for ur engineering
You are doing a great job with this tutorials. Keep it up :-D
This is an outstanding video. Great stuff.
Could you do a video of FET (triode) vs. Transistor please?
you are so smart bro, greetings from chile 👋👏✌
Hi. Very nice video, GreatScott! As always.
I have a doubt, though: i may be wrong, but isn't "flyback" the name given to the "transformer" in a buck-boost converter topology? As long as i know, you implemented a buck-boost converter only. The flyback converter should have a transformer between circuits, shouldn't it?
Nice video! Why didn't you try a building a SEPIC step up/down converter?
Please make video about buck/boost converter with output voltage and current adjustment. How to adjust the output current and support constant output voltage simultaneously?
thats it im making one that 300percent efficient!! free energy for all!!
but how do i boost my duck
pm me can you to install do solar panel of charger,
Great video! as always :)
What can we use as an alternative Mcp602 ?
Nice video thank you sir , is necessary to use microcontroller
Nice video Your channel is very interesting
nice project again... a opamp in the output it is nice to control voltage by reference.. but what about current? can we have good current in the output from it?
Great video just like Great Scott.....but is it possible to achieve the same results without any microcontroller?
Another great video... Question: You calculated the efficiency of your own buck/boost converter at 80% on the boost or buck side... is that about the same as a standard commercial buck/boost? If not.. .how do commercial manufacturers accomplish higher efficiency? ... and thanks for the insights.
HI scott can you do a tutorial on how to make a cheap regulated power supply that can deliver low voltage like max 12v down to 0v with 1 amp, with a lm317 plzz i think it would be the best for beginners cause the lm317 is very common and most beginners like me xD want to power circuits like logical gates with loads attached to relays or transistors.
I already watch the video from the diy psu but the components like the main buck boost isnt available in my country and its very expensive to buy from online stores.
hope you take this in count, this channel is amazing, my best regards dude.
Great tutorial. How to calculate the inductor value needed?
Not an expert personally, but I'd gather from the formula: V = L * di/dt
that for higher frequencies where di/dt is going to be much higher, a relatively lower inductance value is necessary (e.g. for radio frequency chokes). Regarding anything else, all of my electrical engineering friends tend to just guess an appropriate value when they're prototyping and work it out further from there, it seems. At least, I couldn't get a straight answer from them.
good video!, but, why wouldnt you use a Voltage regulator to keep 12 stable volts instead of the buck/boost converter?
A linear voltage regulator has a dropout voltage. So it could work with voltages of (for example) 12.6V and above. A linear regulator can also not step up voltage and they are not efficient.
its less efficient and the linear voltage regulator can't regulate unless the voltage supplied to it is a few volts greater than the desired voltage
Thanks!
cool! I have some attiny85s coming in soon so maybe I'll have to build one.
Great video. Do you plan on making higher powered flyback circuits?
Not yet.
When using this in a flashlight, I guess it is smarter to rather use two LiIon Cells in series and a buck converter, right? But then, charging is more complicated...
same here. I need a 30A flyback circuits.
This is not a flyback converter; this is an ordinary buck/boost converter. They perform similar functions but do so in very different ways.
2:00 You could set a 50% duty cycle for the 1st switch and then only regulate the boost part.
Great video. Liked it. Can you show how to make an emp jammer
Hey, thanks. You could do a MPPT with that circuit for solar applications. Just an idea!
Great video! What would you do to increase the efficiency?
so using the "directIO" library for the arduino should help out with the switching frequency.
Could an inverting buck-boost be used as a "constant wattage" dc supply?
That's awesome! i never thought that inverting buck converter can function as a boost converter as well, but is it possible to replace the opamp by optocoupler as a feedback to the ATtiny?
Yes it is, but the voltage won't be so stable after it. Btw you don't have to use a microcontroller, I have built a buck-boost converter using an op amp, an optocoupler and a 555 timer as a control chip.
@@__MINT_ you can input straight the 555 pwm to the mosfet? And how do you apply control with those?
@@davidfelipecastroarias8137 You have to connect the optocoupler between pins 8 & 7 of 555 with a resistor in series, gate of the mosfet is connected to the output of 555 via for example 10ohm resistor. Then, diode of the optocoupler can be driven by TL431 or an opamp, by varying the current flowing through it, you change the duty cycle. I have already built several converters this way, and they work flawlessly
Great video, thanks for uploading
Build self-lacing sneakers next!
you can get ride of the attiny by repleasing it with an op amp and a tri osilliator
Great tutorial :D
Ficraft Skowyrsyn
Would it be possible to use the Buck/Boost Converter for a solar cell to actually create a regulated constant output voltage? I'm asking since I'm actually interested in loading LiPo cells over a solar cell with a non MPPT BatteryCharger IC I have laying around. I know that you already showed a possible way to charge a LiPo cell with a CNXXXX-IC but I actually want to use the Buck/Boost Converter for other projects too and since it has a probrammable ATtiny85 it would be also usefull to implement other functions too.
Yes, you could even do your own MPPT
Could you build a Uninterruptible Power Supply, for a 12v router for example, so it can run of a lead acid battery if the power goes out?
Marius Ammann I would also like to see a schematic or video of a UPS that outputs 12v dc. It seems really inefficient to use an inverter UPS when you only want to provide battery backup to devices that work off of 12v dc
Yextus in this case there is no circuit that charges the battery
And some kind of circuit that can quickly change from mains to battery power, once the power goes out
Thats quite easy. Your router plug will have the voltage and current requirement written on the power adapter. Mine runs at 9v 0.5A. Take a buck-boost converter or a voltage regulator and hook it to the battery. Adjust the voltage to your requirement and buy a plug which will suit your router power port. When power goes out, simply pull out the adapter from router and attach your DIY adapter. Hope it helps :)
Kirtik Soni, you could simplify it further, if you trickle charge a lead acid battery while the mains supply is there, then when the supply drops out, the battery will continue to supply power to the regulator. Just make sure the battery does not discharge through its charger when the supply fails, by using an isolatoon diode.