Guide no. 18
Lowering, raising or holding steady a voltage that changes: which converter you need, how to adjust it and which numbers to check before buying. With the current and efficiency math already worked out.
By Ada Intelisano · informaticait.it technical team
- Step-down (buck): output lower than the input, from 12 V to 5 V. Step-up (boost): output higher, from a 3.7 V battery to 5 V. Buck-boost: the input can be above or below the output.
- Power is not created: in a boost the current drawn from the battery is higher than the current that comes out.
- There are four numbers to look at: minimum and maximum input voltage, the real output current (not the switch rating), efficiency and heat.
- An adjustable module is set with no load, using the multimeter, before you connect the board to it.
Which one you need
If the input is always higher than the output, a step-down is enough; if it is always lower, a step-up. The in-between case is the lithium battery: it goes from 4.2 V when charged to 3.0 V when flat, so to get a steady 3.3 V it moves from above to below. That is where you need a buck-boost (or a low-dropout LDO, accepting that you lose the last part of the charge).
Step-down: how it works
The switch stays on for part of the period, the duty cycle. In the ideal case Vout = D × Vin: to get 5 V from 12 V it stays on about 42 % of the time. The output current can be higher than the current going in.
Step-up: how it works
Here the switch connects the inductor to ground: it charges, then when the switch opens its voltage adds to the input voltage and goes through the diode to the output. In the ideal case Vout = Vin ÷ (1 − D): from 3.7 to 5 V the duty cycle is about 26 %.
A confusing word. Texas Instruments also uses “buck-boost” for the circuit that gives a negative output. The modules sold to makers as buck-boost (for example the Pololu S7V8F5) keep the same polarity instead: always check the datasheet.
Working out the current
Output power = Vout × Iout. Power taken at the input = output power ÷ efficiency. So Iin = Vout × Iout ÷ (η × Vin).
The adjustable module
Almost all adjustable modules have four terminals (input + and −, output + and −), a chip, an inductor and a trimmer that changes the feedback divider: Vout = Vref × (1 + R2 ÷ R1), with Vref given in the chip datasheet (1.25 V for the XL4015, 0.6 V for the MT3608, 0.8 V for the MP1584).
How to adjust it without breaking anything
- Connect only the input supply, no load.
- Put the multimeter on the output terminals, set to DC voltage.
- Turn the trimmer slowly until you reach the value you need; with a multi-turn trimmer it can take several turns before you see any change.
- Switch off, connect the load, switch back on and check again: under load the voltage can drop a little.
Common chips and modules (datasheet figures)
| Type | Input | Output | Current | Frequency | |
|---|---|---|---|---|---|
| LM2596 | step-down | up to 40 V | 1.2–37 V | 3 A | 150 kHz |
| XL4015 | step-down | 8–36 V | 1.25–32 V | 5 A | 180 kHz |
| MP1584 | step-down | 4.5–28 V | 0.8–25 V | 3 A | 100 kHz–1.5 MHz |
| MT3608 | step-up | 2–24 V | up to 28 V | switch limited to 4 A | 1.2 MHz |
| Pololu S7V8F5 | buck-boost | 2.7–11.8 V | fixed 5 V | 0.5 to 1 A depending on voltage | — |
| Pololu U1V10F5 | step-up | 0.5–5.5 V | fixed 5 V | switch 1.2 A | — |
The MP1584 is marked by the manufacturer as “not recommended for new designs” (replacement: MP2338). The MT3608 datasheet is not published on the manufacturer's website: the figures come from a copy distributed by Olimex.
Things to check before buying
- Minimum input voltage. Every chip has a threshold below which it shuts down (MP1584: 3.0 V; the XL4015 needs at least 8 V), and a step-down needs some headroom above the output: the LM2596 loses about 1.3 V at 3 A.
- Real output current. On boost modules the big number on the package is often the switch rating; the output current is lower.
- Efficiency. It changes with input voltage and load: the Pololu D24V10F5 goes from about 92 % at 9 V to about 84 % at 32 V.
- Heat. Even at 90 %, a module delivering 20 W dissipates about 2 W: Pololu warns that its regulators can get hot enough to burn you.
- Polarity. Many modules are not protected against reversed input wires.
- Spikes at power-on. With long cables and high input voltages, overvoltage spikes can occur: above 20 V Pololu recommends a 33 µF electrolytic capacitor close to the input (D24V10F5).
Common mistakes
| What happens | Why | Fix |
|---|---|---|
| Board burned as soon as it is connected | trimmer left at maximum: the output was almost at the input voltage | always adjust with no load, using the multimeter |
| The step-up shuts down or the battery “dies” early | current drawn from the battery higher than expected, especially when it is nearly flat | redo the math with the battery's minimum voltage |
| Step-down that does not regulate | input too close to the output or below the chip threshold | choose a buck-boost or raise the input |
| ESP32 that resets while transmitting | the converter cannot handle the current peaks | a module with more headroom and a capacitor on the output |
| Noisy analog readings | switching ripple on the sensors' supply | a filter or an LDO after the converter |
Useful products
Other guides
- Resistor colour code and tolerances
- N-channel and P-channel MOSFETs
- Bipolar transistor (BJT) or MOSFET?
- Relays: how to drive them and how much current they draw
- THT and SMD/SMT components
- XIAO board pinouts
- LEDs: forward voltage and series resistor
- The multimeter: measuring voltage and current
- Wemos D1 mini: first steps
- MOSFET module with Arduino and ESP32
- Relay module with Arduino and ESP32
- 3D printing filaments: PLA, PETG and fibre-filled versions
- Analog and digital: the differences
- ADS1115: 16-bit converter with Arduino and ESP32
- From bits to real values: converting sensor readings
- DS3231 RTC clock with Arduino and ESP32
- Linear or switching regulator: which one to choose
- Voltage divider: reading voltages higher than 5 V or 3.3 V
- Pull-up, pull-down and bounce: wiring a button properly
- 3.3 V and 5 V logic levels: getting an ESP32 and an Arduino to talk
- The I²C bus: addresses, pull-ups and the scanner
- Lithium batteries: voltages, charging and protection
- ESP32 power consumption and deep sleep: how long the battery lasts
- Temperature sensors compared
- ESP32: which pins to use and which to avoid
- Getting started with the ESP32 in Arduino IDE 2 and PlatformIO
- SSD1306 OLED display and 16×2 I²C LCD with Arduino and ESP32
- PIR motion sensor and HC-SR04 ultrasonic sensor
- Date and time from the Internet with the ESP32: NTP, Italian time zone and daylight saving time
- MicroSD data logger: saving measurements to CSV
- Solar-powered ESP32: panel, charger and the numbers for Italy
- Web server on the ESP32: control a relay from your phone
- Your first LED: wire it up and make it blink
- The button: let Arduino decide
- The potentiometer: turn a knob and read its value
- Soft light: adjusting the brightness of an LED
- The buzzer: playing notes and melodies
- The traffic light: three LEDs in sequence
- The thermometer: reading the temperature with the TMP36
- The servo motor: moving an arm with Arduino
- The night light: the photoresistor and your first decision
- The relay: switching on a light bulb with Arduino
- The LCD display: making Arduino write
- The electronic dice: your first complete project
- The RGB LED: every color from three lights
- The joystick: two-axis control with a shield
- The LED ring: twelve colors from a single pin
- The DC motor: driving it with a MOSFET
- Soil moisture: the plant that asks for water
- The stepper motor: turn exactly as far as you want
- The parking sensor: faster and faster beeps
- The 7-segment display: big, bright numbers
- Automatic watering: the plant that waters itself
- The keypad: a lock with a secret code
- Networked weather station: values and chart on your phone
- A Telegram bot on the ESP32: your home from your phone
- MQTT with the ESP32: the language of connected devices
- Updating the ESP32 over Wi-Fi (OTA)
- ESP-NOW: two ESP32 boards talking without a router
- WebSocket with the ESP32: the LED that follows the slider
- Readings on a Google sheet, with deep sleep
- WiFiManager: choose the Wi-Fi from your phone
- Bluetooth LE with the ESP32: the phone without a network
- The camera in your browser with the ESP32-S3
- A portable Bluetooth speaker you build yourself
- Bluetooth desktop speakers, 2 × 20 W
- Stereo MP3 player with two buttons
- The shelf that plays music: a Visaton exciter
- How to solder well
- How much does it draw? Current and power with the INA219
- Load-cell scale with the HX711
- CO2 traffic light: when to open the windows
- RFID card door opener
- GPS: track logger on microSD
- LoRa: how far does it go? A range test with two boards
- Battery weather sign with an e-paper display
- Web radio with an ESP32 and an I2S amplifier
- Getting started with the Raspberry Pi Pico 2 in MicroPython
- Your first amplifier: the LM386 and a speaker
- Talking Arduino: the DFR0760 speech synthesis module
- The spectrum of your music on an LED matrix
- Drawing with 64 LEDs: the 8×8 matrix with the MAX7219
- A real voltage: the 12-bit MCP4725 DAC
- The heartbeat on Arduino: an ECG with the AD8232