Linear Regulator vs Buck Converter: 7805, AMS1117 or LM2596?
Linear regulator vs buck converter: efficiency and heat math for 7805, AMS1117, LM2596 and MP1584, dropout, noise and the right pick for Arduino, ESP32, servos.
The difference in linear regulator vs buck converter is where the excess voltage goes: linear regulators such as the 7805 or AMS1117 turn the difference between input and output into heat, while buck (switching) converters such as the LM2596 or MP1584 move energy in small packets through a switch and an inductor and reach 80–92% efficiency. Short answer: if the voltage drop is small and the current is low, a linear regulator is enough, quiet and cheap; if the drop is large, the current exceeds 0.5 A or you run on batteries, pick a buck converter.
In this guide you will learn how both designs work, do the efficiency and heat math with real numbers, understand dropout and noise, and see which regulator to choose for Arduino, ESP32, Raspberry Pi Pico and servo projects. At the end, short sketches measure your board's supply voltage under load so you can test whether your regulator is running at its limit.

How does a linear regulator work?
Inside a linear regulator there is a voltage reference, an error amplifier and a power transistor in series between input and output. The amplifier keeps comparing the output with the reference and opens or throttles the transistor like an adjustable resistor, so the output stays at 5 V whether the input is 7 V or 12 V. Two important consequences follow. First, the input current equals the load current (plus a few mA of quiescent current). Second, the voltage left across the transistor, multiplied by the current, turns straight into heat: P = (Vin − Vout) × I. That is why efficiency depends only on the voltage ratio: η ≈ Vout / Vin. A 7805 making 5 V from 12 V is about 42% efficient no matter the current.
How does a buck (switching) converter work?
A buck converter switches its input on and off with a switch (a MOSFET or transistor) tens of thousands to millions of times per second. While the switch conducts, current flows through an inductor to the load and the inductor stores energy; when the switch opens, the inductor keeps delivering that energy to the load through a diode (or a second MOSFET). The output capacitor smooths the pulses. The output voltage is set by the fraction of time the switch conducts, the duty cycle: roughly D = Vout / Vin. Since the switch is either fully on or fully off, very little power is lost in it; the losses come from the switch resistance, the inductor resistance and the transitions. The key point: a buck converter transfers power, not current. An 85% efficient buck delivering 5 V at 1 A from 12 V draws only about 0.49 A from the input, while a linear regulator doing the same job draws the full 1 A.

