Linear Regulators (7805, LM317) vs Buck Converters Compared

Nearly every project needs to turn a higher, unsteady voltage into a lower, stable one: 12 V to 5 V, 9 V to 3.3 V, a Li-ion battery to 1.8 V. There are two main approaches. A linear regulator behaves like a self-adjusting resistor and burns off the excess voltage as heat. A buck converter switches the input on and off rapidly and filters the result with an inductor and capacitor, wasting far less energy. This article shows how to calculate both and when each is the right choice.

Linear Regulators

The 7805

The 78xx family gives fixed outputs: 7805 for 5 V, 7812 for 12 V and so on. In the common TO-220 package the pins are input, ground, output from left to right when viewed from the front. The datasheets recommend input and output capacitors, typically 0.33 µF on the input and 0.1 µF on the output, placed close to the pins. The 7805 needs roughly 2 V of headroom (dropout), so the input must stay above about 7 V, including the bottom of any ripple.

The LM317

The LM317 is an adjustable regulator that keeps 1.25 V between its OUT and ADJ pins. Two resistors set the output. In TO-220, the pins are ADJ, OUT, IN from left to right viewed from the front.

Vout = 1.25 x (1 + R2 / R1) + I_adj x R2
(I_adj is about 50 µA, so the last term is usually ignored)

With R1 = 240 Ω:
  For 5.0 V:  R2 = R1 x (Vout / 1.25 - 1) = 240 x 3 = 720 Ω
  For 3.3 V:  R2 = 240 x (3.3 / 1.25 - 1) = 240 x 1.64 = 394 Ω
  For 9.0 V:  R2 = 240 x (9 / 1.25 - 1) = 240 x 6.2 = 1488 Ω

Since 720 Ω is not a standard value, use 680 Ω in series with 39 Ω, or a 1 kΩ trimmer for adjustment. The 240 Ω value for R1 ensures the regulator's minimum load current flows even with no external load.

Power dissipation

P_reg = (Vin - Vout) x I_load
Efficiency ~ Vout / Vin
Junction temperature: Tj = Ta + P_reg x RthJA

Worked example: 12 V to 5 V at 500 mA through a 7805.

P_reg = (12 - 5) x 0.5 = 3.5 W
Efficiency = 5 / 12 = 41.7%
TO-220 with no heatsink, RthJA of the order of 50 °C/W or more (check datasheet):
Tj = 35 + 3.5 x 50 = 210 °C   -> far too hot, needs a heatsink

With a heatsink, the thermal path is junction-to-case plus case-to-heatsink (with thermal paste) plus heatsink-to-air. To keep Tj below about 125 °C at 35 °C ambient, the total must be under (125 - 35) / 3.5 = 25.7 °C/W, which needs a moderately sized finned heatsink. The 7805 also has internal thermal shutdown, so an undersized heatsink usually shows up as an output that cuts out after a few minutes.

Buck Converters

A buck converter uses a switch (a MOSFET or an internal transistor), a diode or second switch, an inductor and an output capacitor. When the switch is on, current builds in the inductor and flows to the load; when it is off, the inductor keeps the current flowing through the diode. The output is the average of the switched waveform, set by the duty cycle.

Ideal duty cycle:     D = Vout / Vin
Inductor ripple:      dI = (Vin - Vout) x D / (L x f_sw)
Input power:          Pin = Vout x Iout / efficiency
Input current:        Iin = Pin / Vin

The LM2596 is a popular buck regulator IC, available on cheap ready-made modules, switching at a fixed 150 kHz and rated for 3 A load current.

Worked example: same 12 V to 5 V at 500 mA

D  = 5 / 12 = 0.417
With L = 33 µH, f = 150 kHz:
dI = (12 - 5) x 0.417 / (33e-6 x 150 000) = 2.92 / 4.95 = 0.59 A p-p

Assume 85% efficiency (read the real value from the datasheet curves):
Pout = 2.5 W
Pin  = 2.5 / 0.85 = 2.94 W
Loss = 0.44 W      (vs 3.5 W for the 7805)
Iin  = 2.94 / 12 = 245 mA  (vs 500 mA for the 7805)

The buck converter draws less input current than it delivers at the output, because it transforms voltage down and current up. A linear regulator always draws the full load current from the input. For battery-powered circuits this difference doubles the run time in this example.

The inductor ripple of 0.59 A peak-to-peak means the inductor current swings from about 0.2 A to 0.8 A around the 0.5 A average. The inductor must therefore be rated for a peak of at least 0.8 A without saturating. At light loads, when the average current falls below half the ripple, many converters enter discontinuous or pulse-skipping operation, which is normal but can change the output ripple frequency.

Choosing Between Them

FactorLinear (7805 / LM317)Buck converter
EfficiencyAbout Vout / VinTypically 80 to 95%
Output noiseVery low, no switching rippleSwitching ripple and EMI, needs layout care
Parts countRegulator plus two capacitorsIC, inductor, diode, capacitors, feedback resistors
Heat at large voltage dropHighLow
Cost for small currentsLowestHigher
Best forSmall drop, low current, noise-sensitive analogue or RFLarge drop, high current, battery operation

A good rule: if (Vin - Vout) x I is below about half a watt, a linear regulator is simple and quiet. Above a watt or two, use a buck converter. Combining the two, a buck down to 6 V followed by a low-noise linear regulator to 5 V, gives low heat and clean output.

Common Mistakes

  • Feeding a 7805 from 6 V; it falls out of regulation below about 7 V input. Use a low-dropout (LDO) regulator instead.
  • Forgetting the input and output capacitors, which can make the regulator oscillate.
  • Mixing up LM317 and 7805 pinouts; they are different in the same TO-220 package.
  • Long thin wires and a spread-out layout on a buck converter, causing noise and instability.
  • Using an inductor whose saturation current is below the peak current (load plus half the ripple).

Summary

A linear regulator dissipates (Vin - Vout) x I and is only efficient when the voltage drop is small; the LM317 output is 1.25 x (1 + R2 / R1). A buck converter runs at a duty cycle near Vout / Vin and wastes only a small fraction of the power, at the cost of more parts and some switching noise. Always calculate dissipation first; the number tells you which approach to use and whether you need a heatsink.