Introduction: Arduino Buck-Boost Converter

Picture of Arduino Buck-Boost Converter

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

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

Picture of 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

Picture of 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

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

Comments

eslipak (author)2017-09-19

Great Work!. Can please post a complete schematic including ACS712 and arduino connections? Also: what are the specs (continuous power/peak)?. Thanks a lot!

wingweaver77 (author)2017-09-05

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?

abhiV4 (author)wingweaver772017-09-06

which mosfet you are using?

in code i have implemented a condition which switch between buck and boost mode based upon input and required output voltage. when output voltage is more than input, converter will work in boost mode, and if output is less than input then it will be switched to buck mode. it causes some issues if output voltage is too close to input or equals to input due to voltage drop in switching components.

also above 8v input is your arduino working? because on board voltage regulator of arduino gets too hot and blows above 12v if too much current is drawn.

choose the inductor current ratings as per your load requirements, same is applicable for mosfet. N channel mosfet can handle more current then P channel mosfet. irf9z24n can only handle 12A. even at 2A load it requires heat sink to cool down.

wingweaver77 (author)abhiV42017-09-11

i'm used p chanel mosfet irf 9540 for buck converter..

mdmartin99 (author)2017-05-16

IMO the p channel mosfet is unnecessary it just decreases the output efficiency.

You cannot just swap out the P-Channel mosfet with an N channel one and have the circuit work.

If you want to use an N channel to replace the P channel then you're going to have to add more electronics in order to put a voltage on the gate of N-Channel mosfet that is higher than the power supply during its ON state. This is commonly called boot strapping.

Hi, I also have an idea to replace the P channel with a N channel. I was failed once before when I used to replace it. My circuit didn't work at all. But I learnt something by those failure.

Can I use IR2110 to drive the gate of N channel MOSFET at the highside (Buck)? I'd like to make sure before I purchase the component.

Thanks

Abdul Goffar

abhiV4 (author)Abdul GoffarA2017-09-06

yes you can replace P channel mosfet with N channel. but it will require proper driving circuit. IR2110 will work if it can generate voltage higher then input voltage.

abhiV4 (author)mdmartin992017-05-20

P channel mosfet is necessary. It forms the buck converter.

Whenever required voltage is lower than input this P channel mosfet starts working and N channel mosfet remains off. Both the mosfets are compulsory for making Buck-Boost converter.

mrhojati (author)2017-08-02

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

abhiV4 (author)mrhojati2017-09-06

what is the problem you are facing?

Abdul GoffarA (author)2017-07-24

Hi, I'd like to replace the P channel by the N channel to gain more efficiency. Lately, I red a lot of discussion about it because of the failure on my latest project.

Would you like to share your experience with this kind of driver? Can I use IR2110 to drive the gate of N channel MOSFET at the highside (Buck)? IR2110 to drive high side and low side Mosfets. I get to make sure if it works well before I purchase the components.

Regards

Abdul Goffar

mrhojati (author)2017-07-16

Hi.
I followed your instructions step by step but my Buck boost didn`t work. I was wondering if you don`t mind helping me more.
Thanks

gelo2002 (author)2017-06-26

Hi,

how did you calculate the constants used in calculation of Iout/Vout/Vin_sense?

abhiV4 (author)gelo20022017-06-26

Vin and Vout is sensd via voltage divider ckt. A voltage divider used to output

Voltage corresponding to higher input. You can learn more by studying about voltage divider.

I used to step down 52v at input to give 5v out to analog pin. Further analog of arduino is used to sense the voltage.

If there is 5v at analog pin then arduino will give 1023 output as it have 10 bit adc.

So going to convert that to voltage divide your input voltage with 1023 and you will have a factor constant.

Now you can sense the volatge and multiply this factor to adv data and you will have the voltage.

In terms of Iout, module acs712 is actually giving an output corresponding to current flow.

It will output 2.5 volt or Vcc/2 at no current. This output will be changed based on ic rating 5A, 20A or 30A.

Again sense the output voltage and multiply with the factor of the ic depends upon current ratings. Also known as resolution, sensitivity or volts per Amp. You will again have the current.

aayushn5 (author)2017-03-30

What are applications of buck-boost conveter?

abhiV4 (author)aayushn52017-04-19

It helps to have different voltages available. if you have 5v available and you need 12V . this can be done easily for AC voltage but in DC isn't that easy. with a boost converter you can boost up this 5V to 12V with 90% or above efficiency. Same is done in stepping down the DC voltage using buck converter. As it's a buck-boost converter it can produce any voltage between 0-30 volts with an input of 5-30 V.

hanlin_y (author)aayushn52017-04-19

Driving LEDs when their forward voltages are close to the battery's.

nikonman461 (author)2017-03-10

no sound?

hamadila (author)2016-12-18

DAB radio

About This Instructable

8,285views

64favorites

License:

Bio: I,m an Electronics Engineer. Love to make things work. Believe in Learn by Making it.
More by abhiV4:Arduino - PV MPPT Solar ChargerWireless Power Transfer PrototypeRaspberry Pi Tutorial
Add instructable to: