HIGH VOLTAGE BUCK CONVERTER

Photo of author

By Jackson Taylor

Home » Electronics Topics » Power Electronics » HIGH VOLTAGE BUCK CONVERTER

As an Amazon Associate we earn from qualifying purchases.

A high voltage buck converter takes a high DC input and steps it down to a lower, regulated DC output. It does this by switching a transistor on and off very quickly instead of burning off the extra voltage as heat, so it is far more efficient than a linear regulator. This page explains how the circuit works, which parts need the most care, and how to set up the PWM signal from an Arduino-style board using the code below.

NSS transformer circuit diagram for a high voltage buck converter project

How a high voltage buck converter works

A buck converter has four main parts: a switch (a MOSFET or IGBT), a fast diode, an inductor and an output capacitor. The switch connects the input to the inductor for a short time, then disconnects it. While the switch is on, current builds up in the inductor and feeds the load. While it is off, the inductor keeps current flowing through the diode.

The ratio of on-time to the full switching period is the duty cycle. In an ideal converter running in continuous conduction, the output voltage is roughly the input voltage multiplied by the duty cycle. A 60% duty cycle on a 300 V input gives about 180 V, before losses.

Hardware Hack

Stop Buying New Batteries for Your Tech

Electronics are expensive, but their power sources don't have to be. Discover the simple engineering trick to recondition dead batteries and bring your gadgets back to 100% capacity.

Watch the Free Video

What changes when the voltage is high

The principle is the same at 12 V or 300 V, but the parts and the layout matter much more at high voltage.

  • Switch rating: the MOSFET or IGBT must be rated well above the maximum input voltage, with margin for switching spikes.
  • Diode: use a fast or ultrafast diode with a reverse voltage rating above the input. A slow diode overheats and wastes power.
  • Inductor: it must handle the peak current without saturating. A saturated inductor lets current rise sharply and can destroy the switch.
  • Capacitors: the input and output capacitors need a voltage rating above the highest voltage they will see, and low ESR helps with ripple.
  • Gate drive: a microcontroller pin cannot drive a high voltage switch properly. A gate driver, often isolated, is the usual solution.
See also
WHILE LOOP IN PYTHON

Driving the converter from an Arduino

The control signal for a buck converter is a PWM wave. An Arduino can produce one with analogWrite(), and the duty cycle is set by a value from 0 to 255. The example below uses pin 11 with a value of 150, which is a duty cycle of about 59% (150 / 255).

The default PWM frequency on an Uno-class board is low, around 490 Hz on pin 11 and about 980 Hz on pins 5 and 6. That would call for a very large inductor and capacitor. The code below raises the frequency by changing the timer prescaler, so you can use smaller, cheaper magnetics. With a divisor of 1, pin 11 runs at the base frequency of roughly 31 kHz.

If you want a full build with feedback, see our high voltage buck converter using Arduino article, which covers a 275 V DC to 165 V DC design. For a wider output range, there is also an adjustable buck converter with an IGBT that covers 330 V down to 0 V. If you are new to the topic, start with a basic buck converter using Arduino at low voltage first.

PROGRAM

The sketch sets pin 11 to the highest available PWM frequency and a fixed duty cycle. The setPwmFrequency() helper changes the prescaler bits of the timer that controls the chosen pin.

