LED Animator
Create code snippets for WS2812 LED animations effortlessly. Choose from popular LED modules and a large collection of eye-catching effect presets. Export ready-to-use code for Adafruit NeoPixel or FastLED.
Your LED Playground
Effect Settings
Add a second module to choose.
Your playground is empty. Add your first LED module.
LED order
First LED
Position in chain
Export
Which LED library do you want to use?
What should be the general LED brightness?
32 looks roughly like the preview on your screen, 255 is the maximum of the LEDs. To change the brightness of one effect only, change its brightness in the sketch's setup().
Your Custom Sketch
Your modules, the effect and all settings are already in it. The code runs non-blocking, so your LEDs keep animating while servos, sensors and everything else in your loop keep working. It needs the libraries FluxGarage LED Animator and Adafruit NeoPixel which you can install with the Arduino Library Manager.
Big thanks to the Adafruit NeoPixel and FastLED teams and communities. Your libraries make all of this possible.
How To Use It
Install the Libraries
In the Arduino IDE, open the Library Manager, search for FluxGarage LED Animator and click Install. When the IDE asks about dependencies, choose Install All: this also installs Adafruit NeoPixel and FastLED.
Wire Your LED Modules
I use an Arduino Nano here. Connect DIN of your first module through a 330 Ω resistor to D6, 5V to the + rail and GND to the – rail. Connect 5V and GND of the Nano to the rails, too. A 1000 µF capacitor across the rails protects your LEDs; mind the stripe, it marks the – side. More modules? Connect DOUT of one module to DIN of the next, in the same order as on your playground.
Mind the power. Over USB, your board can only supply about 500 mA for all LEDs together. Check the estimated current below the playground: if it shows more, power the LEDs from an external 5V supply. Connect it to the + and – rails, remove the wire from the Nano's 5V to the + rail, and keep GND of the supply and the Nano connected. At brightness 255, LEDs draw several times as much as at 32.
Open the Sketch
Download the sketch from above and open it in the Arduino IDE, or paste the copied code into a new sketch. If you use another pin than D6, change
DATA_PINat the top.Upload It
Select Tools > Board > Arduino AVR Boards > Arduino Nano and the port of your Nano, then upload. Many Nano clones need Tools > Processor > ATmega328P (Old Bootloader). Your LEDs start right away.
Make It Yours
Change
BRIGHTNESSor the effect settings insetup(). One-shot effects like the Raygun can play at the right moment: callleds.startEffect(raygun, 1), for example when a button is pressed. Keepleds.update()in your loop and don't usedelay().
Good to Know
- ESP32 instead of an Arduino Nano? Wire it the same way: data line through the resistor to DIN, the LEDs' 5V to the board's 5V or VBUS pin, GND to GND. Use the GPIO number as
DATA_PIN: on a XIAO ESP32-C3,DATA_PIN 6is pin D4. ESP32 boards (and the Raspberry Pi Pico) send 3.3V data signals, but the LEDs expect 5V logic. That often works, but you may need a level shifter like the 74AHCT125 between the data pin and DIN to make it reliable. - FastLED on an ESP32-C3 or C6? FastLED 3.10.7 and 3.10.8 don't compile for these boards. If you get compile errors from FastLED, install version 3.10.6 in the Arduino Library Manager.
- Brighter in real life. Real LEDs are much brighter and more saturated than computer screens can show.
- Less RAM in the Arduino IDE? The IDE shows less than the estimate here: the LED colors (3 bytes per LED) are reserved only when the sketch starts, so the IDE doesn't count them. Your board still needs that memory.
- Matrix looks scrambled? Matrices are wired differently depending on the maker. Select your matrix on the playground and use the gear icon to set the LED order (rows or zigzag) and where the first LED sits. Light up LED by LED with the Scanner effect to see how yours is wired.
- Only some LEDs light up? A single broken LED or solder joint stops the chain, everything behind it stays dark. Check the connections from DOUT to DIN.
- More effects and modules in one sketch? All modules on one data pin form one chain: list them in
modules[]in chain order (the tool does that for you). For more effects, create one effect object for each and switch withleds.startEffect(…), for example play a Raygun once and go back to Plasma Glow as soon asleds.effectDone()is true. To play two effects at the same time, connect the modules to two data pins and create a secondLedAnimatorwith its own modules and effect objects. - Twitching servos? On boards like the Nano, sending data to the LEDs briefly pauses everything else, which can make servos twitch. Fewer LEDs, an ESP32 or a servo driver board like the PCA9685 help.
- Using another board? The LED Animator is tested on Arduino Nano, Pro Micro, Mega, ESP32-C3, ESP32-C6 and Raspberry Pi Pico. Tell us how it went on GitHub or by email.