Keeping it Regular

Daniel Koch

Issue 3, September 2017

This article includes additional downloadable resources.
Please log in to access.

Log in

Not all power supplies are stable, or provide the right voltage. But there’s an easy way to solve this.

For many makers, getting the right voltage for their projects is one of the biggest challenges. While many programmable boards like Arduino or Raspberry Pi run on either 3.3V or 5V, many higher-powered output devices such as motors, relays or LED light arrays need 12V. In many other cases, you may wish to be running a board from a battery source, the voltage of which may not match your requirements.

voltage regulator

However, there are solutions to this challenge. The first of which is a classic component known to electronics engineers and hobbyists alike, called the voltage regulator. One type of voltage regulator is a three-pin device with an input, a ground, and an output. Power goes in at one voltage and comes out at a regulated lower voltage. In practice, there are some components required around this but the basic principle is very simple. There are some terms and conditions, so it isn’t all smooth sailing, but first, let’s look at the devices themselves.

The most common series of regulators available on the Australian market is the LM78XX series. These are three-pin positive voltage regulators, and are available in a range of fixed voltages indicated by the last two digits of the part number; that is, where the XX appears above. They have a standard current limit of 1A.

Let’s look a little more closely at the LM7812 [1]. The “12” at the end tells us that this device will give a regulated 12V output. The manufacturer’s data sheet tells us that it can output in excess of 1A with appropriate heatsinking, and that if we get this wrong, then the device is equipped with thermal protection that shuts it down in case of thermal overload. Useful stuff to know!

This is where the technicalities start. Inside this TO220-packaged three-pin device, a reference voltage is compared to the output voltage, and the error between the two is used to adjust the gain of a series pass transistor, as a variable resistance, to cause a voltage drop, until the output is equal to the reference value.

This means you need at least 2.5V more on the input side than you want from the output side, otherwise the device will lose regulation and the output will fall below the desired value. So you cannot use, say, an LM7812 to give you regulated 12V from a 13.8V sealed lead acid battery.

voltage regulator
voltage regulator

Further hints are found in the data sheets. The devices can cope with a maximum input voltage of 35V (providing we don't exceed the overall power rating of the device / heatsink combination being used). That’s quite high for most makers, although with some outdoor cordless power tools running on 40V or even 58V lithium batteries, this is a situation some of you may encounter when choosing power sources for innovative applications. The challenge is this: the higher the difference between input and output voltage, the more heat is produced. There are graphs in most data sheets showing the power dissipation (the amount of heat that will be generated measured in watts) for different input voltages. These are useful viewing if you are planning to use a regulator with a large input voltage difference. Heatsinks [2] are bulky when they are capable of working hard, and they require good airflow, which isn’t always possible.

So, where possible, the key really is to choose an input voltage that is 3V to 7V above the desired output voltage. Also, don’t think that you could just cascade voltage regulators one after another, stepping down; because the heat still builds up, and that is a very inefficient way of doing things!

Happily, these devices are available in 5V, making them quite useful for makers. In fact, there is even a special low-power version of the 5V product - the LM78L05 [3] - which is made in a TO92 package with a 100mA output. The TO92 fits on small project boards very well, if all you need to power is a little logic and some sensors.

Actually using a voltage regulator doesn’t take too much effort. The first step is to check the data sheets for the pin-outs. While on the subject of data sheets, many people just search the internet for pin-out information, but this has two pitfalls. The first is that the image you find and glance at may not be the device you’re after, as it may have been mislabelled or tagged incorrectly. The other is that anyone can put anything on the internet, so the information you find may be outright wrong. Using manufacturer’s data sheets will avoid both of these problems.


Once you have established which pin is the INPUT, which is the GROUND, and which is the OUTPUT, you simply connect them to where they need to go, then add a couple of capacitors, as suggested in the data sheet. What you add here varies with application. On the input, an electrolytic capacitor of around 100uF is ideal, followed by a 10µF and 100nF pair across the output. This is a worst-case scenario, and the capacitors help to cope with sudden fluctuations and transients in the supply.

If the supply falls below the threshold of 2.5V above the output, regulation is lost; so these capacitors stabilise the supply to ensure that this does not happen. If your application is unlikely to feature any such transients, then run with 10µF [4] on the input, and 100nF on the output. National Semiconductor, in fact, claim their products can be run without any capacitors. Of course, all the information in this paragraph can vary, so check the data sheet, preferably from the correct manufacturer, for the device you have.

Voltage regulators really are simple to use when the desired voltage matches one of the series of devices available. However, what do you do if you need a voltage other than those available? e.g. 3.3V?

The answer comes in the form of another three-pin device, which definitely does require extra components in order to work. The LM317T is another TO220-packaged voltage regulator [5]; however, this one has an output adjustable between 1.2V and 37V. The same rule applies to the fixed regulators regarding input/output difference – the input must be at least 2.5V above the output voltage for regulation to occur. In the case of the LM317T, a fixed resistor of 240Ω is placed between the “output” and “adjustment” pins. These are both connected to ground by a second resistor. The value of this resistor is what sets the output voltage.

TO220-packaged voltage regulator

The formula for the LM317 is: Vout = 1.25V x (R2/R1) + IAdj (R2)

To find a given output voltage, decide on the value of R1, the fixed resistor. This was 240Ω in the data sheet, but is 120Ω in some other applications. Then find the current through the adjustment terminal, which is 50µA - not a lot! This is the IAdj value for R1 values; 1k0, R2 ~= R1(Vo/Vi) = Vo x R1/1.25. IAdj is negligible when the resistances are chosen low. Once the value of R2 is known, all that is left is to decide if you will use a fixed resistor and go with the nearest available value, or a variable resistor. An example, such as a 25-turn screw-adjust trimpot, would give very accurate control over the output voltage; very useful for a number like 3.3V.

As in circuit [4], circuit [6] has two capacitors to dissipate any spikes that may come from the supply, or the circuit, which may interfere with the regulator. Good practice is to distribute further capacitance around the circuit if the circuit is particularly noisy.

Next time, we will look further into boosting the output current, and some of the specialised regulators that are available.