• Skip to main content
  • Skip to primary sidebar

Homemade Circuit Projects

Get free circuit help 24/7

Circuits for Beginners | Basic Circuits | LED Driver | Hobby Circuits | Transistor Circuits

New-Projects | Privacy Policy | About us | Contact | Disclaimer | Copyright | Videos

You are here: Home / Arduino Engineering Projects / Make this Buck Converter Using Arduino

Make this Buck Converter Using Arduino

Last Updated on March 20, 2019 by Swagatam

ask questions through comments

In this project we are going to step down 12v D.C to any D.C value between 2 and 11volts. The circuit which steps down the D.C voltage is known as buck converter. The output voltage or step down voltage needed is controlled using a potentiometer connected to arduino.

By Ankit Negi

INTRODUCTION TO CONVERTERS:

There are basically two types of converters:

1. Buck converter

2. Boost converter

Both converters change the input voltage according to the requirement. They are similar to a transformer with one main difference. Whereas transformer steps up/ down an A.C voltage, D.C converters step up/ down D.C voltage. Main components of both the converters are:

A. MOSFET

B. INDUCTOR

C. CAPACITOR

BUCK CONVERTER: as the name itself suggest, buck means to lower down the input voltage. Buck converter gives us the voltage less than the input D.C voltage with high current capacity. It is a direct conversion.

BOOST CONVERTER: as the name itself suggest, boost means to increase the input voltage.

Boost converter gives us the D.C voltage more than the D.C voltage at input. It is also a direct conversion.

** in this project we are going to make a buck converter circuit to step down 12 v D.C using arduino as a PWM source.

CHANGING PWM FREQUENCY ON ARDUINO PINS:

PWM pins of arduino UNO are 3, 5, 6, 9, 10 and 11.

To perform PWM, command used is:

analogWrite( PWM PIN NO,PWM VALUE);

and the PWM frequency for these pins are:

For Arduino Pins 9, 10, 11, and 3---- 500Hz

For Arduino Pins 5 and 6---- 1kHz

These frequencies are fine for general purpose use like fading a led. But for circuit like buck or boost converter, one need high frequency PWM source (in the range of tens of KHZ) because MOSFET need high frequency for perfect switching and also high frequency input decreases the value or size of circuit components like inductor and capacitor. Thus for this project we need high frequency PWM source.

Good thing is that we can change the PWM frequency of PWM pins of arduino by using simple code:

FOR ARDUINO UNO:

Available PWM frequency for D3 & D11:
//TCCR2B = TCCR2B & B11111000 | B00000001; // for PWM frequency of 31372.55 Hz
//TCCR2B = TCCR2B & B11111000 | B00000010; // for PWM frequency of 3921.16 Hz
//TCCR2B = TCCR2B & B11111000 | B00000011; // for PWM frequency of 980.39 Hz
TCCR2B = TCCR2B & B11111000 | B00000100; // for PWM frequency of 490.20 Hz (The DEFAULT)
//TCCR2B = TCCR2B & B11111000 | B00000101; // for PWM frequency of 245.10 Hz
//TCCR2B = TCCR2B & B11111000 | B00000110; // for PWM frequency of 122.55 Hz
//TCCR2B = TCCR2B & B11111000 | B00000111; // for PWM frequency of 30.64 Hz
Available PWM frequency for D5 & D6:
//TCCR0B = TCCR0B & B11111000 | B00000001; // for PWM frequency of 62500.00 Hz
//TCCR0B = TCCR0B & B11111000 | B00000010; // for PWM frequency of 7812.50 Hz
TCCR0B = TCCR0B & B11111000 | B00000011; // for PWM frequency of 976.56 Hz (The DEFAULT)
//TCCR0B = TCCR0B & B11111000 | B00000100; // for PWM frequency of 244.14 Hz
//TCCR0B = TCCR0B & B11111000 | B00000101; // for PWM frequency of 61.04 Hz
Available PWM frequency for D9 & D10:
//TCCR1B = TCCR1B & B11111000 | B00000001; // set timer 1 divisor to 1 for PWM frequency of 31372.55 Hz
//TCCR1B = TCCR1B & B11111000 | B00000010; // for PWM frequency of 3921.16 Hz
TCCR1B = TCCR1B & B11111000 | B00000011; // for PWM frequency of 490.20 Hz (The DEFAULT)
//TCCR1B = TCCR1B & B11111000 | B00000100; // for PWM frequency of 122.55 Hz
//TCCR1B = TCCR1B & B11111000 | B00000101; // for PWM frequency of 30.64 Hz
** we are going to use pin no. 6 for PWM hence the code:
//TCCR0B = TCCR0B & B11111000 | B00000001; // for PWM frequency of 62.5 KHz

