A normal RGB LED strip has three wires for colour, and every LED on it shows the same colour at the same time. A WS2812B strip is different: each tiny 5050 LED has its own controller chip built inside, so every pixel can show its own colour and brightness. You feed one data wire into the first pixel, and the pixels pass the information along the strip like a bucket brigade. The first pixel keeps its 24 bits of colour, passes the rest on, the second takes the next 24 bits, and so on to the end. This is what makes rainbow waves, chases, fire effects, scrolling text on matrices and music visualisers possible with a single pin on your Arduino or ESP32.
The same chip is sold under the name NeoPixel (Adafruit's brand) and is the engine behind most LED rings, matrices, sticks and strips. For you it means one thing: the code and wiring are the same whether you have a 30-LED strip or a 300-LED reel.
The WS2812B is easy to drive but unforgiving about three things: power, ground and the data signal level. Get those right and it just works. Get them wrong and you will meet flickering, wrong colours, a dead first pixel or a microcontroller that keeps resetting. This page walks through all of it: how the protocol works, how to size the power supply, power injection on long strips, the 3.3 V data problem on an ESP32, which library to choose, and a troubleshooting table. For wiring and code, see the Arduino Uno guide and the ESP32 guide.
WS2812B Strip at a glance
WS2812B in one paragraph. 5 V addressable RGB LEDs, one data wire, GRB colour order, about 60 mA per pixel at full white. Power the strip from its own 5 V supply (LEDs × 60 mA), join every ground, add a 1000 µF capacitor at the strip and a 330 to 470 Ω resistor in the data line, and feed the end marked DIN. An Uno drives the data line directly; an ESP32 should use a 74AHCT125 level shifter. Libraries: Adafruit NeoPixel (simplest) or FastLED (effects and a power limiter).
Specifications
- LED type
- WS2812B: 5050 RGB LED with the driver chip built into every pixel
- Supply voltage
- 5 V DC (about 3.5 to 5.3 V tolerated; 5 V is standard)
- Current per pixel
- Up to about 60 mA at full white (20 mA per colour); roughly 1 mA idle
- Colour depth
- 24-bit: 8 bits each for red, green and blue
- Data order
- GRB (green first), not RGB
- Data protocol
- Single-wire, about 800 kHz; each pixel keeps 24 bits and forwards the rest
- Bit timing
- 1.25 µs per bit: a 0 is a ~0.4 µs high pulse, a 1 is a ~0.8 µs high pulse
- Latch / reset
- Data held low for at least 280 µs (50 µs on older batches)
- Update time
- About 30 µs per pixel: 30 LEDs ≈ 1 ms, 144 LEDs ≈ 4.3 ms
- Logic high threshold
- About 0.7 × VDD, roughly 3.5 V at 5 V (marginal for 3.3 V logic)
- Strip densities
- 30, 60 or 144 LEDs per metre; IP30 (bare), IP65 (coated) or IP67 (tube)
- RAM per pixel
- 3 bytes on the microcontroller (100 LEDs use 300 of the Uno's 2,048 bytes)
From the WS2812B datasheet and the FastLED / Adafruit NeoPixel documentation. Strips vary by manufacturer: test yours and fuse the supply.
Pinout
| Pad | Name | Description |
|---|---|---|
| 1 | 5V | Power. Feed from a dedicated 5 V supply sized for the whole strip |
| 2 | GND | Ground, shared with the microcontroller and the supply |
| 3 | DIN | Data in, through a 330 to 470 Ω resistor. The arrow points away from this end |
| 4 | DOUT | Data out at the far end: feeds DIN of the next segment |
Strips have a direction. Small arrows printed on the strip show the way data flows: from DIN towards DOUT. Connecting your microcontroller to the DOUT end is the number one reason a brand-new strip does nothing. Pre-wired connectors are usually red = 5 V, white or black = GND and green = data, but colours vary, so trust the printed labels.
How the WS2812B protocol works
Each pixel holds a shift register and three constant-current drivers. The data you send is a stream of bits at about 800 kHz, and every bit lasts roughly 1.25 µs. The strip uses the length of the high pulse to decide what a bit means: a short pulse of about 0.4 µs is a 0, and a long pulse of about 0.8 µs is a 1. There is no clock wire, so the receiver relies entirely on that timing, which is why the protocol is so sensitive to anything that interrupts your code.
Each LED takes 24 bits: 8 for green, then 8 for red, then 8 for blue (the order is GRB, not RGB, which is why the library asks for a colour-order setting). The first pixel keeps the first 24 bits it sees, rebuilds the rest of the signal with fresh timing and sends it to the next one. That regeneration is why you can chain hundreds of pixels without the signal degrading, at least as long as the power holds up.
To latch the data, your board holds the line low for at least 50 µs. All the pixels then update at once. Some newer production batches need a longer reset time of around 280 µs, so libraries use a safe margin of about 300 µs. Here is what that means for speed:
| LEDs | Data time per frame | Maximum frame rate |
|---|---|---|
| 30 | ~0.9 ms | ~1000 fps |
| 60 | ~1.8 ms | ~500 fps |
| 144 | ~4.3 ms | ~230 fps |
| 300 | ~9 ms | ~110 fps |
On an 8-bit AVR such as the Uno, the processor has to produce those precise pulses itself, so the library turns interrupts off while it sends the data. During a 300-LED update that is 9 ms in which millis() can drift and Serial data can be lost. The ESP32 avoids the problem by using a hardware peripheral (RMT) that generates the pulses on its own while the CPU keeps working.
Powering the strip: the part everyone gets wrong
Power is the number one cause of failed LED projects. At full white, each WS2812B draws up to about 60 mA: 20 mA for each of its red, green and blue emitters. Most real animations average much less, perhaps a third of that, but you must design for the worst case, because at some point your code will light everything white.
| LEDs | Maximum current (full white) | Suggested supply |
|---|---|---|
| 8 | 0.5 A | USB (barely) |
| 30 | 1.8 A | 5 V 2–3 A |
| 60 | 3.6 A | 5 V 4–5 A |
| 144 | 8.6 A | 5 V 10 A |
| 300 | 18 A | 5 V 20 A+ |
The arithmetic is simply LEDs × 60 mA. Turning the global brightness down, which FastLED and NeoPixel both support, lowers the draw almost proportionally and also looks nicer in a dark room, where full white is painfully bright. FastLED also has a built-in power limiter, setMaxPowerInVoltsAndMilliamps(), that scales brightness so you never exceed the current you tell it, which is a very good safety net.
Several rules keep the strip happy:
- Use a separate 5 V supply for anything beyond about 8 pixels at low brightness. An Uno's 5 V pin through USB is limited to about 500 mA.
- Connect the grounds. The strip's GND, the supply's GND and the microcontroller's GND must all be joined, or the data line has no reference.
- Add a 1000 µF capacitor (6.3 V or higher) across the strip's 5 V and GND at the point where power enters. It absorbs the surge when the strip switches on.
- Add a 330–470 Ω resistor in series with the data line, close to the first pixel. It reduces ringing that can corrupt the first LED.
- Connect ground first and power last. Hot-plugging the strip with data connected can send a damaging voltage spike into the first pixel.
- Fit a fuse in the 5 V supply line, sized a little above the strip's maximum current. A short in a 20 A supply can melt wires.
- Use thick enough wire. Thin wire adds resistance and drops voltage. For several amps use 18 AWG or thicker for the supply runs.
Voltage drop and power injection
On a long strip the copper tracks have measurable resistance, so the voltage falls along the strip. At the far end, the LEDs see less than 5 V, and because blue and green LEDs need a higher forward voltage than red, they dim first. White turns yellow, then orange, then pink. That drift of colour towards red at the end of the strip is the classic sign of voltage drop.
The cure is power injection: feed the 5 V and GND from the supply to the strip at more than one point, so no pixel is far from a power connection. A common rule of thumb for a 60-LED-per-metre 5 V strip is to inject every 1 to 2 metres, or whenever the colour starts to shift. Only the data line must run through the chain. The power wires can join the strip anywhere.
If you still lose too much voltage on very long installations, a 12 V strip such as the WS2815 is a better choice, because the same power needs a lower current, which means less voltage drop.
Wiring the data line: the 3.3 V problem on ESP32
The WS2812B treats a data signal as high when it is above about 0.7 × VDD. At a 5 V supply that is roughly 3.5 V. An Arduino Uno outputs 5 V, which is fine. An ESP32 outputs only 3.3 V, which is just under the threshold. Many strips work anyway, especially with short wires and a clean supply, which is why you will find tutorials that skip the level shifter. But it is marginal. You may see random flicker, wrong colours or a first pixel that behaves strangely when the strip's supply is a little above 5 V.
The proper fix is a level shifter on the data line. A 74AHCT125 or 74HCT245 (or the single-gate 74AHCT1G125) accepts a 3.3 V input as a valid high and outputs a clean 5 V signal. It must be an AHCT or HCT part. A plain 74HC chip powered at 5 V will not recognise 3.3 V as high. Bi-directional MOSFET level-shifter boards made for I²C often struggle at 800 kHz, so a proper buffer chip is the better choice.
Choosing a library: NeoPixel or FastLED
There are two popular libraries, and both work well with the WS2812B.
Adafruit NeoPixel is the simplest. You create a strip object, set a pixel with setPixelColor(index, r, g, b) and push the data out with show(). It is perfect for first projects and small effects, and it is well documented.
FastLED is the bigger toolbox. It adds colour-correction, HSV colour maths, palettes, built-in effects such as rainbow fills and noise, fast integer math, a power limiter and support for dozens of LED chips. It is a better choice for animations, music-reactive projects and any strip you want to run safely at a limited current. It works on the Uno and has good ESP32 support, so keep it up to date for new ESP32 core versions.
The Uno guide starts with NeoPixel for a first test and moves to FastLED for animations; the ESP32 guide uses FastLED throughout, and also covers WLED, a ready-made firmware that needs no code at all.
Timing, interrupts and the ESP32 advantage
Because the strip has no clock wire, every bit must arrive at precisely the right time. On an Arduino Uno the library disables interrupts for the whole update. For a 30-pixel strip that is under a millisecond and you will never notice. For 300 pixels it is 9 ms per frame, during which millis() can lose time, incoming serial data can be dropped, and IR receivers or servo libraries that rely on interrupts can misbehave. Keep strips short on an Uno, update only when something changes, and avoid mixing them with timing-critical interrupt code.
The ESP32 has a hardware peripheral called RMT that generates the signal without involving the CPU, so interrupts and Wi-Fi keep running. This is why an ESP32 can show an animation and serve a web page at the same time. If your project uses Wi-Fi, use a library version that supports the RMT driver, and keep it updated.
Memory is the other limit. Every pixel needs 3 bytes of RAM, so 300 pixels use 900 bytes. On an Uno with 2 KB of RAM that leaves very little for the rest of the program. If you want large installations, use an ESP32.
WS2812B and its relatives
WS2812B
- Voltage
- 5 V
- Data line
- Single wire, 800 kHz
- Key feature
- The standard; huge library support
- Price per metre
- ~$5–15
WS2813
- Voltage
- 5 V
- Data line
- Single wire + backup line
- Key feature
- Keeps working if one pixel fails
- Price per metre
- ~$7–18
WS2815
- Voltage
- 12 V
- Data line
- Single wire + backup line
- Key feature
- 12 V: much less voltage drop on long runs
- Price per metre
- ~$8–20
SK6812 RGBW
- Voltage
- 5 V
- Data line
- Single wire, 800 kHz
- Key feature
- Extra white LED for true whites
- Price per metre
- ~$6–18
APA102 / DotStar
- Voltage
- 5 V
- Data line
- Clock + data (SPI)
- Key feature
- Timing-tolerant, faster refresh, no interrupt problems
- Price per metre
- ~$8–20
Ready to build?
- WS2812B with Arduino Uno: a first NeoPixel test, a FastLED rainbow explained line by line, and an effects controller with a button and a brightness knob
- WS2812B with ESP32: level-shifted wiring with a 74AHCT125, a Wi-Fi colour picker for your phone, and when to use WLED instead of writing code
Troubleshooting
Almost every WS2812B problem comes from power, ground or the first pixel's data signal.
| Symptom | Likely cause | Fix |
|---|---|---|
| Nothing lights up | Data connected to DOUT, no power, or no common ground | Connect to the DIN end with the arrow pointing away, check 5 V, and join all grounds |
| First pixel is wrong colour or flickers | Noise or reflections on the data line, or no series resistor | Add a 330–470 Ω resistor close to the strip, shorten the wire |
| Random colours or flicker on ESP32 | 3.3 V data signal is too low for the strip | Add a 74AHCT125 level shifter, power the strip at 5 V and keep the data wire short |
| Strip works until the brightness goes up | Supply sags under load | Use a bigger supply, thicker wires, inject power and lower the brightness |
| Colours shift toward red at the end | Voltage drop along the strip | Inject 5 V and GND at the far end and at intervals |
| Strip lights only up to a certain pixel | A damaged pixel breaks the chain, or a bad solder joint | Check the data connection at the last good pixel, replace the faulty LED or use a WS2813 |
| Red and green are swapped | Wrong colour order in the code | Change GRB to RGB (or the right order) |
| Arduino resets when the strip lights up | The Uno is powering the strip or the supply is collapsing | Power the strip separately, share only the ground, add the 1000 µF capacitor |
| First LED turns white at power-on | Data line floating while the board boots | Add a pull-down (about 10 kΩ) on the data line and power the strip last |
| Animation stutters on the Uno | Interrupts disabled during updates or too many pixels | Update less often, use fewer pixels or move to an ESP32 |
| LEDs get very hot | Too much current at full white | Lower the brightness, use FastLED's power limiter |
What to build with it
A WS2812B strip is one of the most rewarding parts in electronics, because the result is visible and impressive right away:
- Ambient bias lighting behind a TV or monitor.
- Music-reactive visualiser driven by a microphone or sound sensor module.
- Status bars and notification lights, for example an ESP32 showing weather, build status or CPU load.
- Smart room lighting controlled by Wi-Fi, a phone or Home Assistant.
- LED clocks and counters, using strips or rings.
- Cosplay and wearables with a small battery and a few dozen pixels at low brightness.
- Stair or cabinet lights switched on by a motion sensor.
Always start with the brightness low, test a few pixels first, and only then scale up. A tidy power plan on day one saves hours of debugging.
Frequently asked questions
Can I power a WS2812B strip from an Arduino? Only a few pixels at low brightness. A strip of 30 or more LEDs needs a separate 5 V supply, with the grounds joined.
Do I need a level shifter with an ESP32? It is strongly recommended. Many strips work without one on short wires, but the 3.3 V signal is close to the strip's switching threshold, so a 74AHCT125 is the reliable choice.
What is the resistor on the data line for? A 330–470 Ω series resistor limits current spikes and reduces ringing so the first pixel receives a clean signal.
Why do I need a big capacitor across the strip? At power-on the strip can draw a sudden surge. A 1000 µF capacitor across 5 V and GND smooths it and protects the first pixel.
How many LEDs can I connect to one pin? The protocol has no fixed limit, but the update time grows with the number of LEDs and RAM becomes a limit on an Uno. A few hundred is common on an ESP32. Power and voltage drop are the practical limits.
Can I cut the strip? Yes, at the marked copper pads. Cut along the line, and solder wires to the 5 V, GND and DIN pads of the new section.
Are WS2812B and NeoPixel the same? NeoPixel is Adafruit's brand for WS2812-type addressable LEDs. The wiring and the code are the same.
What is the difference between WS2812B and APA102? The WS2812B uses one data wire with strict timing. The APA102 adds a clock wire, so it is much more tolerant of timing and cable length and can refresh faster, but costs more and uses four wires.
Is there a no-code option? Yes: WLED, a free firmware for the ESP32 and ESP8266. You flash it from a web browser, set the data pin and LED count, and control the strip from a phone app or Home Assistant with over 100 built-in effects. The ESP32 guide explains when to choose it over your own code.
Datasheets and references
- WS2812B datasheet (Worldsemi) - timing, current and logic-threshold figures used on this page.
- Adafruit NeoPixel Überguide and the FastLED documentation - library behaviour, power limiting and best practice.
Current and timing figures are datasheet values; real strips vary by manufacturer, so test your own strip and fit proper fusing.
Wiring & code
Board integration
Library
FastLED / Adafruit NeoPixel by FastLED community / Adafruit
Library Manager: install "FastLED" for the effects and "Adafruit NeoPixel" for the first test
This guide lights a WS2812B strip from an Arduino Uno, starting with eight pixels you can power from USB and ending with an effects controller: a button cycles through animations and a knob sets the brightness. The Uno drives the strip's data line directly at 5 V; what needs care is power. Background on the protocol, power budgeting and injection is on the WS2812B overview.
What you need
1Arduino Uno R3 (or Nano)
- Notes
- Any 5 V Arduino
1WS2812B strip, 30 LEDs (or a short test piece)
- Notes
- Sketch 1 lights only 8 pixels, safe from USB
15 V power supply, 2 A or more
- Notes
- For the full strip at real brightness
1 each330 Ω resistor and 1000 µF / 6.3 V capacitor
- Notes
- Data-line resistor and supply smoothing
1 eachPush button and 10 kΩ potentiometer
- Notes
- Only for Sketch 3
Wiring
| Strip pin | Arduino Uno pin | Note |
|---|---|---|
| 5V | External 5V supply (+) | For more than about 8 pixels, power the strip from its own supply, not the Uno's 5V pin. Add a 1000 µF capacitor across 5V and GND at the strip. |
| GND | GND | Join the Uno's GND, the external supply's GND and the strip's GND. |
| DIN | Pin 6 | Use a 330–470 Ω resistor in series, close to the strip. Make sure you connect to the DIN end (follow the arrow). |
Each pixel can draw about 60 mA at full white, so a 30-LED strip may pull 1.8 A, far more than the Uno's regulator or a USB port can supply. Use an external 5 V supply, join the grounds and rely on setMaxPowerInVoltsAndMilliamps() as a safety net. If you test from USB only, keep the power limit near 400 mA and the pixel count low.
Connect ground first and power last. If the Uno is powered from USB and the strip from a separate supply, only the grounds should be shared, and nothing should feed 5 V back into the Uno's pin.
On the Uno's 2 KB of RAM every pixel costs 3 bytes, and interrupts are off while the strip updates. Stay under about 200 pixels for comfort and avoid mixing the strip with interrupt-heavy code such as IR receivers or software serial.
Warning
Connect ground first and power last, and never plug the strip into a powered supply with the data wire already attached to a running Uno: the voltage spike can kill the first pixel. If the first LED dies, cut it off and solder to the next one.
Sketch 1 - First test with Adafruit NeoPixel
Before writing effects, prove the wiring with the simplest library. This sketch lights only the first eight pixels at low brightness, which a USB-powered Uno can handle: red, green, blue, white, then four mixed colours. If they appear in that order, the data direction, colour order and grounds are all right.
- 1Sketch > Include Library > Manage Libraries, search "Adafruit NeoPixel" and install it.
- 2Wire DIN to pin 6 through the 330 Ω resistor, and join the grounds.
- 3Upload the sketch below.
#include <Adafruit_NeoPixel.h>
#define DATA_PIN 6
#define NUM_LEDS 8 // only the first 8 pixels: safe from USB
Adafruit_NeoPixel strip(NUM_LEDS, DATA_PIN, NEO_GRB + NEO_KHZ800);
void setup() {
strip.begin();
strip.setBrightness(40); // 0-255; keep it low while testing
strip.setPixelColor(0, strip.Color(255, 0, 0)); // red
strip.setPixelColor(1, strip.Color(0, 255, 0)); // green
strip.setPixelColor(2, strip.Color(0, 0, 255)); // blue
strip.setPixelColor(3, strip.Color(255, 255, 255)); // white
strip.setPixelColor(4, strip.Color(255, 120, 0)); // orange
strip.setPixelColor(5, strip.Color(180, 0, 255)); // purple
strip.setPixelColor(6, strip.Color(0, 255, 180)); // aqua
strip.setPixelColor(7, strip.Color(255, 0, 80)); // pink
strip.show(); // nothing changes on the strip until show()
}
void loop() {}Tip
Red and green swapped? Your strip uses a different colour order: change NEO_GRB to NEO_RGB. Only the first pixel lights, or none? Check you are on the DIN end and that the grounds are joined.
Sketch 2 - FastLED rainbow with a power limit
Now the whole strip, from the external supply. FastLED's setMaxPowerInVoltsAndMilliamps() keeps the strip within the current you allow, whatever the effect asks for.
#include <FastLED.h>
#define DATA_PIN 6
#define NUM_LEDS 30
#define BRIGHTNESS 64
CRGB leds[NUM_LEDS];
void setup() {
FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
FastLED.setCorrection(TypicalLEDStrip);
FastLED.setBrightness(BRIGHTNESS);
FastLED.setMaxPowerInVoltsAndMilliamps(5, 1000); // ~1 A budget for a 30-pixel test strip
FastLED.clear(true);
}
void loop() {
static uint8_t hue = 0;
fill_rainbow(leds, NUM_LEDS, hue++, 7);
FastLED.show();
FastLED.delay(20);
}How the FastLED sketch works
CRGB leds[NUM_LEDS]; is the array that holds the colour of every pixel in memory. Setting leds[5] = CRGB::Red; changes the array but not the strip. The strip only changes when you call FastLED.show(), which pushes the whole array out in one go. That is why animations are written as "change the array, then show".
FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS); tells the library the chip type, the data pin (which must be a fixed number, not a variable) and the colour order. If red and green look swapped, change GRB to RGB.
FastLED.setMaxPowerInVoltsAndMilliamps(5, 1000); is the safety net. You tell the library the supply voltage and the maximum current you want it to use, and it scales the brightness down automatically if an effect would draw more. On an Uno powered from USB, use about 400 to 500 mA. With a proper external supply, use a value a little below its rating.
fill_rainbow() fills the array with a smooth hue gradient, and fadeToBlackBy() dims every pixel slightly each frame, which is the trick behind comet and trail effects. FastLED.delay() waits while still letting the library do background tasks such as dithering.
Sketch 3 - Effects controller with a button and a brightness knob
A real lamp needs controls. Here a push button on D2 cycles through three effects (rainbow, comet with a fading tail, and a warm candle flicker) and a potentiometer on A0 sets the brightness. The animation runs from FastLED's EVERY_N_MILLISECONDS timer instead of delay(), so the button responds instantly.
Extra wiring for Sketch 3
| Part | Uno pin | Notes |
|---|---|---|
| Push button | D2 and GND | Uses the internal pull-up: pressed reads LOW |
| Potentiometer wiper | A0 | Outer legs to 5V and GND |
#include <FastLED.h>
#define DATA_PIN 6
#define NUM_LEDS 30
#define BUTTON_PIN 2 // to GND; internal pull-up
#define POT_PIN A0
CRGB leds[NUM_LEDS];
uint8_t mode = 0; // 0 = rainbow, 1 = comet, 2 = candle
const uint8_t MODES = 3;
void setup() {
pinMode(BUTTON_PIN, INPUT_PULLUP);
FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
FastLED.setCorrection(TypicalLEDStrip);
FastLED.setMaxPowerInVoltsAndMilliamps(5, 1000); // stay within a 1 A budget
}
// Next effect on each press, with a 30 ms debounce
void readButton() {
static bool lastState = HIGH;
static uint32_t lastChange = 0;
bool state = digitalRead(BUTTON_PIN);
if (state != lastState && millis() - lastChange > 30) {
lastChange = millis();
lastState = state;
if (state == LOW) {
mode = (mode + 1) % MODES;
FastLED.clear();
}
}
}
void loop() {
readButton();
FastLED.setBrightness(map(analogRead(POT_PIN), 0, 1023, 5, 255));
EVERY_N_MILLISECONDS(20) {
static uint8_t hue = 0;
static uint8_t pos = 0;
switch (mode) {
case 0: // rainbow
fill_rainbow(leds, NUM_LEDS, hue++, 7);
break;
case 1: // comet with a fading tail
fadeToBlackBy(leds, NUM_LEDS, 40);
leds[pos] = CHSV(hue, 255, 255);
pos = (pos + 1) % NUM_LEDS;
hue += 2;
break;
case 2: // candle: random warm flicker
fadeToBlackBy(leds, NUM_LEDS, 8);
leds[random8(NUM_LEDS)] = CHSV(random8(10, 30), 255, random8(120, 255));
break;
}
FastLED.show();
}
}How it works. readButton() runs on every pass of loop(), so presses are caught immediately, and the 30 ms check ignores contact bounce. EVERY_N_MILLISECONDS(20) runs the animation 50 times a second without blocking. The comet's tail is just fadeToBlackBy() dimming every pixel a little each frame, while only the head is redrawn at full brightness. Add your own effect as case 3 and raise MODES.
Troubleshooting on the Uno
Nothing lights
- Likely cause
- Data on the DOUT end, or no common ground
- Fix
- Follow the arrow from DIN; join the Uno and supply grounds
Uno resets when the strip brightens
- Likely cause
- The strip is powered from the Uno, or the supply sags
- Fix
- External 5 V supply, 1000 µF at the strip, lower the power limit
Random flicker on the first pixel
- Likely cause
- No series resistor, or a long data wire
- Fix
- 330 Ω at the strip end of the data wire; keep it under about 1 m
millis() runs slow or Serial drops characters
- Likely cause
- Interrupts are off during every show()
- Fix
- Fewer pixels, fewer show() calls, or move to an ESP32
Sketch stops working above ~200 LEDs
- Likely cause
- Out of RAM: 3 bytes per pixel plus your code
- Fix
- Reduce NUM_LEDS, or use an ESP32
Button changes mode twice
- Likely cause
- Switch bounce
- Fix
- Raise the 30 ms debounce time
Arduino Uno FAQ
Which pin should I use?
Any digital pin works with both libraries; pin 6 is the convention. With FastLED the pin must be a constant, as in #define DATA_PIN 6.
Can I power the Uno from the same 5 V supply? Yes: connect the supply's 5 V to the Uno's 5V pin (not VIN) and do not plug in USB at the same time, or the two supplies fight. While developing, it is simpler to power the Uno from USB and share only ground.
How many LEDs can an Uno drive? A few hundred in theory, limited by RAM (3 bytes each) and by the interrupts-off time during updates. For smooth animation with other code running, stay under about 200.
Where next? Control the strip from your phone with the WS2812B ESP32 guide, or try a grid in the WS2812B matrix guide.
