In this project I will show you how a buck/boost converter (flyback) works and how you can easily build one that can step up and step down DC voltage efficiently. Let's get started!

Step 1: Watch the Video!

After watching the video you should have the basic knowledge to create your own buck/boost converter. The next steps though will contain additional information to make your life easier.

Step 2: Order the Components!

Here you can find a parts list with example seller:

1x ATtiny85: http://amzn.to/2e1mPzU

1x MCP602: http://amzn.to/2e1mPzU

1x 7805 5V regulator: http://amzn.to/2e1mPzU

1x IRLZ44N: http://amzn.to/2e1mPzU

1x 100kΩ Potentiometer: http://amzn.to/2e1mPzU

1x 0.03mH Inductor: http://amzn.to/2e1mPzU

1x 1N5819 Schottky Diode: http://amzn.to/2e1mPzU

2x Screw Terminals: http://amzn.to/2e1mPzU

2x 100nF Capacitor: http://amzn.to/2e1mPzU

1x 100µF, 1x 220µF Capacitor: http://amzn.to/2e1mPzU

2x 10kΩ, 2x 5.1kΩ, 2x 20kΩ, 1x10Ω Resistor: http://amzn.to/2e1mPzU


1x ATtiny85: http://rover.ebay.com/rover/1/711-53200-19255-0/1..
1x MCP602: http://rover.ebay.com/rover/1/711-53200-19255-0/1...

1x 7805 5V regulator: http://rover.ebay.com/rover/1/711-53200-19255-0/1...

1x IRLZ44N: http://rover.ebay.com/rover/1/711-53200-19255-0/1...

1x 100kΩ Potentiometer: http://rover.ebay.com/rover/1/711-53200-19255-0/1...

1x 0.03mH Inductor: http://rover.ebay.com/rover/1/711-53200-19255-0/1...

1x 1N5819 Schottky Diode: http://rover.ebay.com/rover/1/711-53200-19255-0/1...

2x Screw Terminals: http://rover.ebay.com/rover/1/711-53200-19255-0/1...

2x 100nF Capacitor: http://rover.ebay.com/rover/1/711-53200-19255-0/1...

1x 100µF, 1x 220µF Capacitor: http://rover.ebay.com/rover/1/711-53200-19255-0/1...

2x 10kΩ, 2x 5.1kΩ, 2x 20kΩ, 1x10Ω Resistor: http://rover.ebay.com/rover/1/711-53200-19255-0/1...


1x ATtiny85: http://amzn.to/2dWIc4j

1x MCP602:http://amzn.to/2dLaboV
1x 7805 5V regulator: http://amzn.to/2dWHC6K

1x IRLZ44N: http://amzn.to/2dL9WKB

1x 100kΩ Potentiometer: http://amzn.to/2dLaikl

1x 0.03mH Inductor: http://amzn.to/2dWIojS

1x 1N5819 Schottky Diode: http://amzn.to/2dLapwo

2x Screw Terminals: http://amzn.to/2aTTLNW

2x 100nF Capacitor: http://amzn.to/2dWJaNW

1x 100µF, 1x 220µF Capacitor: http://amzn.to/2dL9dsO

2x 10kΩ, 2x 5.1kΩ, 2x 20kΩ, 1x10Ω Resistor: http://amzn.to/2aAsWdV

Step 3: Create the Circuit!

Here you can find the schematic and pictures of the circuit that I created. Feel free to use them as a reference. You can also find the schematic on EasyEDA: https://easyeda.com/GreatScott/ATtiny_Buck_Boost_C...

Step 4: Upload the Code!

Here you can find the code that you need to upload to the ATtiny85 before plugging it in the circuit. If you don't know how to upload the sketch then make sure to watch this video of mine:

Step 5: Success!

Awesome! You did it! You just created your own buck/boost converter!

Feel free to check out my YouTube channel for more awesome projects:


You can also follow me on Facebook, Twitter and Google+ for news about upcoming projects and behind the scenes information:



