How to Program Addressable LED Strips: WS2812B Patterns, Effects, and Power Design
Introduction
WS2812B addressable LED strips (also called NeoPixels) are one of the most visually impactful components in maker electronics. Each LED on the strip contains a tiny controller chip that lets you set its color and brightness individually using a single data wire. The result is stunning animations, ambient lighting, and interactive displays limited only by your imagination and power supply. This guide covers the complete WS2812B workflow: wiring, power calculations, the FastLED and Adafruit NeoPixel libraries, coding effects from simple fades to complex patterns, and solving common problems like voltage drop and signal degradation.
What You Need
- WS2812B LED strip (30, 60, or 144 LEDs per meter)
- Microcontroller (Arduino, ESP32, or Raspberry Pi Pico)
- 5V power supply (capacity calculated below)
- Capacitor 1000μF across power input
- Resistor 330-470Ω on data line
- Wire: 18 AWG for power, 22 AWG for data
Step 1: Power Calculations
WS2812B LEDs draw approximately 60mA at full white (20mA per RGB channel). Power scaling:
- 1 meter of 60 LED/m strip at full white: 60 × 0.06A = 3.6A at 5V = 18W
- 5 meter roll at full white: 300 × 0.06A = 18A at 5V = 90W
Rule of thumb: Size your power supply for 60% of max (you rarely run full white): 5m roll → 10A supply.
Step 2: Wiring
Basic Connection (Short Strip 50 LEDs)
Voltage drop is the #1 problem with LED strips. At 18 AWG, every meter of wire drops ~0.1V at 3A.
- Connect 5V and GND to BOTH ends of the strip
- For 5m+ strips: inject power every 2-2.5 meters
- Use thicker wire (16 AWG) for power runs
- All grounds must be common — never create ground loops
Signal Integrity
- Keep data wire short (
Related Guides
- Build a Word Clock: Laser-Cut Face, WS2812B LEDs, and ESP32
- I2C vs SPI vs UART: How to Choose and Use Serial Communication Protocols
- How to Use Sensors with Arduino and ESP32: Temperature, Distance, Load, Current, and Hall Effect
- How to Control Motors with Arduino and ESP32: Stepper, DC, and Servo Drivers
- ESP32: Setting Up for Arduino IDE
- Arduino vs ESP32: Which Should You Use? A Practical Comparison
- Getting Started with ESP32: GPIO, WiFi, and Your First Project
- I2C Wiring and Protocol Guide for Arduino, ESP32, and Raspberry Pi