For about $5-$10 you can have your own adjustable power supply to power various electronics!
Step 1: The 3 "main" Parts You Will Need
1 - LM317 (I used LM338, however any adjustable regulator with "LM" in it should work fine)
1 - 5k ohm variable resistor (potentiometer)
1 - 220-240 ohm resistor
Step 2: Identify the Pin Order on Your Regulator
LM adjustable regulators should have 3 total pins, one for voltage in, voltage out (ground in), and adjust.
From left to right they should be voltage in, adjust, and voltage out (ground in).
Or you can look at the picture, pin 1: voltage in, pin 2: adjust, pin 3: voltage out (ground in)
Notice that pin 3 is both your voltage output for ground and input for ground.
Step 3: 220-240 Ohm Resistor
Now we have to solder the resistor to the regulator's pin 1 and 2.
This step should be easy since there is no difference on which side you solder the resistor (any side will work).
Step 4: Add in the Variable Resistor (potentiometer)
Now we have to add in our 5k ohm variable resistor (allows us to adjust voltage accordingly)
Solder the variable resistor to pin 1 of the regulator
The other end of the variable resistor will be now be our new "voltage in". So we would connect the main power source to that pin on the variable resistor.
Do not get confused with pin 1 and the pin on the variable resistor, if you give power to pin 1 on the regulator you will not be able to adjust your voltage output.
Step 5: You're Done!
Now you can solder two wires onto the regulator so you can connect it to a power supply (24v max), you will then be able to adjust it from about 1.2v~23v.
Please keep in mind that this is just the bare basics of making an adjustable power supply. Most diagrams would include capacitors in their design to help smooth out voltage fluctuations, although they are not completely necessary, they will help with more consistent voltage output.
If you feel comfortable with adding capacitors to the design, all you have to do is connect the capacitors in parallel with the voltage in (+) and voltage out (-) of the regulator. Make sure that the capacitor is rated for at least 25v or higher, any lower and it may explode/leak.
You may want to double check your voltage output to make sure that it is working before trying it on different devices.
You may also need to attach a heatsink to the voltage regulator if you are going to be running heavy loads, as it does get quite hot under those conditions.
Lastly, after you have done all the correct connections and verified that it is working properly, you may put it in a case so everything is protected.