First, Gar's absolutely right, if you're expecting to pull more than a few milliamps out of your regulator, you're going to dealing with power dissipation issues.
Linear regulators do what they do by acting like a variable resistor between the supply and load. They essentially "burn off" the excess voltage, dissipating it as heat.
In your case, your power supply is 7 times the voltage of your load. That means for every 1 watt the regulator delivers as 200 mA of current into the load, it needs to throw away 6 more watts as waste heat.
In an ideal world you would probably be much better served by using a small transformer, bridge, and cap to make a bulk DC supply closer to 16 volts (for a 12 volt regulator) or 9 volts (for a 5 volt regulator). That would give you two volts of ripple before you needed to worry about drop-out.
In a system that uses a lot of 5V but only a little 12V, you might want to feed 16 volts raw DC into the 12 volt part, then take the 12 volt output and feed it to the 5 volt part, thus spreading the dissipation.
Alternately, instead of a linear supply, you might want to look into the excellent series of small switchers. Many of them are just as easy to use as the LM78/79 series, but since they run at 70% efficiency they deliver amp-sized outputs with MUCH less heat.
I design a lot of equipment that runs off 24 volt busses, and I use the PT78ST105H, 5V regulator form TI a lot. Yes, it's $14, versus a .65 cent 7805, but I don't have to cool it.
But back to your original question, resistors are a bad choice for dropping voltage, since when your load goes to zero, the dropping effect goes away, and you can damage voltage-sensitive components.
They are, however, really useful for dissipating *power*. Imagine the situation where you have a 7805 delivering 1A at 5V from an 12V source.
The '05 is dissapating 7 watts, a lot for a TO220 case. Insert a judiciously chosen dropping resistor, say 5 ohms, before the regulator, now the *resistor* is taking the beating, dissipating 5 watts, and delivering 7 volts to the regulator, which now only has to dissipate 2 watts.
You do have to worry about peak load (or you can get into dropout problems) but for stable loads, this technique can be a lifesaver. When the load goes away, btw, there's no problem, the resistor just drops less voltage, and the regulator input goes *up*, away from dropout.
And *finally*, answering your first question, "what if I really *am* only using 20mA, power *isn't* a problem and I just need to drop a couple of volts?"
Use a string of a few diodes. Each diode will drop .6 to .7v, regardless of load. Just run a 20K resistor to ground so the string is always biased "on" by a milliamp or two so that even when the regulator load goes to zero, some small current still flows and the drop still works. |