An ESP32 that randomly resets. A sensor giving strange readings. Wi-Fi dropping out. In many cases the code is fine — the power supply is the problem.
A power supply delivers voltage. But a good power supply delivers the right voltage under all conditions — under peak current draw, under load, even when the cable isn't ideal.
Voltage and current: both matter
The voltage is on the label. The current is what the supply can deliver at maximum, and what your circuit draws at maximum. Those two need to match.
An ESP32 module draws maybe 80 mA on average, but every Wi-Fi transmission causes current spikes up to 500 mA. A USB adapter rated at 500 mA looks sufficient on paper, but the internal impedance plus cable resistance together cause a voltage drop right when the spike occurs. The board resets — cause not immediately obvious.
The same happens with relays, motors and displays. Measure voltage under load, not just at rest.
Linear regulator: simple and stable
A linear regulator converts the voltage difference between input and output into heat. Simple, clean output with low noise, but inefficient when the voltage difference is large.
The L7805CV from STMicroelectronics (5 V, 1.5 A, TO-220) is the classic choice for 5 V applications. Over 12,000 in stock. At a 9 V input and 1 A current, it dissipates 4 W — a heatsink isn't optional, it's required.

Switching regulator: efficient for serious current
A buck converter converts voltage with typical efficiency of 85–95%. Much less heat, suitable for higher currents or battery-powered use. The LM2574N-5G (0.5 A, 5 V fixed, DIP-8) from ON Semiconductor is a beginner-friendly switching regulator with external inductors and capacitors. Need more power? Look at the LM2576D2T-ADJ (3 A, adjustable).
USB adapters and cables
Not every USB adapter delivers what it says on the packaging. Cheap adapters have high internal resistance; thin cables add another 0.5 V or more on top. Use a short, thick cable — a good USB-C cable for fast charging is significantly better than a random Micro-USB cable from a drawer.
Decoupling: capacitors close to the load
Every IC and module board deserves decoupling capacitors close to the power pins: a 100 nF ceramic for high-frequency noise, a 10–100 μF electrolytic for slower fluctuations. They're cheap and prevent instability that would otherwise be hard to trace.
Practical approach
Calculate the total current draw of all your components combined. Add 30–50% margin. Choose a supply that can handle it. Measure voltage under load. And always use decoupling capacitors.