7805, AMS1117, LM2596 and MP1584 compared
| Feature | 7805 | AMS1117-3.3 | LM2596 module | MP1584 module |
|---|---|---|---|---|
| Type | Linear | Linear (LDO) | Buck, 150 kHz | Buck, 100 kHz–1.5 MHz |
| Input voltage | 7–35 V | 4.4–15 V | 4.5–40 V | 4.5–28 V |
| Output voltage | Fixed 5 V | Fixed 3.3 V (other versions exist) | 1.23–37 V adjustable | 0.8–25 V adjustable |
| Maximum current | 1.5 A (with heatsink) | 1 A (limited by heat) | 3 A (about 2 A without heatsink) | 3 A (about 1.5–2 A continuous) |
| Dropout voltage | About 2 V | About 1.1 V (1.3 V max) | About 1.5–2 V | About 1 V |
| Efficiency | Vout / Vin (12→5 V: 42%) | Vout / Vin (5→3.3 V: 66%) | 75–90% | 80–92% |
| Quiescent current | About 5 mA | About 5 mA | About 5 mA (+ module LED) | About 0.1 mA |
| Output noise | Very low | Very low | Tens of mV of ripple | Tens of mV, at a higher frequency |
| Size | TO-220, may need a heatsink | SOT-223, very small | About 43 × 21 mm | About 22 × 17 mm |
Efficiency and heat calculation table
The table below shows how much power each design wastes in six common scenarios. Linear loss is (Vin − Vout) × I; buck loss assumes 85% efficiency and is Pout × (1 / 0.85 − 1). The buck's input current is Pout / (0.85 × Vin), which matters most for battery life and for choosing a power adapter.
| Scenario | Output power | Linear: loss, efficiency | Buck loss (85%) | Buck input current | Linear OK? |
|---|---|---|---|---|---|
| 9 V → 5 V, 0.2 A (Uno + sensors) | 1.0 W | 0.8 W, 56% | 0.18 W | 0.13 A | Yes, runs warm |
| 12 V → 5 V, 0.5 A (relays, LEDs) | 2.5 W | 3.5 W, 42% | 0.44 W | 0.25 A | Only with a large heatsink |
| 12 V → 5 V, 2 A (servos) | 10 W | 14 W, 42% | 1.8 W | 0.98 A | No |
| 5 V → 3.3 V, 0.25 A (ESP32 Wi-Fi) | 0.83 W | 0.43 W, 66% | 0.15 W | 0.19 A | Yes (AMS1117) |
| 12 V → 3.3 V, 0.25 A (ESP32) | 0.83 W | 2.2 W, 28% | 0.15 W | 0.08 A | No, the SOT-223 overheats |
| 24 V → 5 V, 1 A | 5 W | 19 W, 21% | 0.88 W | 0.25 A | No |
How hot the loss makes the chip follows from Tj = Tambient + P × θJA, where θJA is the junction-to-air thermal resistance. A 7805 in a TO-220 package without a heatsink has a θJA of about 50–65 °C/W; an AMS1117 in SOT-223 sits around 60–90 °C/W depending on the copper area under it. With a safe junction limit of about 125 °C, a bare 7805 in a 25 °C room can dissipate at most (125 − 25) / 65 ≈ 1.5 W; from a 12 V input that is only 1.5 / 7 ≈ 210 mA. The 3.5 W of the 12 V → 5 V, 0.5 A scenario would push a bare chip above 250 °C on paper; in practice it hits thermal shutdown long before. A medium 10 °C/W heatsink with thermal paste brings the total thermal resistance to about 16 °C/W and keeps the chip at 25 + 3.5 × 16 ≈ 81 °C. For the AMS1117, using the worst case of 90 °C/W, the limit is about 1.1 W: you can draw 650 mA going from 5 V to 3.3 V, but only about 125 mA going from 12 V to 3.3 V.
What are dropout voltage and an LDO?
A linear regulator can only hold its output if the input stays a certain amount above it; that gap is the dropout voltage. On the classic 7805 it is about 2 V at 1 A, so 5 V out needs at least 7 V in. When a dying 9 V battery sags to 6.5 V, the 7805 output falls to roughly 4.5 V. LDO (low dropout) regulators shrink the gap: about 1.1 V on the AMS1117 and 0.1–0.3 V on modern LDOs. Dropout grows with current, so always read the datasheet value together with the current it was specified at.
| Regulator | Dropout | Max current | Quiescent current | Note |
|---|---|---|---|---|
| 7805 | About 2 V (at 1 A) | 1.5 A | About 5 mA | At least 7 V in for 5 V out |
| AMS1117-3.3 | About 1.1 V (1.3 V max at 800 mA) | 1 A | About 5 mA | At least 4.4 V in |
| AP2112K-3.3 | About 0.25 V (at 600 mA) | 600 mA | About 55 µA | Good pick for ESP32 and Li-ion |
| HT7333 | About 0.1 V (at low current) | 250 mA | About 4 µA | Too tight for Wi-Fi peaks |
| MCP1700-3302 | About 0.18 V (at 250 mA) | 250 mA | About 1.6 µA | For sleeping sensor nodes |
This table is critical for battery-powered ESP32 projects. A single 18650 Li-ion cell is 4.2 V when full, 3.7 V nominal and around 3.3 V when nearly empty. The AMS1117-3.3 needs at least 4.4 V to regulate, so it is in dropout from the very first minute: the 3.3 V rail sits about 1.1 V below the battery and the ESP32 resets with a brownout error as soon as Wi-Fi starts. The fix is an LDO with about 0.25 V dropout that can deliver at least 500 mA (such as the AP2112K-3.3) or a buck-boost converter. To charge the cell safely, see the TP4056 charger module guide.
Noise and ripple
The big advantage of linear regulators is a clean output: they do not switch, so there is very little noise at the output, and they also reject part of the ripple at their input. A buck converter's output carries tens of millivolts of ripple at the switching frequency (150 kHz on the LM2596) plus short spikes at every transition. That is no problem for digital logic, Wi-Fi or motors. But if you take precise ADC readings, use a microphone or an audio amplifier, or hear hiss from an MP3 module, this ripple is very often the cause.
- Buck + LDO: step 12 V down to 5 V with a buck, then make the sensitive 3.3 V rail with an LDO such as the AMS1117. You keep most of the efficiency and still get a clean output.
- LC filter: add a 10 µH inductor in series with the buck output followed by a 100 µF capacitor. Its cutoff is 1 / (2π√(LC)) ≈ 5 kHz, which in theory attenuates 150 kHz ripple by about 900 times.
- Keep capacitors close: place an electrolytic (100 µF) and a ceramic (100 nF) capacitor in parallel at the input and output of every module; the closer to the load, the better.
- Plan the ground path: route the high-current return of motors and regulators separately from the sensor ground and join them at one point; the common ground guide explains why.
- Average in software: averaging several ADC readings removes much of the remaining noise.
Which one for which project? Arduino, ESP32 and servos
| Situation | Recommendation | Why |
|---|---|---|
| Arduino Uno, a few sensors, 9 V adapter | The onboard linear regulator is enough | 9 V → 5 V at 100 mA wastes only 0.4 W |
| Arduino + relays, LED strip or motors, 12 V adapter | Make 5 V with an LM2596 or MP1584 and feed the 5V pin | The onboard regulator overheats above 200 mA at 12 V |
| ESP32 dev board on USB or 5 V | The onboard AMS1117 is enough | 1.7 V × 0.25 A ≈ 0.43 W, runs warm |
| ESP32 on a 12 V or 24 V supply | Buck to 5 V first, then the onboard AMS1117 | Going straight from 12 V to 3.3 V wastes over 2 W |
| ESP32 + a single 18650 Li-ion cell | A low-dropout LDO such as the AP2112K-3.3, or a buck-boost | The AMS1117 cannot regulate below 4.4 V |
| One or more servos (SG90, MG996R) | Adjustable buck set to 5–6 V, at least 1 A per servo | At start-up an SG90 draws about 0.7 A, an MG996R up to 2.5 A |
| Precise analog measurement, audio | Linear regulator, or buck + LDO + LC filter | Buck ripple disturbs the ADC and audio |
| Battery sensor that sleeps for months | LDO with microamp quiescent current (MCP1700) | The AMS1117's 5 mA quiescent current drains a 2000 mAh cell in about 16 days |
In servo projects the real problem is not the average current but the start-up current: an MG996R can draw up to 2.5 A when it starts moving under load, and if four servos start together the supply briefly sees 5–10 A. A 7805 cannot handle that surge, its output collapses and the Arduino resets. Feed the servos from a separate buck rail, put a 470–1000 µF electrolytic at the start of that rail and tie the servo ground to the Arduino ground. For many servos, a PCA9685 servo driver plus a 5 A buck module is a solid pair, and most servo jitter problems disappear with this power layout.
ESP32 and AMS1117: powering it right
Most ESP32 dev boards carry an AMS1117-3.3 that drops 5 V (from USB or the VIN pin) to 3.3 V. The ESP32 draws 80–150 mA on average, but Wi-Fi transmission causes peaks of 300–500 mA lasting a few milliseconds. On USB this is fine; from 5 V to 3.3 V the loss stays below 1 W even during peaks. Trouble starts when the VIN pin gets 9–12 V: the AMS1117 gets very hot and approaches its 15 V absolute maximum. If you use an AMS1117 in your own circuit, put 10 µF at its input, at least 22 µF at its output and an extra 100 µF right next to the ESP32. The sketch below measures the battery through a voltage divider when the ESP32 runs from a single Li-ion cell and calculates whether the regulator has dropped out.
1// ESP32: pil gerilimi ve regülatör payı / battery voltage and regulator headroom
2// Bölücü: pil+ -> 100k -> GPIO 34 -> 100k -> GND (Vpil / 2) / divider gives Vbat / 2
3
4const int BAT_PIN = 34; // yalnız giriş, ADC1 / input only, ADC1
5const float DIVIDER = 2.0; // 100k + 100k
6const float VOUT = 3.3; // regülatör çıkışı / regulator output
7const float DROPOUT = 1.1; // AMS1117; AP2112K için 0.25 / use 0.25 for AP2112K
8
9float readBattery() {
10 uint32_t sum = 0;
11 for (int i = 0; i < 32; i++) {
12 sum += analogReadMilliVolts(BAT_PIN); // kalibre edilmiş mV / calibrated mV
13 }
14 return sum / 32.0 / 1000.0 * DIVIDER; // pil gerilimi, V / battery voltage, V
15}
16
17void setup() {
18 Serial.begin(115200);
19}
20
21void loop() {
22 float vbat = readBattery();
23 float headroom = vbat - (VOUT + DROPOUT); // pozitifse regülasyon var / positive = regulating
24 Serial.printf("Pil / battery: %.2f V pay / headroom: %+.2f V\n", vbat, headroom);
25 if (headroom < 0) {
26 // düşüşte: 3V3 hattı pili takip eder / in dropout: the 3V3 rail follows the battery
27 Serial.printf("Dususte, 3V3 yaklasik / in dropout, 3V3 about %.2f V\n", vbat - DROPOUT);
28 }
29 delay(2000);
30}The 100 kΩ + 100 kΩ divider draws only about 21 µA from the battery; a 100 nF capacitor across the ADC input makes the readings steadier. analogReadMilliVolts() uses the ESP32's factory calibration, so it is more accurate than analogRead(). When the headroom turns negative, the regulator is no longer regulating and the 3.3 V rail simply follows the battery down; the symptoms and fixes for brownout resets are in the ESP32 brownout guide. For sleeping projects, count the regulator's quiescent current too: in deep sleep the ESP32 chip draws about 10 µA, while an AMS1117 alone burns 5 mA.
Measuring the supply on an Arduino: is the regulator at its limit?
The ATmega328P on the Arduino Uno can measure its own supply voltage (VCC) without any external parts. You read its internal reference of about 1.1 V while using the supply as the ADC reference: the lower VCC gets, the larger the reading. With this trick you can see how far the 5 V rail sags when a 9 V battery runs down, a servo starts or the USB cable is weak.
1// Arduino Uno: kendi besleme gerilimini ölç / measure its own supply voltage
2
3long readVccMillivolts() {
4 // Referans AVcc, giriş dahili 1,1 V / reference AVcc, input internal 1.1 V
5 ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
6 delay(2); // referans otursun / let the reference settle
7 ADCSRA |= _BV(ADSC); // ölçümü başlat / start conversion
8 while (bit_is_set(ADCSRA, ADSC)); // sonucu bekle / wait for the result
9 long raw = ADC;
10 return 1125300L / raw; // 1,1 x 1023 x 1000 / 1.1 x 1023 x 1000
11}
12
13long minVcc = 99999;
14
15void setup() {
16 Serial.begin(9600);
17}
18
19void loop() {
20 long vcc = readVccMillivolts();
21 if (vcc < minVcc) minVcc = vcc; // en düşük değeri sakla / keep the lowest value
22 Serial.print("VCC: ");
23 Serial.print(vcc);
24 Serial.print(" mV en dusuk / lowest: ");
25 Serial.print(minVcc);
26 Serial.println(" mV");
27 if (vcc < 4600) Serial.println("Besleme dusuk / supply low");
28 delay(500);
29}The internal reference varies from chip to chip between 1.0 and 1.2 V. For better accuracy, measure VCC with a multimeter and recalculate the constant: new constant = 1125300 × VCC on the multimeter / VCC shown by the sketch. While the sketch runs, move the servo or click the relay: if the lowest value drops below 4.6 V, there is a weak link in your power chain. An Uno often keeps running below 4.5 V, but it leaves the safe range for 16 MHz, analog readings drift and 5 V sensors start to read wrong.
Raspberry Pi Pico: the onboard buck-boost and PWM mode
The Raspberry Pi Pico has no linear regulator; the onboard RT6150 is a buck-boost converter that turns a VSYS voltage between 1.8 and 5.5 V into 3.3 V. That is why a Pico runs from two AA cells (3 V), from USB (5 V) or from a single Li-ion cell. To be efficient at light load, the converter runs in PFM (pulse frequency modulation) mode by default, which means more ripple on the 3.3 V rail and more noise in ADC readings. Set GP23 HIGH and the converter switches to continuous PWM mode: it uses a little more current at light load, but the ripple drops noticeably. Keep external loads on the Pico's 3V3 pin below roughly 300 mA.
1from machine import ADC, Pin
2import time
3
4ps = Pin(23, Pin.OUT) # RT6150 güç tasarruf pini / RT6150 power-save pin
5sensor = ADC(26) # GP26: pot orta ucu / pot wiper
6vsys = ADC(29) # GPIO29 = VSYS / 3 (yalnız Pico / Pico only)
7
8def noise_mv(adc, n=500):
9 lo, hi = 65535, 0
10 for _ in range(n):
11 v = adc.read_u16()
12 lo = min(lo, v)
13 hi = max(hi, v)
14 return (hi - lo) * 3300 / 65535 # tepe-tepe gürültü, mV / peak-to-peak noise, mV
15
16def vsys_volts(n=32):
17 total = 0
18 for _ in range(n):
19 total += vsys.read_u16()
20 return total / n * 3.3 / 65535 * 3 # 3:1 bölücü / 3:1 divider
21
22for mode, name in ((0, "PFM"), (1, "PWM")):
23 ps.value(mode) # 0 = verimli PFM, 1 = sakin PWM / 0 = efficient PFM, 1 = quiet PWM
24 time.sleep_ms(100)
25 print("%s VSYS = %.2f V ADC gurultu / noise = %.1f mV" % (name, vsys_volts(), noise_mv(sensor)))Run the code with a potentiometer wiper on GP26 and compare the peak-to-peak noise in both modes. In PWM mode the noise usually drops noticeably; for precise measurement projects, setting GP23 HIGH at the top of your program is all it takes. On the Pico W, GPIO29 is shared with the wireless chip, so VSYS is read differently; the VSYS part of this code only applies to the Pico.
Common mistakes and fixes
| Symptom | Likely cause | Fix |
|---|---|---|
| The regulator is too hot to touch and the device shuts down after a few minutes | (Vin − Vout) × I is too large for a linear regulator, thermal shutdown kicks in | Lower the input voltage, add a heatsink or switch to a buck converter |
| ESP32 reboots when Wi-Fi starts | Regulator in dropout, thin wires or not enough capacitance | Check the input is at least 4.5 V, add 100 µF on the 3.3 V rail, use short thick wires |
| ESP32 or sensor died when the buck module was connected | The trimmer was not set, output was close to the input voltage | Adjust the module with no load using a multimeter, then connect the load |
| 7805 gives 4.3 V instead of 5 V | Input below 7 V (battery running low or weak adapter) | Measure the input; use an LDO or buck for low inputs |
| ADC readings jump around, audio hisses | Buck ripple and the shared ground path | Buck + LDO, LC filter, separate analog ground |
| Battery dies within days even in sleep mode | Regulator quiescent current and the module LED | Use a microamp-quiescent LDO, remove the power LED |
| Arduino resets when the servo moves | Servo start-up current collapses the 5 V rail | Feed the servo from a separate buck rail, add 470–1000 µF, join the grounds |
Checklist before you buy
- Input range: compare your highest input voltage (adapters read a bit higher with no load) with the regulator's limit: 15 V for the AMS1117, 28 V for the MP1584, 40 V for the LM2596.
- Real current: add up peak currents, not averages: ESP32 Wi-Fi 0.5 A, each servo 0.7–2.5 A, a relay coil 70–90 mA.
- Dropout margin: on batteries, even the lowest battery voltage must stay above output + dropout.
- Heat: do the (Vin − Vout) × I math; plan a heatsink for anything above 1 W on a linear regulator.
- Noise: with analog measurement or audio, add an LDO or an LC filter after the buck.
- Need to step up? If the output is higher than the input (5 V from a 3.7 V cell), you need a boost converter such as the MT3608, not a buck.
In short, a linear regulator is simple, quiet and cheap but turns excess voltage into heat, while a buck converter moves energy efficiently at the price of some noise. The voltage gap, the current, batteries and your noise needs decide the right choice. For wiring details, see the 7805, AMS1117 and LM2596 guides. In the BlueGrays app you can build projects such as a digital voltmeter, ESP32 deep sleep battery saving and a multi-servo animation step by step, with circuit diagrams that show the power wiring and the full code.
Frequently asked questions
Is a linear regulator or a buck converter better?
Each is better for a different job. With a small voltage drop and low current (say 5 V to 3.3 V at 200 mA), a linear regulator is simpler, cheaper and quieter. With a large drop, more than 0.5 A or battery power, a buck converter at 80–92% efficiency runs far cooler and makes the battery last much longer.
Why does my AMS1117 get so hot?
The AMS1117 turns the excess voltage into heat, and the power it burns is (Vin − Vout) × current. Drawing 250 mA from 12 V down to 3.3 V wastes 2.2 W, which a SOT-223 package cannot shed without a heatsink. Step the input down to 5 V with a buck module first and the loss falls to about 0.4 W.
Can I replace a 7805 with an LM2596?
Yes, in most projects an LM2596 module can replace a 7805 and runs much cooler. Before connecting anything, set the output to 5 V with the trimmer and no load, because modules can ship at a different voltage. In precise analog or audio circuits you may need an LC filter or an LDO to clean up the ripple.
Can I run an ESP32 from an 18650 cell through an AMS1117?
It is not recommended. The AMS1117-3.3 needs about 4.4 V to regulate, while a full Li-ion cell is only 4.2 V, so it is in dropout from the start and the ESP32 resets with a brownout during Wi-Fi peaks. Use an LDO with about 0.25 V dropout, such as the AP2112K-3.3, or a buck-boost converter.
What does dropout voltage mean?
It is the minimum amount by which the input must exceed the output for a linear regulator to keep the output steady. It is about 2 V for the 7805, about 1.1 V for the AMS1117 and 0.1–0.3 V for modern LDOs. If the input falls below that margin, the output simply follows the input down.
Does a buck converter mess up Arduino analog readings?
It can. A buck output carries tens of millivolts of ripple at the switching frequency, which can make precise ADC readings wobble by a few counts. Adding an LDO or LC filter after the buck, placing capacitors close to the load and averaging several readings solves most of it.
Projects to build after reading this
See all projects
Digital Voltmeter with LCD Display
Find out how much voltage a battery or power adapter gives with a meter you built yourself.

