Pocket-Size Power Supply




About: My name is Jason Poel Smith. In my free time, I am an Inventor, Maker, Hacker, Tinker, and all around Mad Genius

I am a big fan of garage sales, flea markets, and thrift stores. They are great places to find used parts and materials for your next project. But one problem that I often run into is not being able to test battery powered electronics to see if they work. Because there are so many different combinations of batteries that are used in portable electronics, it isn't really practical to carry around batteries for testing. One device may need 6 AA's and another may require 4 D's. So I came up with this simple pocket-sized variable power supply. It can plug into either a 9V battery or a 12V battery pack. You can then adjust the output voltage to match the device that you want to test and attach the output wires to the end terminals on the device's battery connectors. This lets you power the device long enough to see if it works.

Step 1: Materials

LM317 Adjustable Voltage Regulator
0.1 µF Capacitor
1 µF Capacitor
220 ohm Resistor
7 x 270 ohm Resistor (preferably 1/8 watt)
8-Position DIP Switch
Perf Board
9V Battery Connector
2 x Alligator Clip Wires

Note: All these parts are available at Radio Shack. I highly recommend using 1/8 watt resistor because they take up less space on the board which makes it easier to fit everything into a smaller space. Unfortunately I only had five 1/8 watt resistor so, I had to use two 1/4 watt resistors.

Step 2: The Circuit

The standard LM317 regulator circuit uses two resistors to set the output voltage according to this formula:

Vout = 1.25V x (1 + (R2/R1)) + (Iadj x R2).

Since Iadj is small (about 0.1 mA), the formula can be simplified to Vout = 1.25V x (1 + (R2/R1)) as long as R1 is also relatively small. Because of this, R1 is generally kept to about 240 ohms (you can substitute a 220 ohm resistor). R2 is then selected to get the desired output voltage. Often a a variable resistor is used for R2 to make the circuit adjustable. 

The circuit for this project has one major modification to it. The variable resistor R2 is replaced by an array of resistors and switches. This allows the output to be adjusted in discrete increments. I did this to more easily simulate individual batteries. Each switch effectively represents a battery being connected or disconnected.

Turing on switch 1 turns on the circuit and brings the output up to 1.25V. Then with switches 2 through 8, turning the switches off in order will each increase the output voltage by about 1.53 volts. 

Example: Initially switch 1 is off and switches 2 through 8 are on. Turning on switch 1 gives an output of 1.25V. Then turning off switch 2 gives an output of 2.80V. Then turning off switch 3 gives an output of 4.33 and so on.

The circuit can use either a 9V battery or a 12V battery pack as a supply voltage. The output will max out at about 1.5V below the supply voltage (7.5V for a 9V battery or 10.5 for a 12V battery pack.) But this isn't a problem because if you need the full supply voltage of the battery, then you can just hook the battery up to the circuit directly. 

Step 3: Solder the Circuit Together

After testing the circuit on a breadboard, I soldered the circuit together on a small perf board. You can either follow my layout or make your own.

Step 4: Finished Circuit

Now you have a miniature power supply. Wrap the wires and the battery connector around the circuit board and it will easily fit in your pocket. To use it, connect the battery, dial in the desired voltage and attach the alligator clips to the battery terminals on the device. This should let you power it long enough to test it to see if it works properly.

Battery Powered Contest

Finalist in the
Battery Powered Contest

Kit Contest

Participated in the
Kit Contest

5 People Made This Project!


  • Paint Challenge

    Paint Challenge
  • Sensors Contest

    Sensors Contest
  • DIY Summer Camp Contest

    DIY Summer Camp Contest

91 Discussions


5 years ago

Im currently working on a breadboard version would you like a pic when finished?

3 replies

Reply 4 years ago

Did you ever happen to complete the breadboard setup?


2 years ago

Question: Say the output is set for 1.5v, will it be converting the execs voltage form the battery
into heat? In simple terms, what is the efficiency of this neat little

(I'm 99% sure I know the answer) Its not a high-efficient buck converter; but Jason's idea has elegance is in its size and simplicity!

This is a great project! Thanks for sharing this Jason. :)
2 replies

Yeah. Any time there is a voltage drop, the energy is converted to heat. So the more you reduce the voltage, the less efficient the system is.


2 years ago

I've been meaning to make something similar to this for a very long
time, for exactly the same reason. I like your DIP switch idea. Awesome!


2 years ago

Awesome! Why didn't I think of that?

Well, strictly speaking the capacitors aren't really necessary because the power source is a battery (DC). It is only necessary for really sensitive circuits that need a very steady power supply. But if you want to use a capacitor, then any value that is bigger than 1 micofarad will work just as well.


4 years ago

hi i am a student and i need power supply for my tons of projects,
sir i want to ask u can i use a 12 v power supply, then what specifications do i need so that this project run smoothly,
do i have to increase number of 270 ohm resistor or increase my capacitance,i hope you would guide me....

1 reply

You can use any voltage supply up to the voltage regulators max rated limit. So yes you can use a 12 volt battery or a 12 volt supply without changing anything. However you need to keep in mind that the maximum output will be slightly lower than the supply voltage as the regulator chip drops the voltage a little.


Im only able to source stripboard, does this make the build more complicated or would it be the same please?

1 reply

It might be a little more difficult to get all the connections right. You may need to use a knife to cut some of the etched lines to make it easier.

Hi there, I came across this project and thought that it would be perfect for a complete noob. After purchasing some parts and discussing it in my local electronic parts supplier, I came upon a problem where I couldn't Identify what types of capacitors you used, please could you list the types too for total novices?

1 reply

4 years ago on Introduction

Could you do this with a 4 switch DIP because this is what I have???