Buck, Boost, and Buck-Boost Converters Explained: Choosing and Wiring a Switching Regulator
Every maker who's powered an ESP32 project from a battery eventually runs into the same problem: a LiPo cell sags from 4.2V down to 3.0V over its discharge cycle, but the board wants a stable 3.3V (or 5V for that WS2812B strip), and a linear regulator either can't do the job (it can't boost a sagging 3.0V up to 3.3V at all) or wastes a painful fraction of your battery capacity as heat trying. Switching regulators — buck, boost, and buck-boost converters — solve this properly, and understanding which topology fits which situation is one of those pieces of electronics knowledge that pays for itself on nearly every battery or multi-voltage project you build.
Why Switching Beats Linear for This Job
A linear regulator (like the LM317 covered in this site's bench power supply build) drops excess voltage as heat — if you're regulating 12V down to 5V at 1A, it's burning roughly 7W as waste heat to deliver 5W of useful power, a real efficiency problem and a real heatsink requirement. A switching regulator instead rapidly switches an inductor on and off, storing and releasing energy in tight pulses controlled by a feedback loop, and typically hits 85-95% efficiency across a wide input range with only a small inductor and diode getting warm instead of a whole heatsink. The tradeoff is switching noise — a switching regulator's output has more ripple and RF noise than a clean linear supply, which matters for sensitive analog or RF work (see the noise-filtering section below) but rarely matters for digital logic, motors, or LEDs.
The Three Topologies
TopologyWhat it doesTypical use case Buck (step-down)Output voltage is always lower than input12V shop supply down to 5V for a Raspberry Pi; 7.4V 2S LiPo down to 3.3V for an ESP32 Boost (step-up)Output voltage is always higher than inputSingle-cell 3.7V LiPo or 2x AA (3V) up to 5V or 12V; solar panel trickle charge to a higher bus voltage Buck-boostOutput stays fixed regardless of whether input is above or below the targetA LiPo cell that starts at 4.2V (above your 3.3V target) and sags to 3.0V (below it) over a discharge cycle — the exact case a single-cell battery project usually needsCommon ICs and Modules
PartTopologyInput rangeOutputMax currentNotes LM2596Buck4.5-40V1.25-37V adjustable~3ACheap, widely available on breakout modules, moderate switching frequency (~150kHz) means a physically larger inductor MP1584ENBuck4.5-28V0.8-20V adjustable~3AHigher switching frequency than LM2596, smaller module footprint, good default choice for 12V-to-5V/3.3V logic supplies MT3608Boost2-24Vup to 28V adjustable~2A (less at high boost ratios)Very common on cheap breakout boards; efficiency drops off sharply as the boost ratio increases, so it's better for 3.7V-to-5V than 3.7V-to-24V XL6009Boost (also buck-boost capable in some configs)3-32V5-35V adjustable~4A (heatsinked)Higher current capability than MT3608, needs a heatsink at real load TPS61200 / TPS63000 familyTrue buck-boost~1.8-5.5V1.8-5.5V fixed or adjustable~1AThe right choice for single-cell LiPo-to-3.3V/5V projects where input crosses above and below the target during dischargePractical Wiring Notes
- Input reverse-polarity protection: add a series Schottky diode or a P-channel MOSFET protection circuit ahead of the regulator on any battery-powered build with a user-accessible connector — a reversed battery connector on a bare buck module will usually destroy it instantly.
- Quiescent current matters for deep sleep: a cheap adjustable buck module can draw several milliamps of quiescent current even with no load, which will quietly drain a battery in an ESP32 deep-sleep project far faster than the ESP32's own microamp-level sleep current — check the IC's no-load quiescent current spec before pairing it with a low-power sleep design, and prefer parts specifically rated for low quiescent current (many datasheets call this out as an "ultra-low IQ" or "battery-friendly" feature) if the project spends most of its life asleep.
- Input/output capacitor voltage rating: always rate capacitors well above your maximum input voltage, not just your nominal one — a 2S LiPo fresh off the charger sits noticeably above its "nominal" 7.4V, and a marginal capacitor rating is a common field failure.
- Set the adjustable trimpot with a multimeter under no load before connecting your actual circuit — many cheap adjustable modules ship with the trimpot set to an arbitrary voltage, and connecting an unregulated-to-overvoltage output straight to a 3.3V logic board is a fast way to release the magic smoke.
Filtering Switching Noise for Sensitive Circuits
If you're powering an SDR, audio amplifier, analog sensor front end, or anything else sensitive to conducted or radiated noise, a bare switching regulator output often isn't clean enough on its own. A small LC filter (a few µH inductor plus a low-ESR electrolytic or ceramic capacitor) on the output knocks down switching ripple significantly, and physically separating the regulator and its inductor from sensitive analog traces or antennas reduces radiated coupling. For genuinely noise-critical stages, a common pattern is switching regulation for the bulk conversion (say, battery voltage down to 5V) followed by a low-dropout linear regulator as a final "cleanup" stage feeding just the sensitive part of the circuit — you get most of the switching regulator's efficiency gain while the LDO soaks up the last bit of ripple right at the point that needs it.
Choosing Between Them: A Quick Decision Guide
- If your input voltage is always comfortably above your target output and never gets close to it — use a buck converter.
- If your input voltage is always below your target output — use a boost converter.
- If your input voltage crosses your target output during normal operation (the classic single-cell LiPo case) — use a true buck-boost IC, not a buck or boost module alone; a plain buck module simply stops regulating once input sags below target, and a plain boost module can be damaged or behave unpredictably if input rises above target.
- If your load is noise-sensitive (RF, precision analog) — add output filtering or a linear post-regulator stage regardless of topology.
Safety Notes
Switching regulator ICs can run hot enough to burn skin at sustained high load even when operating completely normally — check datasheet thermal specs and add a heatsink or heatsink pad if you're running near the part's rated current continuously. Always verify a module's output voltage with a multimeter before connecting it to an expensive board, and double-check capacitor voltage ratings and polarity on every build, since a reversed or under-rated electrolytic capacitor on the output of a switching supply can fail explosively rather than just quietly.
Switching regulators are one of those components that are easy to treat as an interchangeable black box, but the topology choice genuinely matters — a boost module wired where a project actually needed buck-boost is a common cause of "it worked on the bench with a fresh battery but died in the field" failures. Match the topology to your actual input voltage range across the full discharge or supply cycle, not just the nominal voltage on the label, and you'll avoid the most common switching-regulator mistake makers run into.
Related Guides
- ESP32 Deep Sleep & Battery Optimization for Solar/Battery Projects
- Linear Voltage Regulators Explained: 7805, LDOs, Dropout Voltage, and Thermal Design
- EMI and Noise Suppression for Maker Electronics: Ferrite Beads, Decoupling, and Grounding Done Right
- USB-C Power Delivery for Maker Projects: Trigger Boards, PD Negotiation, and Powering Your Builds from Any Charger
- Battery Fuel Gauge ICs for Lithium Projects: MAX17048, BQ27441, and Coulomb Counting Explained
- Current Sensing for Makers: Shunt Resistors, INA219/INA226, and ACS712 Hall-Effect Sensors
- Build a Long-Range ESP32 LoRa Sensor Node for Off-WiFi-Grid Monitoring
- How to Program Addressable LED Strips: WS2812B Patterns, Effects, and Power Design