DIY Buck/Boost Converter (Flyback)

85,706

370

81

Introduction: DIY Buck/Boost Converter (Flyback)

About: Awesome Electronics Tutorials, Projects and How To´s

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 (affiliate links):

Aliexpress:
1x ATtiny85: https://s.click.aliexpress.com/e/_d6SPsKP

1x MCP602: https://s.click.aliexpress.com/e/_dZIAwSP

1x 7805 5V regulator: https://s.click.aliexpress.com/e/_d8kqX6x

1x IRLZ44N: https://s.click.aliexpress.com/e/_dWhSrDl

1x 100kΩ Potentiometer: https://s.click.aliexpress.com/e/_dX83GAF

1x 0.03mH Inductor: https://s.click.aliexpress.com/e/_dYct48b

1x 1N5819 Schottky Diode: https://s.click.aliexpress.com/e/_dYR45Bh

2x Screw Terminals: https://s.click.aliexpress.com/e/_dYbstfZ

2x 100nF Capacitor: https://s.click.aliexpress.com/e/_dU4FEsB

1x 100µF, 1x 220µF Capacitor: https://s.click.aliexpress.com/e/_d7dOwRz

2x 10kΩ, 2x 5.1kΩ, 2x 20kΩ, 1x10Ω Resistor: https://s.click.aliexpress.com/e/_dTPpXjt

Ebay:

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

Amazon.de:

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:

http://www.youtube.com/user/greatscottlab

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

https://twitter.com/GreatScottLab

https://www.facebook.com/greatscottlab

3 People Made This Project!

Recommendations

  • 3D Printed Student Design Challenge

    3D Printed Student Design Challenge
  • Hide It Challenge

    Hide It Challenge
  • Paint Challenge

    Paint Challenge

81 Comments

0
clinne
clinne

4 months ago

can anyone advise me the function of the op amp in the circuit?

0
aayazuysal
aayazuysal

Question 4 months ago

Hello. The place where I buy electronics from does not have the MCP602, and I can't find any laying around. So, can I use the LM358P instead of the MCP602?

0
Veikka00
Veikka00

Question 10 months ago on Step 5

Does anyone know how to increase the PWM frequency.

0
kkhafflick13
kkhafflick13

Answer 6 months ago

I believe it's the Potentiometer that controls it

0
nzube
nzube

Question 1 year ago

Where is the code?

0
kkhafflick13
kkhafflick13

Answer 6 months ago

#define F_CPU 8000000
const int pwm = 1;
const int potinput = A1;
const int feedbackinput = A3;
int potinputval;
int feedbackinputval;
int pwmval;
void setup() {
TCCR0A = 2 << COM0A0 | 2 << COM0B0 | 3 << WGM00;
TCCR0B = 0 << WGM02 | 1 << CS00;
TCCR1 = 0 << PWM1A | 0 << COM1A0 | 1 << CS10;
GTCCR = 1 << PWM1B | 2 << COM1B0;
pinMode(pwm, OUTPUT);
pinMode(potinput, INPUT);
pinMode(feedbackinput, INPUT);
digitalWrite(pwm, LOW);
pwmval = 0;
}
void loop() {
potinputval = analogRead(potinput);
feedbackinputval = analogRead(feedbackinput);
while (feedbackinputval < potinputval){
if (pwmval > 203){
analogWrite(pwm, pwmval);
potinputval = analogRead(potinput);
feedbackinputval = analogRead(feedbackinput);
}
else {
analogWrite(pwm, pwmval);
pwmval = pwmval + 1;
potinputval = analogRead(potinput);
feedbackinputval = analogRead(feedbackinput);
}}
while (feedbackinputval > potinputval){
if (pwmval == 0){
analogWrite(pwm, pwmval);
potinputval = analogRead(potinput);
feedbackinputval = analogRead(feedbackinput);
}
else{
analogWrite(pwm, pwmval);
pwmval = pwmval - 1;
potinputval = analogRead(potinput);
feedbackinputval = analogRead(feedbackinput);
}}
}

0
SarvjitP
SarvjitP

1 year ago

I'm getting error that TCCR1 PWM11 are not declared. How can I solve this?

0
sivadasrajan007
sivadasrajan007

Question 3 years ago

Hi

i tried to replicate the results with following changes

used a breadboard

1.used an arduino nano

2.replaced irlz44n with irfz44n

3. didnt use 100nf cap at output of 7805

4.used attached code

5,didnt use the feedback circuit

i powered the circuit with a 12v rectified filtered(not regulated) output

when i adjusted the pot and went above 16v something (i suppose 7805) started to make a buzzing noise i kept going up and my nano behaved erratically and windows refused to detect the nano for a while.

can anyone tell me what went wrong?

F7BR3CPIU2NFBDJ.LARGE.jpgScreenshot (41).png
0
kimbilirbirtarik.34
kimbilirbirtarik.34

Answer 11 months ago

your code is wrong (ıdk in the screenshot it is)

0
Iqbal Samin
Iqbal Samin

4 years ago

I can not find MCP602. Can I use NE5532 or LM358?

0
BrandonB171
BrandonB171

Reply 1 year ago

Probably, but I believe its actually MCP6022

0
KIGULAB
KIGULAB

Question 3 years ago on Step 4

whats is the logic of using "cont int" instead of "int " ???
i never under stand when to use which.............

0
BrandonB171
BrandonB171

Answer 1 year ago

Cont int does is not intended to change, Int does.

0
Valenorious.
Valenorious.

Answer 3 years ago

"int variable_name" is declaring a variable, which could potentially be altered in the course of the program's execution (accidentally). Pin-numbers should not be considered variable. The hardware is allways connected to the same pin. They are to be considered constants. Hence the "const". "const int" means the name after it is a constant of type integer. Constants are not allowed to be altered during the course of the program. You'll get compilation errors if you try. So this is proper programming ettiquete.

0
razim_sha
razim_sha

Question 2 years ago

please anyone tell what is the value of R9

PicsArt_02-05-07.43.28.jpg
0
BrandonB171
BrandonB171

Answer 1 year ago

R9 is a simulated load

0
ZakkyM2
ZakkyM2

Answer 2 years ago

R9 = Load

0
sk492029
sk492029

2 years ago

Not working waste of time

0
mizraim.mtz
mizraim.mtz

2 years ago

I have problems when connecting my oscilloscope to measure the output voltage. When I connect the ground clip the output voltage gets modified to aproximate my input voltage. Someone had a similar problem?