Arduino Driven PWM DC-DC Buck Converter

 


In this blog post, I want to explain a basic buck converter circuit, which is designed to step down a higher DC voltage to a lower DC voltage efficiently. The circuit starts with a 12V battery (BAT1) as the input source. Capacitors like C1, C2, and C3 are used for filtering and stabilizing the voltage, while inductors such as L1 help smooth the current to the load.

Arduino-Driven PWM DC-DC Buck Converter Created by ee-diary.net DC Voltage Battery Sealed Lead Acid BAT1 12V ATMEGA328P ATMEL D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 RX / D0 TX / D1 Vin GND RST A7 A6 A5 A4 A3 A2 A1 A0 AREF D13 www.ee-diary.com Arduino Nano RST GND +5V +3.3V 0 1 2 3 4 5 6 7 8 9 10 11 12 13 A5 A4 A3 A2 A1 A0 A6 A7 Q1 2N2222 R2 1k D1 1N5822 L1 220uH C1 37uF LOAD R1 1k R3 47 Q2 BC337 Q3 BC327 R4 100k Q4 IRFZ44N D2 UF4001 C2 1uF VI 1 VO 3 GND 2 U1 7805 R5 22k R6 10 C3 470uF C4 100nF C5 100nF C6 10uF D3 1N5819 D4 SMBJ33A C7 470uF

The diodes D1 through D4 provide rectification and protection; for instance, D1 and D3 are Schottky diodes that ensure fast switching with minimal voltage drop, and D4 is a transient voltage suppressor for overvoltage protection. The MOSFET Q4 acts as the main switching element controlled by the transistor network Q1, Q2, and Q3, which together regulate the output voltage.  

Resistors R1 through R6 set biasing and feedback levels to maintain stable operation, and additional capacitors like C4, C5, C6, and C7 further filter the output to reduce ripple. Fuses FUSE#001D and FUSE#001E provide current protection for both the input and output sides. Finally, a 7805 linear regulator (U1) ensures a steady 5V supply for sensitive components, and the LOAD represents the device or circuit powered by this buck converter.  

This circuit demonstrates a simple yet effective way to convert higher voltage to a lower, regulated voltage suitable for electronics projects. It’s a great starting point for learning about switching regulators and power management.

Arduino Code


const int pwmPin = 9;

void setup() {
  pinMode(pwmPin, OUTPUT);

  // Timer 1, Phase Correct 8-bit PWM, inverting, prescaler = 1 (~31.37 kHz)
  TCCR1A = _BV(COM1A1) | _BV(COM1A0) | _BV(WGM10);
  TCCR1B = _BV(CS10);

  OCR1A = 128;   // MOSFET on-time = OCR1A / 255 (128 ≈ 50%)
}

void loop() {
}

Graphs

The graph below shows the behavior of a buck converter over a very short time interval. 

buck converter graph

A closer look:

buck converter graph

Here’s a breakdown of waveforms in the graph.

Vpwm: The PWM (Pulse Width Modulation) control signal for the MOSFET. Initially high (~0.736 V), it quickly drops and oscillates, showing how the switching duty cycle changes to regulate the output.  

Vg: The gate voltage applied to the MOSFET. It rises sharply as the transistor turns on and falls when it turns off, reflecting the switching transitions.  

Vsw: The voltage at the switching node (the junction of the MOSFET, diode, and inductor). It shows fast spikes and oscillations corresponding to the MOSFET switching and inductor current changes.  

Vload: The output voltage across the load. It starts near zero and gradually rises toward the regulated voltage, demonstrating how the buck converter smooths out the input to provide a stable output.  

In essence, this graph captures the dynamic response of the buck converter: the PWM signal drives the MOSFET, which switches the voltage at the inductor, and the output capacitor filters this to produce a relatively steady output for the load. Early time steps show rapid transitions, while Vload slowly stabilizes as the converter reaches steady state. 

A practical example of this circuit is powering a microcontroller-based project, such as an Arduino or Raspberry Pi, from a 12V car battery. The buck converter efficiently steps down the 12V to 5V, providing a stable supply for the sensitive electronics while minimizing heat and power loss compared to a linear regulator.

Related blog posts:


Post a Comment

Previous Post Next Post