Five years ago when I first started with the Arduino and Raspberry Pi I did not think too much about power supply, at this time the power adapter from raspberry Pi and the USB supply of Arduino was more than enough.
But after some time my curiosity pushed me to consider other power supply methods, and after creating more projects I was forced to make considerations about different and if possible adjustable DC power sources.
Especially when you finish your design you will definitely want to build a more permanent version of your project, and for that you will need to consider how to go about providing power to it.
In this Tutorial I will explain how you can create your own linear power supply with widely used and affordable voltage regulators IC (LM78XX, LM3XX, PSM-165 etc.). You will learn about their functionality and implementation for your own projects.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Design Considerations
Common Voltage Levels
There are several standard voltage levels that your design might require:
- 3.3 Volts DC – This is a common voltage used by Raspberry PI and low-powered digital devices.
- 5 Volts DC – This is the standard TTL (Transistor Transistor Logic) voltage used by digital devices.
- 12 Volts DC –used for DC, servo and stepper motors.
- 24/48 Volts DC – widely used in CNC and 3D Print projects.
You should consider in your design that logic level voltages need to be regulated very precisely. For example for devices with TTL voltage the supply voltage needs to be between 4.75 and 5.25 volts, otherwise any voltage deviation will cause the logic components to stop working correctly or even destroy your components.
In contrast to the logic level devices the power supply for the motors, LEDs and other electronic components can deviate in a wide range. Additionally you must consider current requirements of the project. Especially motors can cause the current draw to fluctuate and you need to design your power supply to accommodate the “worst case” situation where every motor is operated at full capacity.
You have to use different approach for the voltage regulation for the line powered and battery powered designs, because the battery voltage levels will fluctuate as the battery discharges.
Another important aspect of the voltage regulator design is the efficiency – especially in battery powered projects you must reduce power losses to the minimum.
ATTENTION: In most of the countries a person cannot legally work with voltages above 50V AC without a license. Any mistake made by any person working with lethal voltage can lead to their own death, or that of another person. For this reason I will only explain DC power supply build with voltage level under 60 V DC.
Step 2: Types of Voltage Regulators
There are two main types of voltage regulators:
- linear voltage regulators which are most affordable and simple to use
- switching voltage regulators which are more efficient than linear voltage regulators, but more expensive and they require a more complex circuit design.
In this tutorial we will work with linear voltage regulators.
Electrical characteristics of the linear voltage regulators
The voltage drop in the linear regulator is proportional to the dissipated power of the IC, or with other words power loses because of the heating effect.
For the power dissipation in the linear regulators following equation can be used:
Power = (VInput – VOutput) x I
The L7805 linear regulator has to dissipate at least 2 watts if it would deliver a 1 A load (2 V voltage drop times 1 A).
With the increase of the voltage difference between the input and output voltage - the power dissipation increase as well. Meaning, for example, while a 7 volts source regulated to 5 volts delivering 1 amp would dissipate 2 watts through the linear regulator, a 12 V DC source regulated to 5 volts delivering the same current would dissipate 5 watts, making the regulator only 50 % efficient.
The next important parameter is the “Thermal Resistance” in units of °C/W (°C per Watt).
This parameter indicates the number of degrees the chip will heat up above the ambient air temperature, per each watt of power it must dissipate. Simply multiply the calculated power dissipation by Thermal Resistance and that will tell you how much that linear regulator will heat up under that amount of power:
Power x Thermal Resistance = Temperature Above Ambient
For example a 7805 regulator has a Thermal Resistance of 50°C / Watt. This means if your regulator is dissipating:
- 1 watt, it will heat up 50°C
- .2 watts it will heat up 100°C.
NOTE: During project planning phase try to estimate required current and reduce the voltage difference to a minimum. For example 78XX linear voltage regulator has 2 V voltage drop (min. input voltage is Vin = 5 + 2 = 7 V DC), as a result you can use 7,5 or 9 V DC power supply.
Under consideration that the output current is equal to the input current for a linear regulator then we will get simplified equation:
Efficiency = Vout / Vin
For example, let’s say you have 12 V on the input and need to output 5 V at 1 A of load current, then the efficiency for a linear regulator would only be (5 V / 12 V) x 100% = 41 %. This means that only 41 % of the power from the input is transferred to the output, and the remaining power will be lost as heat!
Step 3: 78XX Linear Regulators
The 78XX voltage regulators are 3-pin devices available in a number of different packages, from large power transistor packages (T220) to tiny surface mount devices it is a positive voltage regulators. The 79XX series are the equivalent negative voltage regulators.
The 78XX series of regulators provide fixed regulated voltages from 5 to 24 V. The last two digits of the IC part number denote the output voltage of the device. This means, for example, a 7805 is a positive 5 volt regulator, a 7812 is a positive 12 volt regulator.
These voltage regulators are straight forward – connect L8705 and couple of electrolytic capacitors across the input and output, and you build simple voltage regulator for 5 V Arduino projects.
The important step is to check the data sheets for the pin-outs and manufacturer recommendations.
The 78XX (positive) regulators use the following pinouts:
- INPUT—unregulated DC input Vin
- REFERENCE (GROUND)
- OUTPUT -regulated DC output Vout
One thing to note about the TO-220 case version of these voltage regulators is that the case is electrically connected to the center pin (pin 2). On the 78XX series that means the case is grounded.
This type of linear regulator has a 2 V dropout voltage, as a result with a 5V output at 1A, you need to have at least 2.5 V DC head voltage (i.e., 5V + 2.5V = 7.5V DC input).
The manufacturer recommendations for the smoothing capacitors is CInput = 0.33 µF and COutput = 0.1 µF, but general practice is 100 µF capacitor on the input and the output It is a good solution for the worst-case scenario, and the capacitors help to cope with sudden fluctuations and transients in the supply.
In case that the supply falls below the threshold of 2 V- the capacitors will stabilize the supply to ensure that this does not happen. If your project dos not have such transients, then you can run with the manufacturer recommendations.
Simple linear voltage regulator circuit is just L7805 voltage regulator and two capacitors, but we can upgrade this circuit to create some more advanced power supply with some level of protection and visual indication.
If you would like to distribute your project then I will definitely suggest to add those few additional components in order to prevent future inconvenience with customers.
Step 4: Upgraded 7805 Circuit
First you can use the switch to power the circuit on or off.
Additionally you can place a diode (D1), wired in reverse bias between the output and input of the regulator. If there are inductors in the load, or even capacitors, a loss of input can cause a reverse voltage, which can destroy the regulator. The diode bypasses any such currents.
Additional capacitors act as a kind of final filter. They must be voltage rated for the output voltage, but should be high enough to suit the input for a little margin of safety (e.g., 16 25 V). They really depend on the type of load you expect, and can be left out for a pure DC load, but 100uF for C1 and C2, and 1uF for C4 (and C3) would be a good start.
Additionally you can add the LED and appropriate current-limiting resistor to provide an indicator light which is very useful for power supply failure detection; when the circuit is powered LED lights are ON otherwise look for some failures in your circuit.
Most voltage regulators have protection circuitry that protects chips from overheating and if it gets too hot, it drops the output voltage and therefore limits the output current so that the device is not destroyed by the heat. Voltage regulators in TO-220 packages also have a mounting hole for the heatsink attachment, and I will suggest that you should definitely use it to attach a good industrial heatsink.
Step 5: More Power From 78XX
Most of the 78XX regulators are limited to an output current of 1 - 1.5 A. If the output current of an IC regulator exceeds its maximum allowable limit, its internal pass transistor will dissipate an amount of energy more than it can tolerate, which will lead to the shutdown.
For applications that require more than the maximum allowable current limit of a regulator, an external pass transistor can be used to increase the output current. Figure from FAIRCHILD Semiconductor illustrates such a configuration. This circuit has the capability of producing higher current (up to 10 A) to the load but still preserving the thermal shutdown and short-circuit protection of the IC regulator.
BD536 power transistor is suggested by manufacturer.
Step 6: LDO Voltage Regulators
The L7805 is a very simple device with a relative high dropout voltage.
Some linear voltage regulators, so called low-dropout (LDO), have a much smaller dropout voltage than the 2V of the 7805. For example the LM2937 or LM2940CT-5.0 has a dropout of 0.5V, as a result your power supply circuit will have a higher efficiency, and you can use it in projects with battery power supply.
The minimum Vin-Vout differential that a linear regulator can operate is called the dropout voltage. If the difference between Vin and Vout falls below the dropout voltage, then the regulator is in dropout mode.
Low-dropout regulators have a very low difference between the input and the output voltage. Especially the LM2940CT-5.0 linear regulators voltage difference can reach less than 0.5 volt before the devices “drop out”. For normal operation the input voltage should be 0.5 V higher than the output.
Those voltage regulators have same T220 form factor as L7805 with the same layout - input on the left, ground in the middle, and output on the right (when viewed from the front). As a result you can use the same circuit. Manufacture recommendations for the capacitors are CInput = 0.47 µF and COutput = 22 µF.
One major drawback is that “low-dropout” regulators are more expensive (even up to ten times) in comparison to the 7805 series.
Step 7: Regulated LM317 Power Supply
The LM317 is a positive linear voltage regulator with a variable output, is capable of supplying an output current of more than 1.5 A over an output voltage range of 1.2–37 V.
. The first two letters denote the manufacturer’s preferences, such as “LM”, standing for “linear monolithic”. It is a voltage regulator with a variable output and so it is very useful in situations where you need a non-standard voltage. The format 78xx is a positive voltage regulators, or 79xx are negative voltage regulators, where “xx” represents the voltage of the devices.
The output voltage range is between 1.2 V and 37 V, and can be used to power your Raspberry Pi, Arduino or DC Motors Shield. The LM3XX has the same input/output voltage difference as 78XX – the input must be at least 2.5 V above the output voltage.
As with the 78XX series of regulators the LM317 is a three pin device. But the wiring is slightly a bit different.
The main thing to note about the LM317 hookup is the two resistors R1 and R2 that provide a reference voltage to the regulator; this reference voltage determines the output voltage. You may calculate these resistor values as follows:
Vout = VREF x (R2/R1) + IAdj x R2
IAdj is typically 50 µA and negligible in most applications, and VREF is 1.25 V – minimum output voltage.
If we neglect IAdj then our equation can be simplified to
Vout = 1.25 x (1 + R2/R1)
If we will use R1 240 Ω and R2 with 1 kΩ then we will get output voltage of Vout = 1.25(1+0/240) = 1.25 V.
When we will rotate potentiometer knob fully in other direction then we will get Vout = 1.25(1+2000/240) = 11.6 V as output voltage.
If you need higher output voltage then you should replace R1 with 100 Ω resistor.
- R1 and R2 are required to set the output voltage.
CAdj is recommended to improve ripple rejection. It prevents amplification of the ripple as the output voltage is adjusted higher.
- C1 is recommended, particularly if the regulator is not in close proximity to the power-supply filter capacitors. A 0.1-µF or 1-µF ceramic or tantalum capacitor provides sufficient bypassing for most applications, especially when adjustment and output capacitors are used.
- C2 improves transient response, but is not needed for stability.
- Protection diode D2 is recommended if CAdj is used. The diode provides a low-impedance discharge path to prevent the capacitor from discharging into the output of the regulator.
- Protection diode D1 is recommended if C2 is used. The diode provides a low-impedance discharge path to prevent the capacitor from discharging into the output of the regulator.
Step 8: Summary
Linear regulators are useful if:
- The input to output voltage differential is small
- You have a low load current
- You require an extremely clean output voltage
- You need to keep the design as simple and cheap as possible.
Therefore, not only are linear regulators easier to use, but they provide a much cleaner output voltage compared to switching regulators, with no ripple, spikes, or noise of any type. In summary, unless the power dissipation is too high or you require a step-up regulator, a linear regulator will be your best option.