WS2812B ring (NeoPixel)
12 RGB LEDs, one wire for all
A ring of 12 "smart" RGB LEDs. Each LED has its own tiny chip, so you set the colour of each one individually, and all of them hang on ONE data wire.
Open the course →How it works
The ESP32 sends 24 bits per LED (8 green, 8 red, 8 blue) as precisely timed pulses. The first LED keeps its 24 bits and passes the rest on to the next one (DIN → DOUT), and so on. The Adafruit_NeoPixel library handles the timing for you: setPixelColor(i, colour) changes the colour in memory, and show() sends the whole strip.
Pins and wiring
| Pin | What it is | Where it connects / why |
|---|---|---|
| DIN | Data input | → GPIO (e.g. 13) through a 330 Ω resistor. |
| 5V (VCC) | Supply | → VIN (5 V). Each LED at full white takes up to 60 mA! |
| GND | Ground | → GND, shared with the ESP32. |
| DOUT | Output to the next ring | Not connected, unless you chain more LEDs. |
Specifications
LEDs12 × WS2812B (5050)
Supply5 V
Currentup to 60 mA per LED (white, full brightness)
Colours24-bit (16.7 million)
Data800 kHz, one wire
Tips and typical mistakes
- Limit the brightness (<code>setBrightness(40)</code>) — 12 LEDs at full white = 720 mA, too much for USB.
- A 330 Ω resistor in series with DIN protects the first LED; a 1000 µF capacitor across 5V/GND calms the supply.
- First LED flickers or all colours are wrong? Check NEO_GRB and the shared GND.