Welcome to my first instructable. I hope it will make sense.
Electronic circuits tend to have a lot of things in common. It's rare to see a circuit without resistors, for example. However, there is only one thing that ALL circuits share - the power source. Power supplies have become one of my favorite and most common projects. When I was first studying electronics, I needed to test a circuit that seemed to be malfunctioning. I had to build a power supply to do so. Since then, I've needed to build or tweak so many power supplies that I consider them the most practical and useful type of circuit to learn.
Today we're dealing with "Wall Warts." They are those big black bricks that, when you plug them in, tend to cover one or even two neighboring empty sockets. Note that in some cases, the big black brick doesn't plug into the wall itself, but has a cord that plugs into the wall. For simplicity, I will call these wall warts as well. Starting with a wall wart will greatly simplify the project. It also prevents you from having to deal with higher household voltage, so it's a much safer circuit to tackle until you know how NOT to get electrocuted.
Regardless of voltage levels, HEED THIS LENGTHY DISCLAIMER!!! ...
Any discussion about power is incomplete without a cover-my-ass disclaimer. Some of these circuits are very tame, while some involve dealing with the voltage that magically comes from the walls of your home, and can kill you (not so magically). Treat ALL circuits with a high regard to the God of Power. Always assume danger. Even low voltage projects can be fatal. Amperage is the real danger. A mere 10mA (mA = milliamps or 1/1000 of 1 amp) can provide you with parting gifts of severe shock and breathing difficulty. At 100mA, your prize is more likely to be a formal gathering of your family and friends, better known as 'Your Funeral.' As a point of reference, household circuits range from 15 to 20 AMPS (note: that's 15 THOUSAND mA!!).
PARTS: These will vary depending on how you tackle the circuit, so I will discuss them inline with the text and summarize them at the end.
Step 1: Acquring and Testing the Wall Wart.
As stated, starting with a wall wart will simplify any power supply build because some of the work is done for you. The type of power supply we're working on (called "Linear") has a few tasks to perform before providing us with a usable current. First, the 110 volts of AC from your home outlet goes through a transformer to step the voltage down to a level more common in electronic circuits (usually between 5 to 12 volts). Next this lower AC voltage is then "rectified" by a series of diodes arranged as a "Bridge Rectifier" in to a DC voltage. Finally, a capacitor is used as a filter to smooth out most of the remaining AC pulses (know as "ripple"). These tasks are all done by the wall wart and you didn't need to break a sweat.
To get started, we need to find/test a wall wart. As electronics become obsolete or die, many perfectly good power supplies are left behind. How many old cell phone chargers do you own?
FIND IT: Round up all of the warts you can find and check their markings. You're looking for it's OUTPUT. We want a DC voltage, so make sure the voltage reads VDC (volts DC) not VAC (volts AC). You'll likely see lots of 9 volts, plenty of 5 volts, and a handful of 12 volts. You may see 6 volts, or even 4.5 if you've ever owned a Sony discman. Pick the one that's closest to your intended voltage. 5 volts is ok for a lot of projects, 9 will give you more flexibility. If you want to build a variable power supply (more on that later) 12 volts is a better option. The amperage rating isn't as critical. Pick the highest amperage you have and you'll be fine. My smallest is 300mA, and the only time that didn't work was when I tried to use it to power a digital camera.
TEST IT: The wart will have a plug on the end that you likely don't need. Go ahead and clip it off, but leave a few inches on it in case you want to solder it somewhere else later, or in case you realize you just destroyed the charger to something you actually use! Attach the newly exposed leads to your multimeter. The negative lead will usually have a white stripe or a raised ridge along it. Be sure the leads aren't touching each other and plug in the wall wart. You'll notice the reading is probably higher than the output rating. These wall warts are generally unregulated. Don't worry about it. Just take note of the output. If you're voltage reads negative, swap your leads around, and then tape or otherwise mark your leads for future identification.
Step 2: Regulating Your Voltage.
Our next step involves the Voltage Regulator. This is a small integrated circuit (called a "chip") that will hold our wall wart voltage stable at a level we decide upon, and also provide some circuit protection. This is where the road forks in two directions - fixed voltage and variable voltage.
FIXED VOLTAGE (AKA "The Ronin Wart"): This is a WAY simple circuit. the 78XX series of chips are fixed voltage regulators. The 7805 and 7812 (5V and 12V) are most common, and readily available at your local Radioshack (though it will cost more than ordering it online). You can also get a 9 Volt 7809. I call this the "Ronin Wart" after the term for a samurai who's master has died. Give your poor wandering warts a new purpose. We will build this in the next step.
VARIABLE VOLTAGE (AKA "The Franken-Wart"): It requires more components and "frankensteining" to build this circuit (which is why I call it the Franken-Wart), but it is worth it for it's versatility. It is based on the LM317 variable regulator and a potentiometer to vary the voltage. We'll look at this in step 4.
Step 3: Fixed Voltage Regulators
Check the documentation that came with the chip you use to verify the pin-outs. Similar chips typically share pin-outs, but never assume.
On my chip, pin one is the input, pin 2 is the output, and pin 3 is the ground. Note that pin 3 is between pins 1 and 2. The left to right sequence is 1,3,2 (not 1,2,3). I have seen 1,2,3 configurations with 2 as ground and 3 as output by some manufacturers. It's really only the numbers that change, the ground is still in the center, and output is still the rightmost pin, but get in the habit of knowing your chip before applying power.
Run your bare wall wart wires to the binding posts on a solderless breadboard, and then wires from the posts to the breadboard tie-points inline with the input and ground on the chip. Next run jumper wires from the output pin to the power rail, and from the ground pin to the ground rail (see the photo). That's it! You now have a regulated voltage.
Add your 78XX chip to an otherwise finished circuit. I once cracked open a wall wart and installed one right inside. It worked great and continues to work to this day despite having been powering a small video camera 24/7 since 2003. Of course, I drilled holes in the wall wart case for ventilation. Still, I don't really recommend this "in-wart" approach. Wall warts are a pain to open, and these chips can get quite hot in the right circumstances.
Step 4: Variable Voltages
This circuit requires a few parts. R1 is listed as a 240 ohm resistor, which I never seem to have. Anything close to that will do, but I recommend higher rather than lower (I use 260-270 ohms). I'm told smaller resistors will cause the chip to draw more current.
R2 is listed as a 5k potentiometer. I frequently to use 10k without issue. I like multi-turn pots. Rather than one full rotation, these pots can have 10-15 turns. That enables you to really fine tune your voltage.
The capacitor values listed are very common. Note that in the schematic, C1 is NOT polarized, but C2 IS. Polarized capacitors have a positive and negative terminal and must be connected in the correct orientation. Electrolytic capacitors (the ones in the metal cans that resemble batteries) are polarized. They will have a minus sign printed on them to indicate the negative terminal.
IMPORTANT NOTE! DANGER!! C2 will have a voltage rating printed on it. This is the MAXIMUM it can withstand before failing violently. Make sure the voltage rating for C2 is HIGHER than the voltage you measured on your wall wart in step 1. When capacitors fail, a rubber plug blows out of one end (potentially becoming a projectile) and small amount of hot electrolyte goo will spray out.
Step 5: Summary - Parts Info & Tools
These circuits are worth memorizing. You will use them over and over again. A 7805 can quickly become an emergency cell phone charger. The 317 variable circuit can supply power to just about any circuit you can dream up.
Breadboard (optional - if you want to play with the chip without soldering)
1 salvaged wall wart
1 78XX or LM317 chip depending on your circuit choice
Heat sink &Thermal Paste (see note below)
For the variable circuit:
1 resistor (around 240-300 ohms)
1 electrolytic capacitor (1uf and a voltage rating higher than your wall warts output)
1 ceramic capacitor (0.1uf)
1 potentiometer (5k - 10k)
1 small PC board/prototype board to solder everything into
1 Enclosure to house and protect the circuit and yourself.
HEAT SINK NOTE: I don't frequently use them and have had no problem, but I certainly always recommend them - especially if your circuit will run for long periods of time and/or go unattended. The chips have a metal flap with a hole in them to attach a heat sink. Thermal paste will aid in heat transfer.
Where to get parts:
These days, I tend to order from Digikey.com, and I'm not ashamed to say that I frequent Radioshack.
Digikey has an excellent part search system that lets you sequentially filter your results down until you find what you want, they have a HUGE selection, and they allow small quantities.
Radioshack has a bad rap. It's true that you'll pay more for stuff there (in some cases quite a bit more). When you just need to pick up a couple LED's and a switch, radioshack can be a life saver. It's near impossible to find this stuff anywhere else.
In part two I will take the wall wart out of the equation, and we'll build the whole thing from scratch.