# LM78XX voltage regulators

I am building a cheap bench top power supply for my bread board prototypes using a LM7805.

I want to know based on the above diagram could I just change in a LM7812? I would like to be able to flick a switch to change between voltages if so. Could the switch just change the input switch or would I need to remove all three connections?

You can place the switch on the input of the regulator, and duplicate the regulator and the components after it.
A few remarks, though. The input says < 24V AC/DC. I presume this comes from a transformer, so it will be up to 24V AC. Rectified that will be $24V \times \sqrt{2} - 2V = 32V$ . That's a lot, and especially the LM7805 will get hot: it would have to dissipate 27W at 1A, that won't do! Choose a transformer in function of the 12V. It will need 15V at the input, so that's 12V AC minimum. Especially the 7805 will still need cooling.
Then 25V for the input electrolytic capacitor is also OK (it wouldn't be for 24V AC!).

All this said, there are much nicer solutions. The LM317 is also a three-legger but has a variable output voltage, so if you use a potmeter you can vary the output voltage continuously. If you want you can still use a switch to get 5V or 12V directly: so, a switch 5V-12V-variable.

edit (some refinements)
First the input capacitor. For a 1A supply (a minimum value for a bench top supply) the 470$\mu$F won't do. My rule-of-thumb is 2000$\mu$F/A, so use a 2200$\mu$F type. You also want a smaller cap parallel to it to suppress glitches (the 2200$\mu$F is not good at this). I would place a 1$\mu$F ceramic there.
You mention this application example in your comment:

The capacitor gives a better ripple rejection. Ripple is the variation which remains after the rectified voltage has been smoothed out by the capacitor:

edit2 (putting on my product manager's hat)
Especially when you're working with microcontrollers you'll want to have a fixed power supply available for that at any time, apart from the adjustable. Most microcontrollers work at 3.3V or 5V. Probably best thing would be to feed two regulators parallel from the input capacitor: one which can switch between 3.3V and 5V, and one adjustable through a potmeter. The adjustable can then be used for peripherals like small motors and relays.

• I will have a look at the LM317 Jul 16, 2011 at 7:27
• @Ashley - let us know if you need help with the switch. I'm not sure I explained clearly. Jul 16, 2011 at 7:32
• Looks like the way to go, just wondering the circuit diagram on the 1st page with the pot replaced with a switch with 2 fixed resistors or build with ripple protection on page 16 as i have some spare 1N4004's lying around? ripple protection = cleaner power? Jul 16, 2011 at 8:09
• @Ashley - Yes, the switch with 2 fixed resistors, but while you're at it, why not a three -position switch with the pot at the third position? Ripple rejection = cleaner power. The ripple comes from the AC input (BTW, use a 2200$\mu$F cap on the input!). And a Schottky diode instead of the 1N4002 in the schematic would be better, but a 1N4004 will also work. Success! Jul 16, 2011 at 8:15
• If you're interested I have written a little LM317T resistor calculator here: electronics.sqsol.co.uk/calculators/lm317t Jul 16, 2011 at 11:45

You can make a variable output voltage regulator using a 7805:

This Circuit is taken from this datasheet.

• Like it says this circuit won't go all the way down to 5V. That's because the 741's output doesn't go all to the rails. An RRIO (Rail-to-Rail I/O) opamp will solve this, but even then 5V will be the lower limit. Jul 16, 2011 at 9:32
• 1. Use an LM324 or LM358 opamp instead of an LM741. (Very very naughty of Fairchild. The data sheet claims to be 2010 but that circuit was drawn decades ago and an LM741 is a very poor choice. The LM741 needs dual positive and negative power supplies. A negative supply is not directly available here. An LM324 / LM358 is "single supply". Ground V- and use Vinput as V+ for op amp). ........... 2. Change the LM7805 to an LM317 and the circuit will go down to about 1.25 Volt ........... 3. Larger capacitors may be useful. See LM317 data sheet for examples. Jul 16, 2011 at 9:47
• @Russell yeah looking at it again it is a bad design. I did this while half asleep this morning so didn't pay too much attention to it.
– Dean
Jul 16, 2011 at 9:58
• @Russell - yes, an LM324 will work on a single supply, but still isn't rail-to-rail out, so no 5V. I agree with the LM317 (which my answer is based upon). Jul 16, 2011 at 9:59
• 1. Design is OKish - just that op amp shown is very old and is dual supply. 2. Yes - LM324 is not rail to rail but will go extremely close to ground on low side. Maybe add a modest pull down at output as wasting a little power is not going to matter here. You can probably get within a few 10's of mV of ground so Vout would be say >= 5.05V with a 5V regulator and >= 1.3 V with an LM317. Jul 16, 2011 at 10:53

You could put a switch at the output, where you have a switch in the diagram, and connect the inputs in parallel.

I would choose a lower input voltage, otherwise a lot of heat is generated in the voltage regulators and you will need a lot of cooling to get 1A output current.

Note that DC after rectification will be approximately 1.4 times higher than the rated AC voltage, so 25V is not enough for your capacitor.