<p>how many watts can handle? I'd like to make one for a 120 W load</p>
<p>Power electronics are no easy thing...</p><p>I would suggest to go with something like </p><p>https://www.aliexpress.com/item/10-30V-to-12-35V-Step-Up-CV-CC-150W-10A-DC-Buck-Boost-Converter-Car/32800195388.html for &lt;5$ or if you want a digital interface https://www.aliexpress.com/item/DC-DC-Adjustable-10-40V-To-0-38V-Digital-Step-up-Step-down-Power-Supply-Boost/32789812405.html </p>
<p>Hello~ I have a question. Can I use another OP amp for this project? Im having a hard time finding one here locally. </p>
<p>Hey scott can you tell me how you calculated the value of inductor and the capacitor used in the circuit?</p>
<p>This is really neat. Thanks for the share!</p>
<p>How about a list of specs such as input/output voltage range, output current, etc?</p>
<p>Input: 6V-30V Output: 0-20V Output Current: 1-2A</p>
<p>hey scott, does this circuit can works with input 2-7v,and constant output voltage as 5.5v? i want some advice from you.....i am waiting for your answer please?</p>
<p>if we would replace the 1n5819 diode with a 1n5822 diode, wouldn't it be possible to draw up to 3 A ? (ofc if we take into account that our power inductor can handle this)</p>
<p>Sir, can you added also the calculation for getting the component in the later video. Especially using inductor and resistor and capacitor when making something like buck / boost converter. Thanks ^^</p>
<p>is there any change needed if I want to do this on an arduino nano or the other arduino boards?</p>
<p>Not really. </p>
<p>hey i executed the program and there seems to be an error in the line 12. it says 'TCCR1 was not declared in this scope'. I dont want to bother you with the programming questions, but i tried understanding this code and there are some terms I dont understand. these are the errors it showed when i executed it in the arduino uno. </p><p>BuckBoostConverter:12: error: 'TCCR1' was not declared in this scope</p><p>BuckBoostConverter:12: error: 'PWM1A' was not declared in this scope</p><p>BuckBoostConverter:13: error: 'PWM1B' was not declared in this scope</p><p>'TCCR1' was not declared in this scope</p>
<p>please just replace these codes with &quot;TCCR0B = TCCR0B &amp; 0b11111000 | 0x01;&quot; because i had same problem firstly</p>
<p>1 what is the frequency? Increasing frequency might be helpful to efficiency and you can do it with Arduino. </p><p>2 why not use a resistor valtage devider for feedback? </p><p>3 will you please uplode the code for multi chanal version based on Arduino Nano here? </p><p>Thankyou.</p>
<p>indeed, why didn't he use a voltage divider as in his boost converter circuit ?</p><p>Im' guessing he did it because it wastes less power but not sure...</p>
<p>I've tried to build this circuit and noticed that he used the op amp to get his ground to the same level as the one of the attiny. Just using a voltage divider would result in &gt; 12V on the attiny analog pin which would destroy it. Personally, i don't have this op amp and i'm looking for a good alternative. If someone knows, please let me know :)</p>
I'm very much interested in this project I'm going to start the work but the only thing is that mcp602 Op-amp is not available but I have Lm358 can it be used
Is it ok if I use 0.02mH or 4.7uH?
<p>1. in your shematic R9 not a resitor is it load ?</p><p>2. 100nF ceramic cap. you use only on of them at finished photo or i coudnt see it but shematic &amp; bom 2 of them </p><p>3.attiny 85 whats the options for programing bod % ldo enable/disabled, 8mhz (int/ext) ?</p>
<p>In the code, it's written : if (pwmval &gt; 203) </p><p>What ADC value 203 is ? The limit of buck and boost (in this case around 11V at 4:05 in the video) or something else ? </p><p>Thanks.</p>
<p>What brand perfboard do you use? I hate the cheap Chinese browboard.</p>
I have just gripe on all swithchers and that is NOISE I listen a lot to radio and especially if the signal is on the fringe then BUZZZZZZZZ!!!!!!!!!! How can a poor old feller cure this? I have a UPS for my fridges and the output is &quot;pure sine&quot;wave but matey some days when the batteries get charged BUZZ TACK BUZZZ It is a 3Kw unit and the size of a reps document case and weigh about three kilo's! Try to operate a Medium Wave (AM) radio near a computer's psu!!
<p>Why the op-amp resistor divider calculation must be multiplied by 20 ? Was it because it's the maximum voltage that you want ?</p>
<p>so, 20 means the voltage output desire ? thanks for your information !</p>
What the best op amp eqiuvalent?
i have a 40w laser cutter that keeps blowing the flyback transformer would this be a good replacement
<p>is it a k40? Look on the google+ user group for k40. I do have the schematic for it and probably cnan help.</p>
Yes its a k40 im already a member of the Google + group
<p>the power supply is easy to repair. Is the 24 volt section not working? The culprit is most likely the rectifying diode in the 24 section which is close to the connectors. When this breaks, everything switches off since the high voltage circuit relies on 12 v derived from the 24 v circuit. Just measure with a multimeter if the diode is a short in both directions. You can replace this schottky diode her308g. Don't use a normal diode because it does not work. The schematic is on the google plus page of the k40 group. I will post a pdf on their as well since people complained about the visibility of the picture. Let me know how you go. And not this flyback circuit is not power full enough to drive the steppers in the k40.</p>
thank you
Nice... It's useful...

About This Instructable




Bio: Awesome Electronics Tutorials, Projects and How To´s
More by GreatScottLab:DIY Arduino Soldering Station Make Your Own GPS SMS Security Tracking System DIY Portable LED Panel 
Add instructable to: