Thursday, August 14, 2014

How to choose voltage regulators for AVR



In this article I'll try to give an overview of available Voltage regulators, their pros and cons and application hints.

There are two types of voltage regulators, linear and switching. If you are running your AVR from a battery with a voltage between 3V and 5V, you might not need a voltage regulator in some cases.


 Type 1 The linear voltage regulator


7805 linear regulator TO220
Linear voltage regulators like the uA7805 have been around for decades. For their naming scheme you mostly only have to remember the numbers.
e.g. uA7805, LM7805, MC7805 are all the same, except that they are from different manufacturers.





Advantages:
-easy to use (only 3 pins to solder)
-cheap
-"clean" output voltage if run from a DC source

Disadvantages:
-input voltage needs to be at least 2V higher than output for non low Dropout types
-the "excess" voltage *current is transformed to heat and heat sinks might be required
-there is a constant quiescent current flowing even without load

Working principle of linear regulators is to compare the input voltage with an internal reference, and direct the "excess" voltage and current into a transistor which transforms the energy into heat.
Therefore a linear regulator gets more efficient the less current flows and the less the difference between input and output voltage is. You can calculate the power your linear regulator converts to  heat by a simple calculation. P = (Uin-Uout) * I  Where P is the heat in Watt, Uin the input voltage in V , Uout the output voltage of the regulator, and I the current your circuit behind the regulator in Ampere.
Lets say you want to run your AVR with an LCD and a SD card and some LEDs from a 12V battery.
Your circuit draws 30mA = 0.03A. So the power dissipated is 12V-5V * 0.03A which gives 0.21Watt in heat for your linear regulator to dissipate. On a uA7805 in TO220 package, you would feel the body of the regulator getting warm. For small AVR circuits they are a good choice. Newer models like the LM1117 or the LP2950 are well suited. Personally I bought some for a good price: from Banggood Hongkong but they virtually sell everywhere. You will get them in any shop that sells electronic components.
Now lets say you have 24V input, and your circuit draws 0.5A. With the uA7805 you would need to dissipate nearly 10 Watt in the regulator. Mission impossible? Add a huge heat sink with cooling fan?
No, because there are better solutions available:

 Type 2 The switching voltage regulator


Switching regulators mostly need some additional parts around them. There is always an inductor, a capacitor, a diode and some resistors involved. Because of their higher efficiency they have become more and more popular over the last 20 years as prices for electronic components dropped considerably. As with linear regulators, there are a few advantages and drawbacks.




Advantages

-high efficiency up to 99%
-low heat dissipation
-input voltage can be lower than output voltage

Disadvantages

-electromagnetic noise is generated
-additional components are mostly needed
-circuit layout might affect performance and noise
-higher price

In short, switching regulators are mostly the better choice where energy efficiency, voltage step up, high Uin Uout difference or power outputs above 1 Watt are needed.
Some switching regulators come now pin compatible with the 78xx linear regulators and can be a direct replacement. These devices have all components integrated in the package. At the moment the high cost for such regulators limits their use for hobbyists. However there are now interesting alternatives based on well know LM switching regulators which come fully assembled for under 2$.
I have used several step down and a step up module from Banggood which are of good quality and the size of a stamp.
I will dedicate a special article about this step down regulator for less than 2$- shipping for free! At such prices it is nowadays possible for hobbyists to create small projects with energy efficiencies impossible to achieve some years ago.