Intro: Ultimate DIY Breadboard Power Supply
For prototyping, nothing beats a breadboard! But how to provide power to the little black and red rails that fuel our designs? There are a couple of conventional options:
A bench/lab variable power supply. A must-have to be sure, but expensive, big and (arguably) overkill for low power circuit design and general hobbyists.
Jumping power from an Arduino.Useful for testing, but it adds to the jumper clutter. Also, it can be useful to save those 5V / 3.3V rails for powering something else, rather than just feeding a breadboard.
Batteries. Nothing kills maker-mojo faster than battery anxiety!
So I decided to design something that could do one job - power any breadboard - and do it really well, with enough options to make it indispensable for small prototyping projects.
Save breadboard space
Removing chunky components like DC jacks, switches and voltage regulators from the breadboard frees up precious space for the actual project, along with fewer messy jumpers and wires.
Be ridiculously cheap
Rock solid power in all the commonly used voltages... but without shelling out for a variable bench power supply.
Having precise, stable voltages within +/- 0.05V means less troubleshooting of power related issues and ensures components are happy and healthy!
Make me want to experiment!
It should be simple, small, laughably easy to use, and let me get straight to melting capacitors and burning out LEDs.
I drew up the schematic for this project and then subsequently stumbled on kernsy's Radioshack, Adjustable Breadboard PSU. This instructable was a big inspiration for me in terms of laying out the protoboard, so consider mine a remix of his excellent work. Credit to kersny - cheers!
Step 1: Regulator... Mount Up! the LM317
Right, so there are only a handful of voltages that I find consistently useful in small applications:
There are a couple of options to achieve these outputs using small, off-the-shelf components. The first one that came to mind was the LM78XX (datasheet), typically in its 5 volt (7805), 9V (7809) and 12V (7812) flavours. You could have a circuitboard lining up a bunch of these, and a switch to direct current through one of them at a time. This would give rock-solid output, but only for a small number of voltage settings and at the cost of massive amounts of real estate. Pfft.
The next option is the venerable LM317 (datasheet). Using only a small number of components this bad boy can output anything from 1.5V - 37V at 1.5A. The chip has 3 terminals - input, output and adjustment. The idea is you feed power to the input, and a regulated (lower) voltage spews forth from the output. You need to feed it with at least 3V more than the amount you're looking to receive - so for 9V output, you've got to give it 12V. This lower voltage is ideally determined using a couple of resistors - one bridging the adjustment and output pins (which typically remains a static value) and another from the adjustment pin to GND.
The LM317 can therefore be used to make a variable power supply if you used a potentiometer as your second resistor, but I want to be able to flick a switch and have a stable, preset output in one of my desired voltages without fiddling with a tiny knob (chuckle).
So, the trick is to work out what resistors are needed in advance, and direct current through them one at a time.
Step 2: You Can't Resistor
Now, there is a highly nerd-approved way of calculating the resistors needed to convince the LM317 to output a given voltage. They supply the following formula in the datasheet:
Vout = 1.25 * ( 1 + R2/R1 )
If you assume that resistor R1 - between the adjustment and output pins - remains constant (the datasheet uses 120Ω and 240Ω) then you can quite easily determine the resistance value for R2 given some mathematical fiddling. Using a value of 240Ω for R1 means the formula for R2 is:
R2 = 240 * (( Vout - 1.25 ) / 1.25 )
So for instance, if we wanted a voltage of 5V we'd need:
R2 = 240Ω * (( 5V - 1.25 ) / 1.25 ) = 720Ω
...you can just head over here for a handy LM317 resistor calculator! Using this, I got the following resistor values needed for my target voltages. In addition, by using multiple resistors in series you can get a value that's more accurate - in my case, I always used 2 resistors for a compromise between accuracy and sexiness on the final protoboard. This awesome tool calculates the best combinations of resistors to match a given value.
- 1.5V: 48Ω using 18Ω and 30Ω (perfect)
- 3V: 336Ω using 36Ω and 300Ω (perfect)
- 3.3V: 394Ω using 3.9Ω and 390Ω (0.025% difference)
- 5V: 720Ω using 100Ω and 620Ω (perfect)
- 6V: 912Ω using 2Ω and 910Ω (perfect)
- 9V: 1488Ω using 390Ω and 1100Ω (0.134% difference)
- 12V: to be passed through (see the schematic and description in the next step)
If you can, and assuming they're not much more expensive, use 1/4W metal film resistors rated at 1% for better accuracy. Fortunately, I have a fairly well stocked local electronics shop that could supply these odd value resistors, but use the resistor calculator to get as close as you can.
Lastly, I went anal retentive big time with regards to accuracy: My electronics shop only sells resistors in packs of 10, so... I tested them. All of them, on a breadboard, hooked up to my LM317 and the 240Ω resistor. I connected a self-powered voltmeter and started swapping resistor pairs in and out until I nailed the desired value to within 0.05V, and then grouped the winners together. Ouch. Definitely optional. (If you do this, make sure to use the same LM317 and 240Ω resistor you used during testing!)
Step 3: Design & Schematic
Okay, so here's the idea:
A simple, pluggable PSU that slots into the power rails at one end of a standard breadboard. Referring on the schematic:
Power source: almost any standard DC power brick ("wall wart") with a barrel jack, providing at least 12V should do the trick. These can be salvaged from old routers, set-top boxes and similar devices.
SW Power: A simple on/off power switch to save me from having to yank out the cable every time.
SW 12V: This switch basically turns the LM317 on or off. Position 1 provides the full 12V (or whatever you're providing) to the breadboard, while position 2 sends the current to the LM317 to be regulated down. This prevents the LM317 from having to regulate down to 12V, which would have meant providing at least 15V.
Dip switch: A 6 position DIP switch is connected between the adjustment pin of the LM317 and GND, each path leading down to my series of preselected resistors to achieve the desired voltage. Position 1 is 1.5V, right up to 9V at position 6.
Vcc OUT: Each of these outputs (left & right) refer to the breadboard rails we're supplying power and GND to.
SW Dual Output: This switch toggles between only the left rail on the breadboard receiving power, or both the left and right. This saves on jumper mess, while also making it super quick and simple if both sides of the board need juice.
LEDs: These LEDs indicate which rails are receiving power. Also, they dim/brighten depending on which output voltage is selected - the full 12V passthrough makes them the brightest, while the 1.5V gives them barely enough food for a dim illumination. This is a small visual clue as to which output voltage has been selected, while also an indication that the PSU is actually on.
Capacitors: Lastly, three smoothing capacitors help keep a nice, stable output voltage.
Step 4: Parts List
Check out the images for more detail, but the parts we'll need are:
☐ A minimum 12V DC power brick/wall wart with a DC barrel jack.
☐ A cheap, standard size 26 x 19 hole protoboard. Single sided is perfect.
☐ A DC barrel jack to match the one on your power brick (5.5mm is typical)
☐ The LM317T voltage regulator
[Optional] ☐ Heatsink (with mica, top-hat, bolt and nut, and thermal paste if you're feeling anxious)
[Optional] ☐ Diode (14N00X) - entirely optional, can be placed just after the power input to help prevent house fires. I left it out :)
☐ 3 x smoothing capacitors: 100uf, 10uf and 1uf.
☐ Switch: on/off (SPST)
☐ Switch: SPDT, 3 pin
☐ Switch: DPDT, 6 pin
☐ 6 position DIP switch
☐ 2 x 2-pin male SIL headers
☐ Resistor: 240Ω (for "R1")
☐ Resistors: each of the calculated resistor pairs (for "R2"). If you're using my design, you'll need:
2 ... 3.9 ...18 ... 30 ... 36 ... 100 ... 300 ... 2 x 390 ... 620 ... 910 ... 1100
☐ Resistors: 2 x 360Ω (for the LEDs)
☐ 2 x 3mm LEDs
☐ 4 screws and standoffs
Total cost for all the components was R92.72 (South African Rand). This is about +/- $6 USD. Aww yeah.
Step 5: Board Layout & Preparation
I fired up the ole' Inkscape, mapped out my board and placed each component to make sure I'd have enough space to lay them all out. My layout in the image above, and assuming you're using the same components as me, is hole-perfect.
1. I highly recommend doing a "dry fit", adding each component to the board before soldering to double check you have enough room. I wanted this to be as compact as possible, so you may have better luck starting with a bigger board. The standard 26 x 19 hole board is literally just enough space. Use some helping hands to make this easier - those component leads can get fussy.
2. The DC barrel jack has oversized tabs instead of pins, so there is some drilling to do: Mark the holes that need expanding and drill them large enough to fit the jack. While you're at it, drill the mounting holes larger as well, and space for the heatsink screw if you're using one.
3. Speaking of the heatsink, apply a thin layer of thermal compound to both sides of the mica. Then line it up on the heatsink, add the LM317, and secure with a top-hat, bolt and nut. The LM317 can be mounted vertically or placed flat - I preferred to lay it flat to minimise the vertical height of the final board, which meant bending the pins 90 degrees down.
Step 6: Solder Time!
Starting with the smallest components (the resistors, diode, capacitors) and working your way up to the biggest (switches, IC, DC jack) and start soldering it together!
1. Another source of inspiration from kersny's post was the use of masking tape to hold the smaller components in place before flipping and soldering. Again, a good set of helping hands works like a charm here - attach components, secure, flip, solder. Repeat, repeat, repeat!
2. After each batch of components, do yourself a favour and use a multimeter to perform some continuity tests on your joins, just to make 100% sure you don't have any cold solders.
3. Don't be too quick to trim the component leads - keep them around to make interconnecting easier. I try to avoid making solder-bridges where possible, preferring to use the leads themselves. For larger bridges, I used colour coded solid core wire ("scooby doo wire") to keep things visually distinguishable.
Step 7: The Completed Board
Step 8: Testing - Mounting to a Breadboard!
The two sets of pins simply slot into the first row of power rails on either side of the board. When the DC jack is plugged in, the LEDs indicate which side of the board has power. Easy!
Step 9: Testing All the Options
1. Flipping the dual-rail switch provides power to the other rail on the breadboard.
2. With the 12V passthrough switch enabled, we get the full 12V DC fed through.
3. Disabling the 12V passthrough switch means we're feeding the LM317. Together with varying positions on the DIP switches, we get some rock-solid DC voltages on the breadboard. Simple!