Voltage Regulator
Using LM2596 Voltage Regulator with Raspberry Pi
What is the LM2596?
LM2596 practical reference
An adjustable buck (step-down) converter module used to efficiently drop higher battery voltages down to a project's logic-level supply. Built around the LM2596 switching regulator IC, it converts a higher input voltage down to a lower, adjustable output set by an onboard trimmer potentiometer, with far less wasted heat than a linear regulator — the standard choice for powering 5V or 3.3V electronics from a 9V, 12V, or higher battery/adapter source in DIY projects.
Key specifications
- Converter type: LM2596 adjustable DC-DC buck (step-down) converter
- Input voltage: 4.5V–40V DC (practical range; must exceed the desired output plus ~1.5V dropout)
- Output voltage: Adjustable from ~1.25V to ~35V DC via onboard trimmer potentiometer
- Output current: Up to ~3A typical (with adequate heatsinking/cooling at higher loads)
- Switching frequency: ~150 kHz
- Efficiency: Up to ~92% typical, much cooler-running than a linear regulator dropping the same voltage difference
- Adjustment: Onboard trimmer potentiometer sets output voltage — measure with a multimeter under no/light load while adjusting
Pinout and connection notes
As with other adjustable regulator boards, set the output voltage using the onboard trimmer potentiometer and a multimeter before connecting sensitive electronics — these modules ship at an arbitrary factory-set voltage. Input voltage must be at least ~1.5V higher than the desired output for the regulator to maintain regulation; if the input voltage is already lower than what you need, use a boost converter like the MT3608 instead, since buck converters cannot step voltage up.
- IN+: Positive voltage input from battery/power source
- IN-: Negative input / ground
- OUT+: Positive regulated stepped-down output
- OUT-: Negative output / ground (shared with IN-)
Integration checklist
- Confirm the exact part number and breakout-board revision.
- Verify supply voltage, current demand, logic levels, and signal direction against the datasheet.
- Check controller pin assignments and bus address or interface mode against the example code.
- Power up with external loads disconnected, then test signals before full integration.
- If readings or communication fail, check power and ground first, then pin mapping, interface settings, and library initialization.
Troubleshooting and reproducibility
Record the board used, wiring, library/version, supply arrangement, and measured behavior. Use the selected board-specific wiring example as the source of truth. Never assume visually similar modules share identical voltage tolerance or pin order.
Setting Up LM2596 with Raspberry Pi
Library
Adafruit-MCP3008 by Adafruit
pip3 install adafruit-circuitpython-mcp3xxx
Wiring
| Component pin | Raspberry Pi pin | Note |
|---|---|---|
| IN+ / IN- | Higher-voltage source (e.g. 12V adapter, multi-cell pack) | Not connected to the Pi |
| OUT+ | 5V pin | Trim to ~5.0-5.2V under the Pi's actual load before connecting |
| OUT- | GND |
Swipe sideways to see every column →
- Same efficiency reasoning as the other boards: an LM2596 trimmed to a clean 5V into the Pi's 5V pin beats a marginal voltage drop through a long or thin USB cable, especially under a Pi 4/5's peak current draw.
- Same calibrate-then-connect workflow, and same MCP3008 requirement for monitoring since the Pi has no analog input.
- Undervoltage is one of the most common causes of Pi instability — a clean, steady 5V like this is one of the more reliable fixes if your existing power path is marginal.
Related Components
18650 Holder
Single-cell 18650 holder for portable project power.
AMS1117 33
Fixed 3.3V linear regulator for powering logic-level components.
MT3608
Adjustable step-up converter for boosting low battery voltages to component requirements.
TP4056
Single-cell Li-ion charging module with protection — the standard for USB-powered lithium charging.
Related Guides & Projects
Raspberry Pi Pico W and Pico 2 W: Install MicroPython with Thonny or UF2
Hold BOOTSEL, drag the correct UF2 file, open the REPL and blink the onboard LED. Includes the Pico vs Pico W vs Pico 2 W firmware differences and what to do when the drive does not appear.
Raspberry Pi Pico W Web Server in MicroPython: Control an LED and Read a Sensor
Connect the Pico W to WiFi, serve a responsive control page, switch an LED and display the onboard temperature or an external sensor, with timeouts and reconnect handling.
Raspberry Pi Pico Oscilloscope with MicroPython
Convert a Raspberry Pi Pico into a basic 500 kSPS oscilloscope using its 12-bit ADC and MicroPython. Displays waveforms on an SSD1306 OLED or streams samples over USB serial to a Python plotter on your PC.
Self-Hosted Nextcloud NAS on Raspberry Pi 4
Build a private, durable Nextcloud NAS on a Raspberry Pi 4 -- SSD boot instead of a failure-prone SD card, Docker Compose with Redis caching, Tailscale for remote access with zero ports forwarded, and an automated backup strategy that actually runs.