Light effects using Arduino and WS2812B addressable LED strips.
This demo showcases 7 light effects for a heart-shaped WS2812B LED strip controlled by an Arduino Nano. For more information, see examples/heart/heart.ino.
To reproduce the above effects, follow these steps.
-
Materials
- One Arduino Nano
- One WS2812B LED strip
- One Mini USB cable
- [Optional] Jumper wires
- [Optional] Clip cables
- [Optional] Clear tape
-
Hook up
- Fold the LED strip to form a two-sided light.
- Shape it (e.g. heart) and attach it to a window.
- Connect the LED strip data pin to pin 7 on the Arduino Nano, and power/ground lines to 5 V and GND.
-
Light up
- Install the Arduino IDE.
- Open
examples/heart/heart.inoin the Arduino IDE. - Copy
src/to<Arduino Libraries directory>/LEDGeometry. - Upload the sketch to your Arduino Nano.
-
Calibrate (to match the effect to your physical LED layout)
- Turn the LEDs on and take a photo.
- Run
scripts/locate_lights.pyto extract each LED's position from the photo and generate coordinate arrays. - Copy the generated coordinate arrays into your
.inosketch. - Upload the updated sketch to your Arduino Nano.
The library can be compiled and run on a desktop to preview effects without hardware.
Requirements: a C++11 compiler and the lib8tion library in a sibling directory (../lib8tion).
cd extras/debug
bash setup.sh # compile with -DDEBUG → a.exe
./a.exe | python ../../scripts/visualize.py # open animated preview in browserThe binary runs one full loop() pass and exits. visualize.py reads its output, writes a self-contained HTML file, and opens it in your default browser.
The viewer shows all effects in tabs with full playback controls:
| Control | Behaviour |
|---|---|
| Effect tabs | Switch effect; playback resets to frame 0 |
| ▶ / ⏸ | Play / pause |
| Scrub bar | Jump to any frame |
| 0.5× 1× 2× 4× | Playback speed |
| ↻ Loop | Toggle looping |
| Frame counter | Current / total frames |
Custom output path:
./a.exe | python ../../scripts/visualize.py --output /path/to/preview.html./a.exe | python ../../scripts/make_gif.py # all effects → docs/preview.gif
./a.exe | python ../../scripts/make_gif.py --effects 1 4 # ripple + flame only
./a.exe | python ../../scripts/make_gif.py --output out.gif --max-frames 60 --size 600Requires Pillow (pip install Pillow).
Effect 0 fps=10
Coords x0,y0 x1,y1 ... xN,yN
Frame 0 (r,g,b) (r,g,b) ... (r,g,b)
Frame 1 (r,g,b) ...
...
Effect 1 fps=20
Coords ...
Frame 0 ...
Effect N fps=F— start of a new effect;Nis zero-based,Fis the frame rate.Coords x,y ...— one normalisedfloat,floatpair per LED in index order. For folded curves the mirrored second half is included.Frame N (r,g,b)...— one RGB tuple per LED for frameN.
To use debug mode in your own sketch, compile with -DDEBUG and include the same headers as extras/debug/test.cpp. No hardware or Arduino IDE is required.