COMPONENT LIST:

1. ARDUINO UNO

2. INDUCTOR(100Uh)

3. SCHOTTKY DIODE

4. CAPACITOR (100uf)

5. IRF540N

6. POTENTIOMETER

7. 10k, 100ohm RESISTOR\

8. LOAD( motor in this case)

9. 12 V BATTERY

CIRCUIT DIAGRAM

 

Buck Converter Using Arduino

 

Buck Converter Using Arduino wiring layout

Make connections as shown in circuit diagram.

1. Connect end terminals of potentiometer to 5v pin and ground pin of arduino UNO respectively whereas its wiper terminal to pin analog pin A1.

2. Connect PWM pin 6 of arduino to the base of mosfet.

3. Positive terminal of battery to drain of mosfet and negative to p-terminal of schottky diode.

4. From p-terminal of schottky diode, connect load (motor) in series with inductor to source terminal of mosfet.

5. Now connect n-terminal of schottky diode to source terminal of mosfet.

6. Connect 47uf capacitor across motor.

7. At last connect ground pin of arduino to the source terminal of mosfet.

Purpose of mosfet:

Mosfet is used to switch the input voltage at high frequency and to provide high current with less dissipation of heat.

Purpose of arduino:

For high switching speed of mosfet (at frequency 65 KHz approx.)

Purpose of inductor:

If this circuit is run without connecting an inductor, then there are high chances of damaging the mosfet due to high voltage spikes on terminal of mosfet.

To prevent mosfet from these high voltage spikes it is connected as shown in figure since when mosfet is on it stores energy and when mosfet is off it give away this stored energy to the motor.

Purpose of schottky diode:

Assume schottky diode is not connected in circuit. In this case when mosfet is switched off inductor releases its energy to load or motor which have very slight effect on load because there is incomplete loop for current to flow. Thus schottky diode completes the loop for current to flow. Now a normal diode is not connected here because schottky diode have low forward voltage drop.Purpose of led:
to indicate step down voltage across load.

Purpose of potentiometer:

Potentiometer gives analog value to arduino (based on the position of wiper terminal) according to which pwm voltage is received by gate terminal of mosfet from PWM pin 6 of Arduino. This value ultimately controls the output voltage across load.

Why resistor is connected between gate and source?

Even small amount of noise can turn on the mosfet. Hence a pull down resistor is connected between gate and ground i.e. source.

Program Code

Burn this code to arduino:
int m ; // initialize variable m
int n ; // initialize variable n
void setup()
{
pinMode(6,OUTPUT) ; // set pwm pin 6 as output pin
pinMode(A1,INPUT) ; // set analog pin as input pin
TCCR0B = TCCR0B & B11111000 | B00000001 ; // for PWM frequency of 62.5 KHz on pin 6( explained under code section)
Serial.begin(9600) ; // begin serial communication
}
void loop()
{
m= analogRead(A1) ;// read voltage value from pin A1 at which pot. wiper terminal is connected
n= map(m,0,1023,0,255) ; // map this ip value betwenn 0 and 255
analogWrite(6,n) ; // write mapped value on pin 6
Serial.print(" PWM Value ") ;
Serial.println(n) ;
}

CODE EXPLANATION

1. Variable x is voltage value received from pin A1 at which pot’s wiper terminal is connected.

2. Variable y is assigned the mapped value which is between 0 and 255.

3. **as already explained in above section for circuit like buck or boost converter, one need high frequency PWM source (in the range of tens of KHZ) because MOSFET need high frequency for perfect switching and high frequency input decreases the value or size of circuit components like inductor and capacitor.

Thus we are going to use this simple code to generate pwm voltage of approx. 65 kHz frequency:TCCR0B = TCCR0B & B11111000 | B00000001 ; // for PWM frequency of 62.5 KHz on pin 6

How it Works:

Since Potentiometer gives analog value to arduino (based on the position of wiper terminal), this determines pwm voltage value received by gate terminal of mosfet from PWM pin 6 of Arduino.

