Most electronic projects need a stable voltage source, typically 5V or 3.3V DC. Here we discuss how to choose when to use a linear voltage regulator and when to use a buck converter.

## What’s the difference?

The standard advice for beginners is to use a linear voltage regulator, for example an LM7805. Linear voltage regulators are great for low current draws and low voltage drops, but become inefficient and surprisingly hot when used for higher current draws or larger voltage drops. The reason for this is that they turn the excess voltage into heat.

Buck converters turn the input voltage on and off quickly (__PWM__) to generate a lower average voltage and smooth the output to generate a consistent output voltage. This makes them far more efficient: capable of dropping a large voltage at a higher current while dissipating less heat.

## Which one should you use?

Which is best for your project depends on:

- Cost

Buck converters typically cost more, although that difference is diminishing as buck converters become more common - Efficiency

How much of the power is available for your circuit and how much is wasted might be a concern especially if you are powering your circuit from a battery. - Heat

Excess heat can be an issue especially if your circuit is in an enclosure. It is essential to understand how much heat you need to dissipate and have a strategy for getting rid of it. - Size

For small loads linear regulators are usually smaller, but for larger loads buck converters can be smaller.

## Voltage and current requirements

Before picking components you need to understand the voltage and current requirements of your circuit. You will need to match voltage specifications closely, but you don’t have to match current requirements exactly.

You will want sufficient current to power your circuit during its peak current draw. Having more current available than your circuit requires will give you a safety margin and will also enable your power supply to run cooler. However, you might be adding unnecessary cost and size to your project if you over specify too much.

As an example I want to power a circuit with 5V and 3.3V logic from a 12V input supply. I don’t expect to draw more than 50mA from the 3.3V supply or more than 200mA from the 5V supply. So I have a maximum current requirement of 250mA. To add a safety margin and ensure my circuit runs cool I would ideally be looking for something than can supply 500mA.

## Dissipating heat in linear regulators

To get the maximum power (in Watts) that a linear regulator would need to dissipate we multiply the voltage drop by the maximum current.

Power Dissipated = Voltage Drop * Current

In my example to get to 5V from a 12V supply the linear regulator needs to drop 7V volts. If we assume that the 3.3V will be sourced from the 5V output then the we have a maximum current of 250mA.

Power Dissipated = 7 V * 0.250 A = 1.75 W

A linear regulator is limited by its maximum junction temperature, which is normally 125 or 150 °C. You can use the thermal information in the datasheet to estimate what this temperature would be in your application.

Thermal resistance measures how heat flow is resisted, similar to the way electrical resistance resists current flow. For a linear regulator standing in still air without a heat sink the junction to ambient thermal resistance measures how heat flow from the junction to the surrounding air is resisted.

To estimate the junction temperature rise above the ambient temperature you multiply the power that the linear regulator needs to dissipate by the junction to ambient thermal resistance specified in the datasheet.

Temperature Rise = Power * Junction to Ambient Thermal Resistance

We add the temperature rise to ambient temperature to get the junction temperature. It’s typical to use a value of 25°C (77°F), but the actual operating environment of your circuit could be a 21°C air conditioned home or a 105°C engine compartment.

Junction Temperature = Ambient Temperature + Temperature Rise

Check the datasheet of your component for the junction to ambient thermal resistance as this number varies between devices even within the same package. For example, just considering the ubiquitous LM7805 TO-220 1.5A linear regulator. Texas Instruments specifies 23.9 °C/W whereas ST specifies 50 °C/W and I have seen values as high as 78 °C/W in a TO-220 package.

The __ST LM7805 datasheet__ specifies a maximum current of 1.5A and a junction-to-ambient thermal resistance of 50 degrees C/W in a TO-220 package. So we just multiply this by the number of watts we need to dissipate to get a temperature rise of 87.5°C.

Temperature Rise = 1.75 W * 50 °C/W = 87.5 °C

Assuming an ambient temperature of 25 degrees C we get a junction temperature of 112.5 °C, which is just below typical maximum gate temperature of 125 degrees C.

Junction Temperature = 25°C + 87.5°C = 112.5°C

