Nexinon

WS2812 Pattern

Paint or animate a WS2812/NeoPixel LED pattern and generate ready-to-use Arduino code.

Maximum 300 — a preview performance limit, not the library's.

The board's digital pin wired to the strip's DIN (data input).

Brightness — 180/255
Speed
Generated Arduino code
// Generated with the WS2812 Pattern Builder — https://nexinon.dev/ws2812-pattern-builder

//
// WARNING — 30 LEDs: do NOT power from the board's 5V/USB pin. The combined
// current of many WS2812s (up to ~60 mA each, at full-brightness white)
// exceeds what the board's regulator can handle. Use a dedicated external 5V
// supply for the LEDs, with the supply's GND tied to the board's GND.
//

#include <Adafruit_NeoPixel.h>

#define LED_PIN 6
#define LED_COUNT 30

Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);

void setup() {
  strip.begin();
  strip.setBrightness(180);
  // Preview is animated — each LED's color is recalculated in loop().
}

void loop() {
  unsigned long now = millis();
  uint16_t offset = (uint32_t)(now % 1600UL) * 65536UL / 1600UL;
  for (int i = 0; i < LED_COUNT; i++) {
    uint16_t hue = (uint32_t)i * 65536UL / LED_COUNT + offset;
    strip.setPixelColor(i, strip.gamma32(strip.ColorHSV(hue)));
  }
  strip.show();
  delay(15);
}

FastLED and Adafruit_NeoPixel: why both?

They're the ecosystem's two dominant libraries, with overlapping but not identical audiences. Adafruit_NeoPixel is the official one from the chip's distributor, a minimal API (setPixelColor, show), the most cited in beginner tutorials — including the examples bundled with the Arduino IDE itself. FastLED is more popular among experienced makers: ready-made color palettes, brightness dithering, finer timing control, and support for a wider list of chipsets beyond WS2812. This tool generates correct code for both, each written the idiomatic way a reference tutorial for that library would show it — never a mechanical translation from one API to the other.

GRB, not RGB: the classic WS2812B gotcha

The WS2812B receives each LED's three color bytes in Green-Red-Blue (GRB) order, not Red-Green-Blue (RGB) as most people assume out of habit. It's the most common cause of "my strip shows the wrong color" for beginners — asking for red and seeing green, for instance. Both libraries already handle this correctly once configured right: Adafruit_NeoPixel takes the order in its constructor (NEO_GRB or NEO_RGB), FastLED as the third template parameter of FastLED.addLeds. This tool generates the initialization already in the right order — GRB by default (what most real strips use), with the "my strip is RGB" toggle for anyone with a different variant.

Why even a handful of LEDs need external power

Each WS2812/WS2812B can draw up to about 60 mA at full-brightness white — 8 LEDs already add up to nearly 500 mA, more than an Arduino Uno/Nano's 5V regulator or a computer's USB port can comfortably deliver alongside the rest of the circuit. The usual symptom is the board randomly resetting, or wrong colors on the last LEDs of the strip once the voltage drop gets too large. Rule of thumb: up to about 8 LEDs, the board's own 5V pin is usually enough; above that, a dedicated external 5V supply for the LEDs (sharing GND with the board) is the correct fix — not an arbitrary limit set by this tool, but by the hardware itself.

How each preset pattern works

Solid fills the whole strip with one fixed color. Breathing smoothly grows and shrinks a single color's brightness in a continuous cycle. Comet lights up a "head" that travels down the strip with a trailing fade behind it. Rainbow sweeps the full color spectrum along the strip, continuously rotating. Alternating blinks two colors between even and odd positions. Traffic light (inspired by a real project from the Efeito Nerd blog) cycles the whole strip through red, amber and green, at the timing proportions of a real traffic light. In every animated pattern, each instant's position/color always comes from real elapsed time (millis(), in the generated code) — never a counter that would depend on the microcontroller's speed.

Frequently asked questions

Because brightness is a global multiplier the library itself applies when displaying (setBrightness/FastLED.setBrightness), not a change to each LED's stored color — exactly how the real hardware works. The preview scales what's shown by the same factor just to honestly reflect the final result; the generated code stores each LED's "true" color and applies brightness once, separately.

Not in this version — this tool's color model is RGB (3 channels), and an SK6812 RGBW has a fourth channel (pure white) that changes the shape of every stored color, the generated array, and both libraries' initialization. An SK6812 used with just its 3 RGB channels (ignoring the dedicated white) works fine with the code generated here, just without taking advantage of the dedicated white.

That's the length of a full 5-meter reel at 60 LEDs/m — the most common ready-made product — and it's already enough for the animated patterns to read clearly. The cap is a browser preview performance limit (hundreds of cells updating every animation frame), not the real library's: the generated code works for whatever LED_COUNT you edit it to afterward, if you need a longer strip.

Switching from a preset pattern to manual paint "freezes" the frame shown at that moment as a starting point — you can hand-tweak a pattern you liked instead of always starting from a blank strip. The reverse never happens: picking a preset pattern never reads or overwrites what was painted manually, which stays stored for as long as the page is open.

Three common causes, in this order: (1) the strip doesn't follow the standard GRB order — try the "my strip is RGB" toggle; (2) the generated data pin isn't the one physically wired to the strip's DIN; (3) on 3.3V-logic boards (ESP32, for instance), the data signal can sometimes fall below the WS2812's 5V read threshold over longer wires — a ~330-470Ω resistor in series on the data line, near the strip, usually fixes it; for long strips, a proper level shifter is the more robust fix.

Scope decision: this tool only asks for a simple pin number, without knowing about specific boards. Assigning a pin per board while avoiding conflicts with reserved peripherals is the job of the Sketch Skeleton Generator (the next tool in the family, docs/ROADMAP.md) — which reuses the Pinout Reference's dataset for exactly that.

Yes — the library you picked needs to be installed in the Arduino IDE (menu Sketch → Include Library → Manage Libraries..., search for "Adafruit NeoPixel" or "FastLED" and install it). The generated code doesn't bundle the library itself, only the #include that expects to find it already installed.

Nexinon Principles

Privacy

Your data never leaves your browser.

No account needed

Use it now, no account or password.

Free

No usage limits, no paid plan.

Trustworthy content

Full explanation behind every tool, not just the result.
See the live proof — Trust Center

Other Electronics tools

View all