# Arduino Buck-Boost Converter

33,017

71

39

Today i,m gonna tell you how to make a buck-boost converter with all the modern features by yourself. There are many power supplies are available in market but making one by yourself is something awesome. with your custom made supply you can make conditions to charge your battery packs, or get desired voltages for your projects and much more. So lets do it...

with the help of this project i also developed a smps solar charger with 400 Watt power rating and more than 90% efficiency.. have a look in video....

### Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

## Step 1: Getting Into

Buck and Boost converters are a type of power conversion topology. Buck converters are used to step down the high voltage dc to low voltage dc. and Boost converters do just opposite i.e.changing low voltage to high voltage. same thing is done by transformers but they can't convert DC voltage and they are not much efficient.

Both type of converters first convert DC voltage to High frequency AC and then again rectifies it to pulsed DC or continuous DC based upon mode of operation. There are following items needed to build the boost and buck converters.

• Arduino (Nano or Uno) x 1
• N-channel MOSFET (IRF Z44n) x 1
• P- channel MOSFET (IRF9Z24n) x 1
• 100uH inductor (or calculate for your need) x1
• 220uF/35V Capacitor x 2
• 100uF/25v Capacitor x 1
• 100 Ohm/2W resistor x 1
• ACS 712 current sensor (5A or 30A) x 1
• 4.7k resistor x 4
• 1k resistor x 2
• Schottky diode (SR5A0 or any other) x 2
• Screw terminals x2

## Step 2: Buck - Boost Converter Circuit

As you can see in circuit there are two switches are used Tr1 and Tr2. Tr1 switch is being used in buck mode and Tr2 is for boost mode. diode D1 is for buck and D2 for boost. Capacitor C2 is output capacitor for storing power and delivering it to the load. Inductor L is the key part of any DC-DC converter. R load is the load resistor to discharge the output capacitor. there are two voltage dividers are used to measure the input and output voltages. and ACS712 is used to measure the output current.

## Step 3: Building the Converter

Make this circuit on a zero PCB. First we solder the mosfets, inductor, capacitors etc. then make links between them. also solder female burge pin header for arduino nano and current sensor. make voltage divider and connect them to input, output and arduino. give power to arduino by connecting vin on arduino to Vin on Ckt. also don't forget to make all the grounds common. I have here used to output capacitors to reduce the ERS. connect load resistor to output terminals. Connect the Arduino pins as Following.

A0 to output of ACS712, A1 to Vin_sense, A2 to Vout_sense. D5 to Boost_pwm of Tr2 and D6 to Buck_pwm of Tr1.

I,m giving input by Serial port. you can connect buttons to enter the voltage and currents.

## Step 4: Programming Arduino

Arduino is the Heart and Brain of this project. it produces the high frequency PWM for Mosfet switching and also controls the voltage and current.

Generally the PWM frequency of arduino pins are two low. it,s around less than 1Khz. which is not suitable for DC-DC converter operation. Meanwhile Atmega328 is able to provide 62.5KHz PWM on pin 5 & 6 , 32KHz on other pins with the 16MHz clock. To achieve this we have to hack into Arduino PWM. I have modified the Timer 0 config to get the 62KHz PWM. but it costs millis() and delay() functions. as they will work 64 times faster then normal.

Get the Buck_Boost_Converter.ino File for firmware.

## Step 5: Testing

As your Circuit is ready it,s the time to test it. plugin a 9v battery to input and enter the voltage you want at output and watch it working. adjust the sensor offset values to get the precise voltage sensing.

Participated in the
Arduino Contest 2016

## Recommendations

• ### Internet of Things Class

22,742 Enrolled

## 39 Discussions

hello sir,
i've made buck-boost converter with ur guide and calculate repeatly.
but everything i've done, the buck converter (mode buck) it doesn't work, it's like step down output voltage just like 1-2 volt.
can u tell me what's wrong with my project?
please help me

did anyone had the proper code? because the code used is different from the one provided to download.

Hi. I can not run my buck-boost.I made the circuit as your guidance but it doesn`t work. please help me. What should I do?

Thanks

4 replies

it always shows in monitor the charging complete and the battery is not even charged, there is no current flowing to the battery. help me please asap

there are few conditions used in code to show battery full condition.
Vout max is the maximum voltage your converter will try to achieve while regulating the Iout max output current. when voltage is equals to vout max and current is less the Iout min then battery is considered as full charged. now there could be two problems, 1. your voltage sensing isn't ok and 2. your current sensing isn't working properly.
just to verify measure the voltage with multimetre and check what is the measurement in your converter. and the current sensors i have used is 30A model. you may need to adjust if you are using any other. also modify max voltage and current as per your battery specs. Good luck..

if i used p channel and n channel as in your circuit, is there any need for the use of driver IR2110 to run both mosfets?

It will work much better with logic level MOSFETs such as:

N-channel MOSFET: IRLZ44n

P-channel MOSFET: IRLZ24n

1 reply

not really. it's good to have logic level mosfets but with low gate voltage causes higher Rds on resistance which results in power losses. but for low currents yes they are good, because of no need of gate driving circuit.

C1 is used to smooth the input voltage. it makes ADC readings more stable and reduce voltage spikes at input.

as i know, C1 stores voltage so that when the Mosfet is off, it can still supply voltage to the circuit

How did you calculate the electronic componenets please

1 answer

I didn't calculate. i just used whatever i had. wanted to make a boost converter so badly that i came up with this. It was originally made for charging my drone's lipo battery.
but later i made a solar charger based on same concept and i used day counter's online calculation tool for buck converter. it calculates the capacitor size and inductor based upon your parameters.

please,can u give the full schematic diagram of this circuit

Hi there,nice project that you have done,

I made it,but when the input voltage is higher than 8V why the buck converter isn't works? (V out = V input),

If the input voltage is below 8V then the buck converter works perfectly.

And when I use it to charge lead acid battery 12V 7Ah, mosfet P channel in buck converter always going to blow,how can I solve this?