So this TO-220 linear regulator would work fine as long as the ambient temperature is less than 37.5 degrees C (100 degrees F), but it would run too hot to touch without a heat sink.

## Adding a heat sink

To dissipate more heat you can add a heat sink. This adds some additional cost and takes up more space. Also as you start dissipating more heat you might need to consider how heat is managed within your circuit enclosure.

To see the impact of a heat sink you need to calculate the new junction to ambient thermal resistance of the linear regulator plus the heat sink. To do this look up the junction to case thermal resistance of the linear regulator and the thermal resistance of the heat sink. Then add these two numbers together.

Junction to Ambient Thermal Resistance = Junction To Case Thermal Resistance + Heat Sink Thermal Resistance

The ST LM7805 TO-220 has a junction to case thermal resistance of 5 °C/W, so if we attach a __23 °C/W heat sink__ from Adafruit we get a total junction to ambient thermal resistance of 28 °C/W.

Junction to Ambient Thermal Resistance = 5°C/W + 23°C/W = 28°C/w

Which would give us a junction temperature rise of 49 °C.

Temperature Rise = 1.75 W * 28°C/W = 49°C/W

Assuming an ambient temperature of 25 °C would give us a junction temperature of 74 °C. About the temperature of a hot beverage from your favorite coffee shop.

Junction Temperature = 25°C + 49°C = 74°C

## Buck converters

Buck converters are not perfectly efficient and will generate some heat. How much heat can be determined by the efficiency specified in the datasheet.

To determine how much power is dissipated as heat we need to know the difference between the input power and the output power.

Power Dissipated = Output Power - Input Power

To get the input power we can divide the output load by the efficiency of the buck converter.

Output Power = Input Power * Efficiency Input Power = Output Power / Efficiency

For instance the __TI TPS560200__ buck controller is about 80% efficient when converting from 12V to 1.05V at 250mA. It will likely be slightly more efficient when converting 12V to 5V. At 80% efficient the buck converter will dissipate 20% of its input power as heat.

In our example we have a 250mA load at 5V which is 1.25 W.

Output Power = 0.25 A * 5 V = 1.25 W

So the input power is 1.5625 W.

Input Power = 1.25 W / 0.80 = 1.5625 W

And the power dissipated as heat is 0.3125 W.

Power Dissipated = 1.5625 W - 1.25 W = 0.3125 W

The MOSFETs are contained within this IC and the MOSFETs account for most of the losses in a buck converter, so we are going to ignore that some of the losses are in the external components.

The datasheet specifies a junction to ambient thermal resistance of 166.8 °C/W. The junction to ambient thermal resistance isn’t a perfect metric as PCB design will affect the actual thermal resistance, but it’s good enough for us to work with as an estimate.

With 0.3125 W to dissipate the temperature rise would be 52.125 °C.

Temperature Rise = 0.3125 W * 166.8°C/W = 52.125°C

So with an ambient temperature of 25 °C the junction temperature would be approximately 77.125 °C.

Junction Temperature = 25°C + 52.125°C = 77.125°C

## Additional voltages

To get 3.3V we could we could use the 12V supply directly (dropping 8.7V), but seeing as we already have a 5V output, we can drop 1.7V from 5V. At 50mA this would be just 0.085W for a linear regulator to dissipate.

Power Dissipated = 1.7 V * 0.050 A = 0.085 W

The Microchip Technology MCP1700T-3302E/TT is a 3.3V linear regulator in a 3 pin SOT-23 surface mount package. The __datasheet__ quotes the junction to ambient thermal resistance of 336 °C/W. So the gate temperature with a 25 °C ambient temperature would be 53.56 °C.

Temperature Rise = 0.085 W * 336°C/W = 28.56°C Junction Temperature = 25°C + 28.56°C = 53.56°C

So in this case a linear regulator is sufficient and a SOT-23 takes up very little board space (about 3mm by 3mm).

So for our example circuit a good choice might be to use a buck converter to drop from 12V to 5V and a linear regulator to drop from 5V to 3.3V.

In my next post Making a buck converter we look how to incorporate a buck converter into your circuit.