Compass Rose logo for the Compass DeRose guidesThe Compass DeRose Guide to Building a Universal Power Supply

This page was written by Steven J. DeRose around 2003-04-04, and was last updated on 2003-05-13.

This page describes how to use adjustable voltage regulators to get any voltage you want, from any voltage you have (within limits). This is the basic key to building a power supply that can be reset for many different ideas.



The key to a universal power supply (other than Targus' patented method) is to use voltage regulator chips. They take in any voltage within a fairly wide range, and put out a precise chosen voltage at the other end.

Voltage regulators come in two types: Fixed ones are available for a variety of pre-set voltages; adjustable ones let you set what voltage you want out, usually by attaching a couple of resistors. Voltage regulators are cheap (about $2 for an adjustable one ("LM317") at Radio Shack that can handle up to 1.5 Amps), as are resistors (about $0.20). Low-voltage ones can typically handle up to a 40-volt difference between input and output.

My parts list for the project is here.

Start with a little box and install an adjustable voltage-regulator chip . The LM317 is adjustable to provide from 1.25 to 37 volts. The package says it can go down to 1.2, but according to their formula that would require a -9 ohm resistor -- if you find one of those, please let me know. With the voltage regulator to take care of most of the job, you only need 3 more basic things:

  1. a way to get power in
  2. a way to get power out
  3. a way to set the voltage as needed

In addition, there are a few features that are nice to add, that I won't explain because if you're thinking of building this yourself you probably can figure them out easily enough anyway:

Getting power in to your supply

Provide "power in" cords or sockets to get power from whatever sources you think would be handy, such as:

Note: Real Goods offers various 12V-powerable and other cool low-power devices -- I especially like the LED flashlight you recharge by shaking.

You could put a Radio Shack Adaptaplug on the power-in side of your box, so you could get to just about anything, but there are two problems: (a) their selection of female tips is weak; and (b) it increases the chance of confusing the power-in and power-out ends of your box. I think it's better to either:

Getting power out from your supply

Your best bet here is to provide 2 output sockets: one that can take a Targus PowerTip cord so you can use the tips they make for lots of laptops and cell phones (the voltage-setting pins will just be ignored); and one that can take Radio Shack Adaptaplugs, which will cover most everything else. The Targus connection is useful because some of the device plugs are hard to find, though check out these sources:

Remember that if you can't readily find a connector, you probably can find a cord and cut it in half. That way the connector is already wired, too.

Setting the voltage on your supply

With an adjustable voltage regulator you need to swap in different resisters to get the voltage you want.

A typical adjustable voltage regulator lets you attach 2 external resistors, and uses the ratio between those to determine what voltage it will generate. The LM317 package shows the typical circuit on the back. What it doesn't tell you clearly is:

The typical information provided with the voltage regulator is how to calculate the voltage out, given the 2 resistors:

Vout = 1.25 * ( 1 + r2/r1 )

What you probably need is the opposite: to calculate the R2 value to use to get a given Vout. To do that the formula is:

r2 = ((Vout/1.25) - 1) * r1

R1 is shown on the package as typically 240 ohms (a hard-to-obtain value compared to, say, 220 ohms). But given r1=220 ohms, here are the r2 values for a variety of output voltages:

Resistor table for LM317 adjustable voltage regulator

Voltage out r2 w/
r1 = 240ohms
r2 w/
r1 = 220ohms
1.25 0.0 0.0
1.5 48 44
2.5 240.0 220.0
3 336.0 308.0
4.5 624.0 572.0
5 720.0 660.0
6 912.0 836.0
7.2 1142.4 1047.2
7.5 1200.0 1100.0
9 1488.0 1364.0
10 1680.0 1540.0
12 2064.0 1892.0
14 2448.0 2244.0
14.4 2524.8 2314.4
16 2832.0 2596.0
20 3600.0 3300.0
24 4368.0 4004.0
28 5136.0 4708.0
32 5904.0 5412.0
36 6672.0 6116.0
40 7440.0 6820.0
44 8208.0 7524
48 8976.0 8228.0

This table was generated by a small Ruby program, available here.

Few of these exact values are commonly available resistors, though some are close. To adjust, you can combine resistors: resistors in series (end to end) simply add their values; resitors connected in parallel (side-by-side) yield the value (R1*R2)/(R1+R2) -- which for two equal resistors amonts to cutting the value in half.

Resistors are commonly available in only a few mantissa values, but with any number of zeroes following. For example, you can get 47 ohm, 470, 4700, etc. Selection may vary by power rating -- for this application very little power capacity is needed, so most any ratings will do. The common mantissa values ("?" indicates less common) are: 1, 12?, 15?, 18? 22, 27? 33, 39?, 47, 51?, 56, 68, 82?

You can purchase sets of resistors packed up in a small "DIP" chip, for example from Mouser Electronics.

You can also buy miniature trim potentiometers (about $1.50) instead, and adjust them with a voltmeter connected to get you the right voltage. You could use 5K trim pots, but it's better to use fixed resistors to get close to the desired value and use a small trim pot for the fine adjustment at the end -- that makes it easier to be precise. For example, a given amount of rotation on a 1K pot changes the value by only 1/5 as much as it would on a 5K pot.

Switching in the right resistor

To make a flexible power supply, you need some way to switch in the right resistor for the voltage you want. There are many ways to do this, described here. the most obvious are to have a separate socket for each voltage, or a selector switch. But there are other options.

I've got to have more power, Scotty!

The LM317 only provides up to 1.5 Amp. At 12 volts that would be 1A * 12V = 18 watts; less that what a modern laptop uses, though plenty for a portable CD or radio, for recharging lots of things, and so on.

Similar voltage regulators exist that can handle tens of amps. For example, NTE Electronics has a listK of models ranging up to 5 Amps (and precision ones down to +/- 0.01% on the output voltage). They also carry a huge selection of other parts and equipment -- even "Jovial Fault Finders" (I thought fault finding was usually offered as a free service...).

If you only want a single certain voltage (probably 12 or whatever your current laptop takes), you can use non-adjustable voltage regulators and skip the resistors. If you only want a few voltages, you can use a few fixed or hard-wired adjustable voltage regulators, each wired to a separate output socket or tip.


Some interesting related sites:


Back to home page of Steve DeRose or The Bible Technologies Group. or The Bible Technologies Group Working Groups. Or, contact me via email (fix the punctuation).