Power Supplies

DIY Linear Power Supply Circuits: From 5V Fixed to 0-30V Variable

Learn linear power supply circuits, from a fixed 5V 7805 build to an adjustable LM317 design, with the key formulas and heat limits explained.

On this page
  1. What a linear power supply does
  2. Heat: the number to check first
  3. A fixed 5V circuit with a 7805
  4. An adjustable circuit with an LM317
  5. Why 0-30V at 5A is a bigger job
  6. Questions about 5V supplies
  7. Safety for mains-powered builds
  8. Build checklist

What a linear power supply does

A linear supply uses a regulator chip to hold the output at a set voltage. The regulator sits between the filtered DC and the load. Any voltage above the output has to go somewhere, and in a linear regulator it leaves as heat. That makes linear supplies simple and quiet, but efficient only when the input is close to the output.

Two regulator families cover most hobby builds:

  • 78xx (fixed output): The last two digits give the output voltage, so a 7805 gives 5 V and a 7812 gives 12 V.
  • LM317 (adjustable): The output is set by two resistors, one of them usually a potentiometer.

Read the safety section before you connect anything to the mains. The primary side of a transformer carries lethal voltage.

Heat: the number to check first

The power a regulator has to shed is:

P = (Vin − Vout) × Iout

For a 7805 with 12 V in and 1 A out, that is (12 − 5) × 1 = 7 W. A small regulator cannot shed that much without a large heatsink. Keep the input only a few volts above what the regulator needs, which is its output plus its dropout. For a typical 7805, dropout is about 2 V. Size the heatsink for the worst case you expect.

A fixed 5V circuit with a 7805

The basic chain is:

  1. Transformer secondary (AC).
  2. Bridge rectifier (four diodes).
  3. Reservoir capacitor, typically a few thousand microfarads, to hold the voltage between the peaks.
  4. 7805 regulator.
  5. Output, with a small input capacitor (about 0.33 µF) and a small output capacitor (about 0.1 µF) placed close to the regulator. These are typical datasheet values, and they keep the regulator stable.

The transformer’s secondary voltage sets the input. A 12 V AC secondary peaks near 17 V before the rectifier. After the diodes and the reservoir, the regulator may see about 14 V at a 1 A load, which means around 9 W of heat. A lower secondary voltage reduces the heat, but the input must stay above the regulator’s minimum.

Two build points matter:

  • The metal tab of a 7805 in a TO-220 package is its ground pin. If the heatsink must not touch ground, fit an insulating washer.
  • The reservoir capacitor’s voltage rating must exceed the unloaded peak DC, which is about 17 V for a 12 V AC secondary. Choose a rating with margin.

Check the output with a multimeter before you connect a load.

An adjustable circuit with an LM317

The output voltage is:

Vout = 1.25 V × (1 + R2 / R1) + (Iadj × R2)

R1 is typically 240 Ω, and R2 is a fixed resistor in series with a potentiometer. Iadj is a small current, about 50 µA in the datasheet, so for ordinary resistor values its term is negligible.

As an example, with R1 = 240 Ω and R2 = 1.5 kΩ, the output is about 1.25 × (1 + 1500 / 240) ≈ 9 V.

Limits to know:

  • The LM317’s output cannot go below about 1.25 V, so this circuit cannot reach 0 V.
  • Its rated output current is 1.5 A. A heatsink is needed at higher loads.
  • The input must stay above the output by the dropout figure in the datasheet, which is a few volts.
  • Internal current limiting and thermal shutdown protect the chip. They do not replace a fuse on the mains side.

Datasheets suggest a small input capacitor and a 1 µF output capacitor. An optional 10 µF capacitor across the adjustment pin reduces ripple.

Why 0-30V at 5A is a bigger job

Many published “0-30V” designs need more than one basic regulator:

  • A single LM317 is rated for 1.5 A. An LM338 is rated for 5 A, but a 5 A supply also needs a transformer with enough power rating, a heatsink sized for the dissipation, and proper current limiting.
  • A simple LM317 arrangement cannot reach 0 V. Designs that go down to 0 V use other arrangements, such as a negative rail or a control circuit. Check the minimum output in the datasheet of any part you use.
  • Many 0-30V circuits add an external pass transistor and a control circuit. Check the voltage, current and power ratings of every part, including the transistor’s safe operating area, before you build.

For most people, a tested bench supply costs less once you count time, parts and risk.

Questions about 5V supplies

Can I use a 5V 3A adapter for a 5V 2A device? Usually yes. The current rating is a maximum, and the device draws only the current it needs. The voltage must match.

Is 5V 1A fast charging? No. 5V at 1A is a standard low-power charging level. Fast-charging standards generally negotiate a higher voltage with the device.

How much current can a 5V battery supply? That depends on the battery’s chemistry, capacity and discharge rating, not on its voltage alone. Check the battery’s datasheet for its continuous and peak limits.

How do I build my own power supply? You can build a simple fixed supply from the parts above, but the mains side is the hazardous part. Many hobbyists start with a tested commercial adapter or bench supply, and treat a build as a supervised learning project.

Safety for mains-powered builds

  • Mains is lethal. Put the primary-side wiring inside a proper enclosure, with insulated connections, strain relief and a fuse on the mains side.
  • Bond the enclosure to earth and test the earth connection.
  • Unplug before making any change. Do not touch the transformer or wiring while it is connected.
  • Capacitors can hold charge. Discharge them through a suitable resistor before you touch them.
  • Test without a load first, then add the load in steps while you watch the temperature.

Build checklist

  • Confirm the transformer’s secondary voltage and current rating.
  • Confirm voltage ratings on the capacitors and regulators, with margin.
  • Size the heatsink for the worst-case dissipation.
  • Check the output with a multimeter before you connect a load.

If the regulator runs hot even at a light load, the cause may be a fault rather than normal heat. The 7805 heat guide lists the usual causes. If you need a bench supply with a current limit, see setting the current limit on a bench power supply. For a negative rail, see dual rail power supplies.

The complete guide to power supplies

DC Power Supplies Explained: Linear, Switching and Variable
Read the guide

Keep exploring

Guides from other topics

All topics →