Why Your LED Strip Flickers Because of WiFi Interference
You have an ESP32 driving a WS2812B LED strip. The LEDs work fine when your phone is across the room. When your phone is near the ESP32, the LEDs flicker. When you upload new code over WiFi, the LEDs go haywire. When the ESP32 connects to your router, the LEDs stutter.
This is not a power supply problem. This is not a code problem. This is electromagnetic interference from the ESP32's WiFi radio.
Understanding why will save you hours of debugging and one or two wrong replacement boards.
Why WiFi Causes LED Flickering
WS2812B LEDs use a single-wire communication protocol. Each LED latches the data it receives and passes the rest down the line. The timing is strict: a "0" bit is a short high pulse followed by a long low pulse. A "1" bit is a long high pulse followed by a short low pulse.
The WS2812B datasheet specifies these timing requirements with microsecond precision. Any deviation — caused by interrupts, clock stretching, or electrical noise — corrupts the data stream.
The ESP32's WiFi radio transmits in bursts at 2.4GHz. These bursts generate electromagnetic interference on nearby circuits. When the WiFi radio is active, it can introduce timing jitter into the ESP32's CPU clock, which affects the precision of the GPIO toggle that generates the WS2812B signal.
The result: your LEDs flicker when WiFi is active.

Photo by LED Architectural Machine project via Hackster.io — WS2812B LED strip
The Three Situations Where This Happens
Situation 1: Phone Near the ESP32
When your phone is idle and near the ESP32, it occasionally pings the WiFi network. Each ping causes a brief WiFi transmission burst. This introduces a microsecond-level timing error in the LED signal. With short LED strips (under 50 LEDs), this is usually imperceptible. With longer strips (over 100 LEDs), the accumulated timing errors cause visible flickering.
The fix: keep the phone away from the ESP32 and LED wiring during operation. If you need to control the LEDs from your phone, use a separate controller (another ESP32 or a dedicated LED controller) rather than the same ESP32 that drives the strip.
Situation 2: Code Upload Over WiFi
When you upload new code over WiFi (OTA update), the ESP32 spends several seconds handling the upload. During this time, it is executing WiFi-related code that disables interrupts and generates significant electromagnetic noise. The LED strip, which depends on precise interrupt timing for its data signal, goes haywire.
This is normal. The fix is to either: accept that LEDs will flicker during OTA uploads (and have them reset to a known state afterward), or temporarily set all LEDs to a solid color or off before starting an OTA update.
Situation 3: WiFi Connection Startup
When the ESP32 first boots and connects to WiFi, it goes through a multi-second negotiation process with the router. During this time, WiFi activity is high, and LED control is unreliable.
The fix: design your system so that the LED strip shows a known state (off, or a simple color) during startup, before WiFi connection is established. Add a WiFi.onEvent() handler to display a stable pattern only after WiFi is connected.
How to Isolate LED Signal from WiFi Noise
Method 1: Use a Level Shifter with a Clean Power Rail
The WS2812B expects a 5V data signal. The ESP32 outputs 3.3V. A level shifter converts the 3.3V signal to 5V. But not all level shifters are equal.
The TXS0108E is popular and cheap, but it uses push-pull output stages that can introduce their own timing noise. The 74HCT245 is a better choice for LED applications: it has consistent propagation delay regardless of VCC voltage, and it can source/sink more current.
Better yet: power the level shifter from the same 5V supply that powers the LED strip. This ensures the 5V signal used to drive the LEDs is referenced to the same ground as the LED strip.
Method 2: Add a 330Ω Resistor in Series with the Data Line
A small resistor between the ESP32 (or level shifter) and the LED strip's data input acts as a low-pass filter. It reduces the high-frequency noise coupling into the data line. This is the cheapest and simplest fix.
The value matters: too low (100Ω) provides little filtering. Too high (1kΩ) slows the signal rise time enough to cause timing errors at high data rates. 330Ω is the sweet spot for WS2812B at 800kbps.
Method 3: Separate the Power Domains
Keep the ESP32, level shifter, and LED strip power circuits physically separated. Do not share a common power supply if possible. The LED strip draws surges of current during color changes. These current surges can couple noise into the ESP32's power rail through shared wiring.
If you must share a power supply, use separate filtering: a ferrite bead or inductor on the ESP32's power line, after the LED strip's power branch.
The Diagnostic Test
Before trying any fixes, confirm that WiFi is actually the cause:
- Disconnect the ESP32 from WiFi entirely
- Run the same LED animation from a timer or button trigger
- If the flickering disappears, WiFi is your culprit
If the flickering persists without WiFi, the problem is power supply, grounding, or a marginal level shifter.
FAQ
Q: I switched to ESP32-S3 or ESP32-C6, which has better WiFi. Should the flickering stop?
A: Newer ESP32 variants have improved radio performance, but the fundamental issue remains: any microcontroller driving WS2812B LEDs with a single-wire protocol is vulnerable to timing disruption from any source that generates electromagnetic interference near the circuit. Better WiFi just means the connection is more stable, not that the LED signal is more immune. The fixes above still apply.
Q: Can I use FastLED or NeoPixelBus libraries instead of Adafruit_NeoPixel to reduce flickering?
A: The library matters less than you think. FastLED uses the same hardware-level GPIO toggling as Adafruit_NeoPixel. The difference is in how interrupts are handled during the data transmission. FastLED can disable interrupts for longer periods, which actually makes the LED signal more resistant to WiFi interference during transmission — but also makes the ESP32 less responsive to other events during that time. Neither library eliminates the root cause.
The Next Step
The next time your LEDs flicker, try this before replacing any components: add a 330Ω resistor in series with the data line. This is a $0.01 fix that eliminates 80% of WiFi-related flickering in most maker projects.
If that does not work, check your power supply with an oscilloscope or by temporarily powering the LEDs from a battery. Power problems are often misdiagnosed as WiFi problems.
Product recommendations:
ESP32 Dev Board — Stable USB-C WiFi+BT development board with better power isolation than the cheapest clones. (Amazon)
74HCT245 Level Shifter — Better for LED applications than the TXS0108E. Consistent timing, higher drive current. (Amazon)
WS2812B LED Strip (1m) — 60 LEDs/m, 5V, waterproof. Standard for maker projects. (Amazon)
I earn from qualifying purchases.
Article #008, 2026-04-18. Content Farm pipeline, Run #008.
Top comments (0)