LM317 variable power supply
Turn a 12 V adapter into an adjustable 1.25–10 V supply for your experiments.
Shop by category
Shop all componentsA Pi 4 wants 5.1 V at up to 3 A and shows a lightning bolt warning when the voltage sags. Small buck modules sag under that load, but the XL4005 is rated for 5 A with a big inductor and heatsink. Set the output with its trim pot before connecting the Pi, feed it to the GPIO 5 V pins with short thick wires, and run a small script that reports whether the Pi has ever seen under-voltage.
Fuse the 12 V line close to the battery.
Never connect the Pi before setting the voltage.
Tick anything you already have and the total updates.
Follow the colours: red is power, dark grey is ground, blue is a signal.
12 V input (9-32 V accepted). The Pi takes up to 3 A at 5.1 V.
power_check.pyimport subprocess, time
def flags():
out = subprocess.check_output(["vcgencmd", "get_throttled"]).decode()
return int(out.strip().split("=")[1], 16)
while True:
f = flags()
volts = subprocess.check_output(["vcgencmd", "measure_volts", "core"]).decode().strip()
now = "UNDER-VOLTAGE NOW" if f & 0x1 else "OK now"
ever = "has dipped since boot" if f & 0x10000 else "never dipped"
print(f"{now}, {ever}, {volts}")
time.sleep(5)
Raise the output to 5.15 V and use shorter, thicker wires.
It is near its limit; add airflow or keep the load under 4 A.
Check the output really is 5.1 V and the wires go to pins 2 and 6, not 1 (3.3 V).
Yes if the voltage is right, but it skips the Pi's input fuse, so add a fuse on the 12 V side.
Yes; add a fuse and remember car voltage spikes when cranking, which the XL4005 tolerates up to 32 V.
A small 5 V screen, yes, as long as the total stays under about 4 A.
4 parts: XL4005 5A Adjustable Buck Converter, 5-32V, Raspberry Pi 4 Model B 2GB RAM Single Board Computer, Official Raspberry Pi 32GB A2 Class Micro SD Card and DC Power Adapter (5.5x2.1mm). Tools: Digital Multimeter. On this page you can tick the parts you already have and add only the rest to your cart.
It is a beginner project and takes about 1 hour. The build on this page has 6 steps.
No. This page has the complete, tested code (power_check.py).
About ₹7,912 for the parts at the prices on this page, plus tools if you do not have them. Quantity price breaks lower the cost when you build several.
Setting a buck converter output; Why thick short wires matter at high current; Reading the Pi's own under-voltage flag.
Turn a 12 V adapter into an adjustable 1.25–10 V supply for your experiments.
Build your own USB power bank and learn how lithium charging works.
Free power for outdoor sensors: sunlight in, 5 V USB out.
Beeps when the mains goes off at night, so the fridge and the alarm clock do not quietly die.
Lessons are free to read. Maker (₹499/month) and Pro add quizzes, worked problems and certificates, paid with your Geekobot account. See plans
Learning project. Check every circuit and the datasheet of each part before you power it up.