void setup()
{
    setPwmFrequency(11, 1);
    analogWrite(11,150);
}
void loop()
{
}
void setPwmFrequency(int pin, int divisor) {
    byte mode;
    if(pin == 5 || pin == 6 || pin == 9 || pin == 10) {
        switch(divisor) {
            case 1: mode = 0x01; break;
            case 8: mode = 0x02; break;
            case 64: mode = 0x03; break;
            case 256: mode = 0x04; break;
            case 1024: mode = 0x05; break;
            default: return;
        }
        if(pin == 5 || pin == 6) {
            TCCR0B = TCCR0B & 0b11111000 | mode;
        } else {
            TCCR1B = TCCR1B & 0b11111000 | mode;
        }
    } else if(pin == 3 || pin == 11) {
        switch(divisor) {
            case 1: mode = 0x01; break;
            case 8: mode = 0x02; break;
            case 32: mode = 0x03; break;
            case 64: mode = 0x04; break;
            case 128: mode = 0x05; break;
            case 256: mode = 0x06; break;
            case 1024: mode = 0x7; break;
            default: return;
        }
        TCCR2B = TCCR2B & 0b11111000 | mode;
    }
}
/**
 * Divides a given PWM pin frequency by a divisor.
 *
 * The resulting frequency is equal to the base frequency divided by
 * the given divisor:
 *   - Base frequencies:
 *       o The base frequency for pins 3, 9, 10, and 11 is 31250 Hz.
 *       o The base frequency for pins 5 and 6 is 62500 Hz.
 *   - Divisors:
 *       o The divisors available on pins 5, 6, 9 and 10 are: 1, 8, 64,
 *         256, and 1024.
 *       o The divisors available on pins 3 and 11 are: 1, 8, 32, 64,
 *         128, 256, and 1024.
 *
 * PWM frequencies are tied together in pairs of pins. If one in a
 * pair is changed, the other is also changed to match:
 *   - Pins 5 and 6 are paired on timer0
 *   - Pins 9 and 10 are paired on timer1
 *   - Pins 3 and 11 are paired on timer2
 *
 * Note that this function will have side effects on anything else
 * that uses timers:
 *   - Changes on pins 3, 5, 6, or 11 may cause the delay() and
 *     millis() functions to stop working. Other timing-related
 *     functions may also be affected.
 *   - Changes on pins 9 or 10 will cause the Servo library to function
 *     incorrectly.
 *
 * Thanks to macegr of the Arduino forums for his documentation of the
 * PWM frequency divisors. His post can be viewed at:
 *   http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1235060559/0#4
 *
 */

Notes on the code

  • Pins 3 and 11 share timer2, so changing one changes the other. Pins 9 and 10 share timer1, and pins 5 and 6 share timer0.
  • Timer0 is the one that delay() and millis() rely on, so changing pins 5 or 6 is the most likely to break timing. Pin 11 on timer2 is a safer choice for this kind of project.
  • Changing pins 9 or 10 will break the Servo library.
  • This sketch sets a fixed duty cycle. A real converter should read the output voltage and adjust the duty cycle to hold it steady.
See also
iPad vs Samsung Tablet: Match the Tiers, Then Count What's in the Box

Safety and testing tips

High voltage DC can cause serious injury and can damage equipment in a fraction of a second. A few habits lower the risk.

  1. Test the control circuit at low voltage first, and raise the input in steps.
  2. Use a current-limited supply or a fuse on the input.
  3. Keep the Arduino electrically isolated from the high voltage side, for example with an optocoupler or isolated gate driver.
  4. Discharge the capacitors and confirm the voltage with a meter before touching the board.
  5. Start with a small resistive load, and watch the switch and diode temperature.

If you also need to go the other way, our post on a high step-down converter shows how a converter can work in both directions.

Frequently asked questions

Can an Arduino drive the switch of a high voltage buck converter directly?

Not safely. The board’s pins output 5 V at a low current, which is not enough to switch a power MOSFET or IGBT quickly. Use a gate driver between the Arduino and the switch, and isolate it if the circuit is not referenced to the same ground.

Why change the PWM frequency?

The default Arduino PWM frequency is low. At a higher frequency, the inductor and capacitor can be smaller for the same ripple. The trade-off is more switching loss, so the switch and driver must be able to keep up.

How do I choose the duty cycle?

Divide the output voltage you want by the input voltage. For example, 165 V from 275 V needs a duty cycle of about 60%. Real circuits lose some voltage, so a feedback loop that adjusts the duty cycle works better than a fixed value.

Sustainable Tech

Keep Toxic E-Waste Out of Landfills

Don't throw away your failing laptop, phone, or car batteries. Learn how to recondition them at home in just a few hours. It's better for the planet—and your wallet.

Learn How It Works

Is a buck converter isolated?

No. A standard buck converter shares a common connection between input and output, so it gives no galvanic isolation. If you need isolation, use a transformer-based topology.

Revive Your Dead Electronics

Got a drawer full of dead gadgets or a failing car battery? Instead of paying a premium for replacements, use this simple trick to easily recondition them right from home.

See How It Works