⏱ In 60 Seconds
- Budget 60mA per LED for WS2812B at full white. That is the worst case and the only number you should design against.
- Divide by 0.8 for headroom. A 60-LED strip needs 3.6A on paper, so buy a 5V 5A supply — not a 5V 4A one.
- Never power the strip from the ESP32. The datasheet caps a GPIO at 40mA source. A single LED can exceed that.
- Tie the strip's ground to the ESP32's ground. A floating ground is what corrupts the data signal.
Bottom line: current, not code, kills LED builds. Do this multiplication before you buy anything.
There is a specific failure mode that sends beginners back to the bench again and again. The strip works on the desk, powered from a USB port. You move it to its permanent home, plug in the wall adapter that came with something else, and now the first thirty pixels flicker while the rest stay dark — or the whole thing resets when you switch colours.
Nothing about the strip changed. What changed is the current available. This guide is the arithmetic that decides whether your build works, so you can do it once on paper instead of three times on the bench.
What Is Ohm's Law and Why Does It Decide This?
Three quantities describe a resistive circuit, and they are linked by one equation:
I = current (amps, A) — how much charge actually flows
R = resistance (ohms, Ω) — how much the load opposes flow
V = I × R and its two rearrangements:
I = V / R · R = V / I
Power is a separate relation from Ohm's law, and it is the one that sizes a supply:
P = V × I
The part that matters here is power — the rate at which energy is consumed, measured in watts. Multiply voltage by current and you get the supply size you need. That is the whole calculation. The reason projects fail is that people match the voltage and ignore the current — the current is printed on the box too, but it is the number people skip.
The misconception that causes this failure
A "5V 2A" adapter and a "5V 5A" adapter both say 5V. The sticker tells you the pressure, not how much current it can deliver. A load asking for more current than the source can supply cannot get it — the voltage collapses, and the microcontroller on the other end of the wire sees a brownout and reboots.
How Much Current Does One WS2812B LED Actually Draw?
A WS2812B is three independent LEDs (red, green, blue) plus a control IC in one 5050 package. Each colour channel is rated at 20mA. At full white all three channels run at once:
60mA × 30 LEDs = 1.8A
60mA × 60 LEDs = 3.6A
60mA × 120 LEDs = 7.2A (a 2m strip at 60 per metre)
That 60mA figure is the worst case and it is the only number worth designing against. Real usage depends mostly on your effect: a slow colour fade sits near a fifth of it, and a solid blue at full brightness uses about a third. Size for the worst case and your build is quiet under every scene you later create — which includes the ones you have not written yet.
The WS2812B runs on a supply between 3.5V and 5.3V, so 5V is the correct choice and gives you the full brightness range.
Why Does a Strip That Works on USB Fail on a Wall Adapter?
A laptop USB port supplies 500mA on USB 2.0 and 900mA on USB 3.x. A phone charger that advertises its output manages 2A. A cheap unbranded wall adapter manages about 1A before its voltage sags.
So a 30-LED strip drawing 1.8A will run on a 2A phone charger and fail on a 1A wall adapter — which is exactly why the same build appears to work on your desk and then fails on the wall. The charger was the more capable supply all along. Current is set by the source, not negotiated by the load: a strip draws what it needs until the source runs out.
| LED count | Current at full white | Minimum 5V supply |
|---|---|---|
| 30 | 1.8A | 5V 3A |
| 60 | 3.6A | 5V 5A |
| 120 (2m strip) | 7.2A | 5V 10A |
| 300 | 18.0A | Inject power — do not run from one end |
Why Do You Divide by 0.8 Instead of Buying the Bare Minimum?
A supply rated 5V 4A is designed to deliver 4A, but running it continuously at its nameplate current keeps its internals hot and shortens its life. Industry practice is to design to about 80% of the rated figure so the supply stays thermally comfortable.
60 LEDs: (60 × 0.060) ÷ 0.8 = 4.5A → buy 5V 5A
30 LEDs: (30 × 0.060) ÷ 0.8 = 2.25A → buy 5V 3A
This is the step beginners skip, and it is the difference between a supply that lives and one that runs hot and shuts down.
The rule of thumb
LED count × 0.075A = the supply size to buy. The 0.075 already includes your 20% headroom, so a 60-LED strip gives 60 × 0.075 = 4.5A, and you buy the next size up.
Can You Power an LED Strip From the ESP32 GPIO?
No. The ESP32 datasheet is explicit, and it is worth reading the actual figures rather than guessing.
Two things follow. First, 40mA is less than one full-white LED at 60mA — so even a single pixel can exceed the pin limit, let alone a strip. Second, the datasheet notes that per-pin current in the same power domain is gradually reduced from about 40mA toward 29mA as the number of sourcing pins in that domain increases — so several outputs sharing one power domain is the case to watch, not two loads on a single pin.
The mistake that destroys boards
Connecting a strip's power line to a GPIO is one of the fastest ways to destroy an ESP32. The pin is designed to signal a load, not to feed it. The data line is what the GPIO touches — that is all. Power goes from the supply to the strip directly, sharing a common ground only.
This is worth stating plainly because "it worked for a while" is the normal story: the pin heats, the protection circuits struggle, and the board fails weeks later rather than immediately.
How Do You Wire It So It Actually Works?
Three connections, and the third one is the one people get wrong.
GND → strip GND pin (shared with ESP32 GND)
DATA → ESP32 GPIO (through a 330Ω resistor, 3.3V logic — see below)
That shared ground is not optional. The data signal is a voltage relative to ground. If the strip's ground floats above the ESP32's, the ESP32 transmits a logic high that the strip reads as a logic low, and pixels latch garbage. The far end going dark is a different fault entirely: a pixel that does not receive enough current cannot re-shape and pass data onward, so every pixel behind it stays unlit.
Join the two grounds at a single point, near the power supply, with a wire thick enough to carry the return current. On a long run, the ground return is as important as the supply line; thin wire here causes the exact voltage drop you were trying to avoid.
Add a 330Ω resistor in series with the data line. It damps signal reflections on the longer runs where the WS2812B's own 5m point-to-point reach matters, and it limits the current that can flow into the strip's data input.
There is a voltage mismatch worth understanding, because it causes the same "first pixels are wrong" symptom as a bad ground. The ESP32 GPIO is 3.3V logic: its guaranteed high output is 0.8 × VDD, about 2.64V. The WS2812B specifies its input high threshold as 0.7 × VDD — which is 3.5V when the strip runs at 5V. A bare 3.3V output is therefore below the strip's stated input threshold.
Short runs usually work in practice, because the WS2812B's input is CMOS and the actual switching point sits below the worst-case figure. On longer runs, noisy supplies, or a marginal 3.3V rail it does not, and pixels latch garbage. The robust fix is a buffer that translates 3.3V up to 5V logic — a 74AHCT125 or similar level shifter is the standard part for this, and it costs almost nothing.
Add a fuse in the supply line, sized at roughly 1.25× the current the run is expected to carry per segment. A short across a 5V 10A or 18A supply is a fire risk, and the WS2812B's reverse-connect protection does nothing for that. Cheap inline blade or automotive holders are the usual choice. Finally: the datasheet specifies 800kbps signalling and reliable cascading to 1024 pixels at 30fps, with any two points more than 5m apart needing additional circuitry. If your run is longer, you need a repeater rather than a longer wire.
What Are the Three Numbers That Decide a Build?
Every LED power problem reduces to three values, and if you have all three you need no other information:
- Total LED current — LED count × 60mA. This is your load.
- Supply rating with headroom — that figure ÷ 0.8, rounded up to a real product. This is your ceiling.
- GPIO limit — 40mA source on an ESP32. This is a constraint on the data line only, never a power path.
Get those three right and the build is solved before you solder anything. Get them wrong and no amount of code will rescue it.
How Does This Fit Into Mechatronic System Design?
The calculation above is a special case of a much older idea, and it is worth knowing because it changes how you reason about the whole project.
Engineering treats every physical domain — electrical, thermal, mechanical — with the same pair of quantities. Janschek calls them generalised effort (the potential-driving quantity, like voltage) and generalised flow (the transported quantity, like current). Their product is power, and their integral is energy, and because the underlying conservation laws have the same structure in every domain, one formalism describes all of them. In his words, these definitions let you build a largely domain-independent axiomatic structure, completed by domain-specific constitutive equations at specific points.
For an LED build that means: the same multiplication that sizes a power supply also tells you how much heat the strip must dissipate, and how fast the copper or the adhesive has to move it away. A 7A draw at 5V is 35W leaving the strip whether or not you feel it. Power is what crosses the boundary between domains; everything else is a consequence.
The same reasoning scales up. In mechatronic system design, the actuator, the sensor, and the controller are not three separate problems — they are one power flow arranged across physical layers, and the design question is always where the losses and limits sit. Janschek's own framing of the verification problem is the right attitude to bring to it: never trust your computer, however good the model is.
What Do People Ask About LED Strip Power?
Why does my LED strip only show the first 30 pixels?
Almost always insufficient current at the far end. The first pixels get enough voltage; the rest starve as current drops along the thin copper, and a starved pixel cannot pass data onward, so everything behind it goes dark. Test by injecting power at the far end of the strip: if the symptom disappears or retreats to the pixels nearest the injection point, it is a supply problem, not a data problem. If the near pixels are the wrong colour rather than dark, suspect the data level or a floating ground instead.
Do I need a resistor on the data line?
Yes, 330Ω in series between the ESP32 pin and the strip's data input. It damps signal reflections on longer runs and limits the current that can flow into the strip's data input. On a very short bench wire it will work without one, which is why the omission usually goes unnoticed until the run gets longer.
Can I power the strip from the same 5V that feeds the ESP32?
Yes, and it is the cleaner arrangement — but the supply still has to cover both loads combined. An ESP32 board draws 100–240mA, with short peaks near 500mA during Wi-Fi transmission, so a 60-LED strip needs 3.6A plus 0.24A for the board. That is 3.84A, and dividing by 0.8 gives 4.8A — so buy 5V 5A. Keep the strip's current out of the board's thin traces where you can.
Why do my colours look wrong — green where red should be?
The WS2812B transmits in GRB order, not RGB. If a hand-written sketch sends R, G, B in the wrong sequence, red and green swap. This is a data-order problem, not a wiring problem, and it is unrelated to supply voltage.
Why does the whole strip reset when I change colours?
A brownout. Drawing a large current step causes the supply to sag, the 3.3V rail on the ESP32 dips, and the board reboots. Slower colour transitions, a larger supply, or a capacitor across the supply terminals at the strip end all address it.
What Parts Do I Need, and What Does a Correct Setup Cost?
A working 60-LED build needs: a 5V 5A supply (about $12), a 60-per-metre WS2812B strip ($9 for 2m), an ESP32 board ($6), a 330Ω resistor (pennies), and a fuse holder plus fuse (about $2). Total $30 for a 60-LED run, and $0.50 per additional LED on longer strips. The two items beginners skip are the supply headroom and the fuse, and both are the ones that decide whether the build survives.
How Do You Measure the Real Current Instead of Calculating It?
Use a clamp meter on the supply wire, or a shunt, for anything above about 2A. Most handheld multimeters are rated to 10A for a short burst and will overheat on a sustained 7A or 18A load, and a USB power meter only applies to USB paths. Never exceed your meter's current range. Measure with the strip at full white — that is the number that matters, and it is often lower than the datasheet maximum but higher than the average during normal use.
Done-for-You Playbook
USB-C Power Supply Conversion — Builder's Guide
The current-budget method on this page scales to real builds: supply selection tables, derating rules, fuse sizing, and the client pricing model for turning dead adapters into working supplies. Skip the guesswork.
