# Buck Converter using Pic Microcontroller and IR2110

Buck converter using pic microcontroller and IR2110, In this article you will learn everything you need to design a buck converter. you will learn the following things in this article

• what is buck converter?
• how to design buck converter?
• what are applications of buck converter?
• how to select components like a diode , switch, inductor, and capacitor for buck converter?
• how to select or design gate driver circuit or IC?
• How to use microcontroller for PWM generation?

I hope that after reading this article you will be able to design your own buck converter according to your requirement.

In the last tutorial, we have seen how to simulate a buck converter circuit using proteus. You can check this tutorial, by visiting this link.

In this tutorial, we will see how to design a buck converter using Pic microcontroller and IR2110 Mosfet driver.

## what is buck converter ?

Buck converter is non-isolated converter that is used to step down DC voltage It actually serves the purpose of a step-down DC transformer. Buck converter is used only for low power applications due to some reasons of efficiency issues, inductor size, and capacitor size. It is beyond the scope of this article to discuss what is the reason behind. You can find the answer to this question from many books on power electronics. Buck converter has very high efficiency for low power applications

### Applications of buck converter ?

There are plenty of application of buck converter in switch mode power supplies and many other. some of the applications are given below

## How to design buck converter ?

In this section, you will learn how to design a Buck converter. Before designing a buck converter you should have a theoretical knowledge of buck converter. how doest buck converter work and how to calculate the value of inductor, capacitor, frequency, and duty cycle of the switch. If you don’t know anything about buck converter I recommend you to read chapter 5 of M.H Rashid book on power electronics.

### Circuit Diagram

Let’s proceed to the practical design of the Buck converter. A simple circuit diagram of a buck converter with a control mechanism is shown below. This is a simple circuit diagram of buck converter you have come across many times while reading about Buck converter in plenty of books. But in practical buck converters, there are many other components used to get regulated step down voltage. These books don’t discuss the practical implementation of the buck converter. After reading this reading you will be able to design a buck converter.

### Required Components

In circuit diagram given below inductor, capacitor and diode can be found easily from market. Inductor should be ferrite core or iron core for high current or power applications. Before selection of diode you should take care of turn on and turn off time of diode. Diode switching time from turn on to turn off and vice versa should be fast. I recommend you to use schotty diode, becuase it have fast reverse recovery time and low forward conduction losses.

You can also use another switch instead of a diode. This type of buck converter is called a synchronous buck converter. Another component used in this circuit diagram is a switch. A switch is the most important component of any dc to dc converter. By controlling turn on and turn off time of switch we actually control voltage at the output of buck converter. Now the question is how to select this switch?

### Switching Device Selection

This switch can be any semiconductor device such as a transistor, MOSFET and IGBT. The selection of these components depends on the power rating of a buck converter. Usually, MOSFET is used in practical buck converters due to its low on-state resistance, high switch frequency, and high power handling capability.

### How to Provide PWM

PWM controller shown in the circuit diagram is used to control turn on and turn off time of the switch. In other words, it is used to control the duty cycle of PWM. PWM stands for pulse width modulation. I have posted a separate article on the pulse with modulation. If you don’t know about pulse width modulation and duty cycle I recommend you to read the following read before reading this article further.

Basics of Pulse width modulation and duty cycle.

### Why we need to Use Mosfet Driver?

Now let’s move to another component need to design buck converter. If you are using MOSFET as a switch, you can use MOSFET either as low side MOSFET driver or high side MOSFET driver. Now you must be thinking why we need of MOSFET driver?

Because MOSFETs are voltage-controlled devices. They have a high gate to source impedance. To get a high switching speed of MOSFET, a gate driving circuit is used.

Another reason to use the gate driver circuit is that if you are using a microcontroller for PWM generation, the output of microcontroller PWM is 5 volt, and to drive MOSFET, we must apply voltage to the gate of MOSFET between 10.5 volts to 12 volts. Therefore, a gate driver circuit is also used to translate voltage level of the PWM square wave.

#### Mosfet Driver Configuration

Mosfet can be used either in a low side or high side configuration. If a load is connected to the source pin of MOSFET it is called high side configurati0n and if the load is connected to the drain pin of MOSFET it is called low side configuration.

There are many gate drivers IC available in the market. But we are using IR2110 of international rectifiers as a gate driver of MOSFET. If you want to know more about gate drivers circuits and How to use IR2110 for high side and low side driver of MOSFET check this article.

What is Gate driver IC and How to use ir2110 MOSFET gate driver IC

## Buck Converter Practical example

Now we take a practical example of the buck converter and teach you how to design its circuit diagram using IR2110 and PWM using a pic microcontroller. Let’s suppose we want to design a buck converter which have input voltage of 12 volt and want to get regulated 5 volt output at the output of buck converter. So

```Vin = 12 volt
Vout = 5 Volt
load = 1 Ampere```

