DIY Electronics
— Building circuits, programming microcontrollers, and making things blinkSPI vs I2C — when to use which bus protocol
NeoPixel Patterns with FastLED
FastLED is the gold standard for WS2812B control on Arduino and ESP32. Here are the patterns and techniques that give the best results.
The EVERY_N_MILLISECONDS macro is essential for non-blocking animation timing. Using delay() in a NeoPixel sketch means you can't handle any other input while animating. Palette-based color animation (the CRGBPalette16 type) is far more flexible than hardcoded RGB colors — you can fade between entire palettes smoothly with nblendPaletteTowardPalette().
For large strips (100+ LEDs) on an ESP32, disable interrupts during the data write (FastLED.show()) to avoid glitches from WiFi interrupt service routines corrupting the tight timing. The FASTLED_INTERRUPT_RETRY_COUNT config option provides automatic retry if an interrupt fires mid-frame. Power budget: a WS2812B at full white draws 60mA. 100 LEDs at full white = 6A. Always calculate your PSU requirements and use a dedicated 5V rail, never power a long strip from the Arduino's onboard regulator.