If you need a steady 5 V or 3.3 V from a higher source, the easiest solution is a fixed regulator: a three-pin chip, with no resistors or calculations like the LM317. But choosing the wrong regulator causes plenty of problems: a board that overheats, an ESP32 that keeps resetting, or a battery that's flat in two days.
The 78xx family
The last two digits are the voltage: 7805 = 5 V, 7809 = 9 V and 7812 = 12 V.
- Pinout (TO-220 package, marking facing you): IN – GND – OUT.
- Maximum current: about 1 A in practice with good cooling (the datasheet says up to 1.5 A under ideal conditions).
- Dropout: the input must be about 2 V above the output. So for the 7805, the input must be at least 7 V, even at the lowest point of the ripple.
- Capacitors: the datasheet suggests about 0.33 µF on the input and 0.1 µF on the output, close to the pins. Many people add a larger electrolytic as well.
- Maximum input voltage: about 35 V for the 7805, but heat will stop you long before that.
Other family members
| Chip | Output | Note |
|---|---|---|
| 78L05 | 5 V, about 100 mA | Small TO-92 package like a transistor |
| 7805 | 5 V, about 1 A | The most common |
| 7812 | 12 V | Needs at least 14.5 V input |
| 7905 | −5 V | The negative version, with a different pinout |
| 7912 | −12 V | With a 7812 it makes a ±12 V supply for op-amps |
If you need ±12 V for op-amp circuits, the usual approach is a centre-tapped transformer (12-0-12), a bridge, two capacitors, a 7812 on the positive side and a 7912 on the negative. Details are in the rectifier and bridge article.
The LDO: a small dropout
LDO = low dropout. It works with a much smaller voltage difference. The most common is the AMS1117-3.3, found on many ESP32 boards:
- Outputs 3.3 V at up to about 1 A.
- The dropout is about 1.1–1.3 V, so it easily gets 3.3 V from 5 V USB.
- Needs a suitable output capacitor (usually 22 µF), or it may oscillate.
- Pinout in the SOT-223 package: 1 = GND (or ADJ), 2 = OUT, 3 = IN, and the large metal tab is connected to the output. That's completely different from the 7805, so don't swap them in a design without checking.
- It comes in 1.8, 2.5 and 5 V versions, and an adjustable (ADJ) version with two resistors like the LM317.
Quiescent current: very important for batteries
Every regulator draws a small current for itself even with no load at all (the quiescent current). That doesn't matter with an adapter, but with a battery it can be the largest consumer in the project:
| Regulator | Approx. quiescent current |
|---|---|
| 7805 | 4–8 mA |
| AMS1117 | about 5 mA |
| MCP1700 | about 1.6 µA |
| HT7333 | about 4 µA |
So an ESP32 in deep sleep draws 10 µA, but if there's an AMS1117 in front of it, the battery loses 5 mA all the time, 500 times the chip's own consumption. A 2000 mAh battery would be flat in about 16 days instead of months. The calculation is in the battery life article.
Powering an ESP32 from a lithium cell
The cell starts at 4.2 V and falls to about 3.3 V. If you use an AMS1117 (1.1 V dropout), it stops regulating as soon as the battery drops below about 4.4 V, which is almost from the start. What you need is an LDO with a very small dropout (about 0.1–0.25 V at the project's current), that can handle Wi-Fi peaks (300 mA and more), with a small quiescent current. The MCP1700's quiescent current is excellent, but its maximum is 250 mA, so it may sag during Wi-Fi peaks. Chips such as the RT9013 or ME6211 (500 mA) fit better, with a large capacitor on the output.
Heat: the same law as the LM317
Any linear regulator throws away the difference as heat:
P = (Vin − Vout) × I
- A 7805 from 12 V at 0.5 A: (12 − 5) × 0.5 = 3.5 W. That definitely needs a heatsink.
- An AMS1117 from 5 V to 3.3 V at 0.3 A: about 0.5 W, and a good copper area on the board is usually enough.
A complete example: a 7805 in a TO-220 package without a heatsink has a thermal resistance to air of about 50 °C per watt. If it dissipates 3.5 W in 25 °C air, the chip would theoretically reach 25 + 3.5 × 50 = 200 °C. That's impossible: the thermal protection inside the chip shuts it down at about 150 °C, and the output cuts out and comes back. So a heatsink is mandatory, or reduce the difference. The linear regulator heat calculator does this calculation and tells you the heatsink you need.
A trick: a resistor before the regulator
If the input is high and the current is roughly constant, you can put a series power resistor before the regulator to take part of the heat. Example: a 7805 from 12 V at 0.3 A. A 10 Ω resistor drops 3 V (and dissipates 0.9 W instead of the chip), so the regulator sees 9 V and dissipates only 1.2 W. You must make sure the input stays above 7 V even at the highest current. Calculating the resistor's power is in the Ohm's law article.
The protection diode
If there's a large capacitor on the output and the input can be cut off or shorted suddenly, the capacitor discharges backwards into the regulator. A 1N4002 diode from output to input (cathode to the input) routes that charge safely. In small circuits it isn't essential, but it costs next to nothing.
7805 or buck?
| Situation | Best fit |
|---|---|
| Small voltage difference and low current | LDO |
| Small voltage difference and medium current | 7805 or LDO with cooling |
| Large voltage difference or high current | Buck converter |
| On a battery and you want it to last | Buck, or an LDO with low quiescent current |
The comparison in numbers is in the buck vs linear regulator article. And there are tiny buck modules with the same pinout as the 7805 that drop straight into its place, if you have an old board that runs hot.
Common mistakes
- Pins reversed: LDO pinouts vary from chip to chip, and the 79xx (negative) pinout differs from the 78xx. Check the datasheet.
- Input too low: the output sags and is no longer regulated.
- No capacitors: the regulator may oscillate and produce a strange output.
- Two regulators in parallel for more current: they won't share the current; one will carry the whole load. Use a bigger regulator or a buck.
- The heatsink touching the chassis while the chip's tab is connected to a pin: a short. Use an insulator.
FAQ
The output is 5 V with no load and drops when I connect the load? The input is probably close to the limit, and with ripple under load it dips below 7 V. Measure the input with the load connected, and increase the filter capacitor or the voltage. See the filter capacitor article.
Can I feed a 7805 from 5 V to get 5 V out? No, you'll get only about 3 V because of the dropout. If the input is already 5 V, you don't need a 5 V regulator.