And this value ultimately controls the output voltage across load.

When mosfet is on inductor stores energy and when it switches off this stored energy is released to the load i.e. motor in this case.
And because this process takes place at very high frequency we get a step down D.C voltage across motor which depends on the wiper terminal’s position as mosfet is a voltage dependent device.

Prototype Images:

Video Clip of the above Explained Buck Converter Circuit using Arduino

get free help for circuit diagrams

You'll also like:

  • 1.  Color Detector Circuit with Arduino Code
  • 2.  Ultrasonic Fuel Level Indicator Circuit
  • 3.  What’s PWM, How to Measure it
  • 4.  ATmega32, Pinouts Explained
  • 5.  Joystick Controlled 2.4 GHz RC Car Using Arduino
  • 6.  Types of Arduino Boards with Specifications

About Swagatam

I am an electronic engineer (dipIETE ), hobbyist, inventor, schematic/PCB designer, manufacturer. I am also the founder of the website: https://www.homemade-circuits.com/, where I love sharing my innovative circuit ideas and tutorials.
If you have any circuit related query, you may interact through comments, I'll be most happy to help!

Subscribe for the Latest Posts


 

Reader Interactions

Comments

  1. Abir Chowdhury says

    July 9, 2018 at 1:43 pm

    Hi Dear
    Swagatam
    Iam looking for a non microcontroller based12volt dc pwm motor control circuit along with tachometer including 4 digits 7 segment display.can you provide the circuit please.
    Thanks & have a nice day.

    • Swag says

      July 9, 2018 at 4:35 pm

      Hi Abir, I have a microprocessor PWM motor controller explained in this artice:

      https://www.homemade-circuits.com/high-current-motor-control-using-arduino/

      A tachometer circuit is also there but it is not LCD based

      https://www.homemade-circuits.com/tachometer-using-arduino/

  2. Soundarrajan says

    April 25, 2018 at 10:53 am

    If I add voltage feddback from resistor network and current feedback from acs712, is it possible to charge batteries with constant current and voltage, that I require?

    • Swag says

      April 25, 2018 at 12:13 pm

      please explain the set up elaborately.

  3. Tarek ahmed says

    October 15, 2017 at 9:08 pm

    dear swagatam
    nice day sir.,
    I used a 4060 ic and connected the terminals as it required to duplicate the sine wave pulse of speed sensor to start my cruise control unit, but it doesn,t work!, can you suggest another circuit to amplify the frequencies of speed sensor in order to start the device? I hope you solve my problem, grateful to your effort sir .

    • Swag says

      October 16, 2017 at 7:29 am

      Hi Tarek, if it did not work for you, then you should investigate why it did not work, because my suggestion is as per the adtasheet of the IC.

      Pin#11 is the frequency input of the IC 4060, and an external frequency can be fed at it this input to get different baud rates across the 10 outputs of the IC.

      you must confirm the results on table first, using a frequency meter, and then go for the actual integration…

      sorry, I do not have any other idea other than this this one.

    • Tarek ahmed says

      October 16, 2017 at 9:49 am

      ok sir, I will re-test the circuit, but I want to ask you about pin#12(reset) which I connected in ground, can I left it without connection?
      thanks sir.

      • Swag says

        October 16, 2017 at 9:53 am

        pin#12 must be strictly connected to ground, otherwise the circuit will not respond.

  4. Tarek ahmed says

    October 6, 2017 at 10:09 pm

    I would ask you sir for the data sheet of 4060 ic to determine the terminals numbers to avoid wrong connection, thanks sir.

    • Swag says

      October 7, 2017 at 5:37 am

      The connections suggested by me for your specific application is correct, because you are using an external oscillator.

  5. Tarek ahmed says

    October 6, 2017 at 9:40 pm

    sorry sir ., (pin#9 and pin#10) in 4060 ic no connection ?
    thanks sir for your kind help .

    • Swag says

      October 7, 2017 at 5:36 am

      For your application, pin#9/10 can be left unconnected.

  6. Tarek ahmed says

    October 5, 2017 at 8:56 pm

    dear swagatam
    how are you sir ,
    please help me, my vehicle speed sensor signal produce 6000 pulses per kilometer , and i have a cruise control unit , and i want to used it in my car , but the cruise control unit requires speed signal 16000 pulses per kilometer to start . can i make a circuit to convert or increase the signal pulse wave of my vehicle speed sensor ? can you help please , thanks very much sir .

    • Swag says

      October 6, 2017 at 4:41 am

      Tarek, you can try a 4060 IC for this.

      connect its pin#12 and pin#8 to ground, pin#16 to positive, and feed the 6000 input to its pin#11.

      now heck the frequencies across its various outputs, you may find one of the outputs producing the required multiplied output, or something around the required value.

    • Tarek ahmed says

      October 6, 2017 at 9:35 pm

      sorry sir ., (pin#9 and pin#10) no connection ?
      thanks sir for your kind help .

  7. Kartik Sharma says

    October 5, 2017 at 11:59 am

    1. where can I get the inductor of micro Henry value?
    2. Arduino PWM frequency is changed to approx. 65 kHz, What max.value we can achieve?

    • Swag says

      October 5, 2017 at 12:23 pm

      I’ll forward this to Mr. Ankit, he will hopefully answer them soon.

    • Ankit Negi says

      October 5, 2017 at 12:32 pm

      1. I took it out from a circuit board of an old ups. You can easily find it in SMPS also or you can just buy one.
      2. 65KHZ is Maximum frequency which arduino can provide.
      I hope this helps

Primary Sidebar



Categories

  • 3-Phase Power (15)
  • 324 IC Circuits (19)
  • 4017 IC Circuits (52)
  • 4060 IC Circuits (25)
  • 555 IC Circuits (98)
  • 741 IC Circuits (19)
  • Amplifiers (59)
  • Arduino Engineering Projects (83)
  • Audio Projects (94)
  • Battery Chargers (83)
  • Car and Motorcycle (94)
  • Datasheets (46)
  • Decorative Lighting (Diwali, Christmas) (32)
  • DIY LED Projects (89)
  • Electronic Components (97)
  • Electronic Devices and Circuit Theory (35)
  • Electronics Tutorial (109)
  • Fish Aquarium (5)
  • Free Energy (34)
  • Fun Projects (12)
  • GSM Projects (9)
  • Health Related (19)
  • Heater Controllers (28)
  • Home Electrical Circuits (100)
  • How to Articles (20)
  • Incubator Related (6)
  • Industrial Electronics (28)
  • Infrared (IR) (40)
  • Inverter Circuits (98)
  • Laser Projects (12)
  • LM317/LM338 (21)
  • LM3915 IC (25)
  • Meters and Testers (64)
  • Mini Projects (156)
  • Motor Controller (66)
  • MPPT (7)
  • Oscillator Circuits (24)
  • PIR (Passive Infrared) (8)
  • Power Electronics (33)
  • Power Supply Circuits (74)
  • Radio Circuits (9)
  • Remote Control (47)
  • Security and Alarm (61)
  • Sensors and Detectors (118)
  • SG3525 IC (5)
  • Simple Circuits (74)
  • SMPS (29)
  • Solar Controllers (60)
  • Timer and Delay Relay (53)
  • TL494 IC (5)
  • Transformerless Power Supply (8)
  • Transmitter Circuits (40)
  • Ultrasonic Projects (14)
  • Water Level Controller (45)


Circuit Calculators

  • AWG to Millimeter Converter
  • Battery Back up Time Calculator
  • Capacitance Reactance Calculator
  • IC 555 Astable Calculator
  • IC 555 Monostable Calculator
  • Inductance Calculator
  • LC Resonance Calculator
  • LM317, LM338, LM396 Calculator
  • Ohm’s Law Calculator
  • Phase Angle Phase Shift Calculator
  • Power Factor (PF) Calculator
  • Reactance Calculator
  • Small Signal Transistor(BJT) and Diode Quick Datasheet
  • Transistor Astable Calculator
  • Transistor base Resistor Calculator
  • Voltage Divider Calculator
  • Wire Current Calculator
  • Zener Diode Calculator


You can also Chat with me here:

Facebook
Twitter
YouTube
Instagram
My Facebook-Page
Quora



© 2022 · Swagatam Innovations

We use cookies on our website to give you the best experience.
Cookie settingsAccept All
Privacy & Cookies Policy

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Please visit the Privacy Policy Page for more info.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Non-necessary
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
SAVE & ACCEPT