How to safely drive motors, servos, or NeoPixels without resets

If your ESP32 resets the moment a motor starts, a servo moves, or a WS2812/NeoPixel strip lights up, you're not “bad at code.” You're hitting the classic combo: current spikes + voltage sag + noise.

The three rules that prevent 90% of resets

  1. Separate power for the load. Motors/servos/LED strips get their own 5V supply sized for the load.
  2. Shared ground. Tie the grounds together so signals have a reference.
  3. Bulk capacitor near the load. For servos/NeoPixels, start with 1000µF across 5V/GND near the strip/servo rail.

NeoPixels (WS2812) specifics

  • Power first, data second. Don't hot-plug data into an unpowered strip.
  • Add a series resistor (typically 220-470Ω) on the data line near the first pixel.
  • Watch current math. A “small” strip can pull amps at full white.

Motors/relays specifics

  • Use a driver/transistor, not a raw GPIO pin.
  • Add a flyback diode for DC motors/relays (unless the driver already includes it).
  • Keep motor wiring away from your ESP32 signal wiring.

Servos specifics

  • Servos can pull big surge current at start and stall.
  • Power servos from a dedicated 5V rail and add bulk capacitance near the servo rail.

Quick test

If everything works when powered from a strong USB charger but fails on your “project supply,” your project supply/wiring is the problem.

Bottom line

High-current loads need their own supply, shared ground, and bulk capacitors. Fix power and wiring first and the “random” ESP32 resets usually disappear.

Related: Brownout detector reset · ESP32 reboots under load · External power safely