By using these value we can easily calculate values of inductor, capacitor, and duty cycle of pulse width modulation. In other words, turn on or off time of the switch. By using formulas of buck converter you can easily calculate their values. For information about how to calculate values of the inductor-capacitor and duty cycle of PWM, I suggest you yo go through chapter 5, page number 186 of M.H.Rashid book on power electronics. After doing calculations I have found the following values of inductor, capacitor, and duty cycle :

```Inductor = 150 uH
capacitor = 200 uF
duty cycle = 42 %```

## Buck Converter Circuit Diagram using Pic Microcontroller

Now I have designed a circuit diagram of a buck converter using the above-given values. The circuit diagram is given below. Circuit diagram includes MOSFET IR540, MOSFET driver IR2110 in high side configuration, because the load is conned to the high side of MOSFET and 10MQ060 Schottky diode is used. Because load current is 1 ampere and its rating more than 1 ampere.

Complete circuit diagram of Buck converter is given below :

PIC16F877A microcontroller is used to generate PWM and read output voltage as feedback. Two resistors are used as a voltage divider to lower the output voltage. Because the microcontroller pin can not read voltage more than  5 Volt. PIC16877A analog to digital converter is used to read this voltage. If you don’t have an idea about programming and use of PIC microcontrollers, I recommend you to use the following articles :

How to generate PWM using PIC16F877A microcontroller

How to measure analog voltage using PIC16F877A microcontroller

### Video lecture on buck converter simualtion

I have used IR2112 instead of IR2110 because it is not available in Proteus. You can use IR2210 for the same circuit as well. Both MOSFET drivers are almost the same.

## Buck Converter Example with P-Channel MOSFET

In this example, we are using a p channel Mosfet. Therefore, we will use Mosfet driver IR2110 in low side configuration.

This circuit generates 5 volts output from 12 volts input. For more information, check this video lectures:

### Buck Converter Code

This is a code for buck converter using a pic microcontroller. This code is written with Mikroc for pic compiler. It generates a 55% duty cycle on the RC2 pin of PIC16F877A microcontroller.

``````void main()
{

TRISC = 0x00; // PORTC as output
PWM1_Init(50000);  // Initialize PWM1

while (1)        // endless loop
{

PWM1_Start();  // start PWM1
PWM1_Set_Duty(146);  //Change the duty cycle
Delay_ms(1000);
}
}``````

Related Projects and tutorials:

## 23 thoughts on “Buck Converter using Pic Microcontroller and IR2110”

1. Hello Bilal,
I need help in using c programming to control PWM, the circuit I will be using is similar to yours using a buck converter with a pic16f877A and a mosfet driver.
Thanks
Abdul Mohammed

Reply
• hi
I have also mentioned a link in this tutorial about how to generate PWM. check that link

Reply
• HI also have to pin duty cycle = 42%?

Reply
• HI also have to pin duty cycle = 42%? thank!!!

Reply
2. i want the code of pic to control the above circuit buck

Reply
3. where the complete code of the above circuit please

Reply
4. did the circuit worked perfectly in proteous

Reply
• HI also have to pin duty cycle = 42%?

Reply
5. HI also have to pin duty cycle = 42%?

Reply
6. sir which diode is used as D1

Reply
7. Consider revising this sentence. It’s wrong. Because MOSFET has a high on-state resistance and it has a relative low power handling capability. What you wrote is opposite:

“Usually MOSFET is used in practical buck converters due to its low on state resistance, high switch frequency and high power handling capability.”
Thank you!

Reply
8. Hello Bilal,
I tried to implement this configuration using MOSFET IRF3710 and driver circuit based on TLP250, I tested each component and they were all working perfectly separately. In other words, I had the MOSFT on PWM to dim a led and it worked, I checked the continuity of the inductor and it gave buzzing sound even tested the anti-parallel diode. However, by sending PWM to the MOSFET it remained open circuit. Do you’ve any idea why isn’t it working?

Reply
9. how can the program code be

Reply
10. Hello, Iam currently working on a project related to yours. But Iam looking for the possibility of using another software to generate PWM. Need helps.

Reply
11. Hi, Iam currently working on a project similar to yours. What software could best of use to generate PWM apart of prot.

Reply
12. where the complete code of the above circuit please

Reply
13. i need complete code! and which software did you use for coding?

Reply
14. Pwm frequency?..

Reply
15. Hello Bilal,

I wish to design sync buck converter to generate an output voltage as high as 48V and also current upto 4A. can i use a IC from Ltspice ,which shall have in-built linear regulator .

My Vin to the circuit will be from Vbatt (12V-24V) battery
And this design is for Automotive applications

Reply
16. where is complete code sir? help me for my gradulation thesis;

Reply
17. i have an ups star tec it have a problem i suministra 140 voltios.
como puedo soluciobnar el problema si debe sumistrar 120 voltios out put

Reply
18. Hi do you have anyone has this card ?

Reply