ESP32 Deep Sleep — Battery Saving (OLED + RTC RAM Counter)
The ESP32's Deep Sleep mode shuts down the CPU and most peripherals, cutting current draw to about 10µA, which is vital for battery-powered IoT devices. This project uses three wake-up sources: a timer (15 s), an external pin (EXT0, the button on GPIO 33) and a touch pin (T0/GPIO 4). Counters marked with RTC_DATA_ATTR survive deep sleep.

Servo Circle Choreography - Animated Patterns with 32 Servos
A visual animation project driven by 32 servo motors arranged in a circle on an Arduino Mega. The servos are managed in a single array, connected to the Mega's pins 22–53, and perform four motion sequences: a chaotic jitter at random angles, a synchronized sweep, a wave travelling around the circle and a compass needle swinging left and right.

ESP32 Servo Motor (Potentiometer Control)
In this project, we control an SG90 servo motor using a potentiometer. We adjust the servo angle by mapping the analog value read from the potentiometer to the 0–180-degree range. The ESP32Servo library generates servo signals on suitable output-capable GPIO pins of the ESP32; this project uses GPIO 18. This is a fundamental control method for robotic arms, camera gimbals, and automatic door mechanisms.

ESP32 Wi-Fi STA Connection (with LCD Screen)
In this project, we connect the ESP32 to the home Wi-Fi network in Station (STA) mode in a secure, fault-tolerant manner. We store the SSID and password in a separate secrets.h file to prevent leaking to Git, set up an auto-reconnect mechanism, and display the RSSI signal level and IP address on an I2C LCD screen. The internal LED works as a status indicator. It is a production-grade connection manager.

Bluetooth Controlled Car with L298N
Turn your phone into a remote and drive your own robot car. The Arduino receives commands from a remote-control app on your phone through a Bluetooth module and spins the wheels with a motor driver…

Using a Servo Motor
The arm of a small servo motor turns to three positions in turn: all the way to the start, right to the middle and all the way to the end, waiting two seconds at each stop.
More articles
BlueGrays app
Build this circuit step by step on your phone
Wiring diagram, code and parts list on one screen. 500+ Arduino, ESP32, ESP8266, Pico, mBot and micro:bit projects ready to build.
Scan with your phone
Point your camera at the code and your phone's app store opens.
or open the store

