Old-school filament-based Christmas lights used to be available in twinkling form. LEDs, with their hard-on and hard-off nature, aren’t naturally predisposed to such behavior. To rectify this, some time ago, [Mark Kriegsman] built an Arduino program that makes LEDs twinkle beautifully.
The program is known as TwinkleFOX, and relies on the popular FastLED library for addressable LEDs. [Mark’s] demo setup is built around using WS2811 LEDs, put together in a string with plastic diffusers on each bulb. The Arduino is programmed to vary the brightness of each LED according to a triangle wave function. To create the twinkling effect, each LED has its own unique clock signal, so they vary in brightness at different times and at different rates.
Using an Arduino Uno or Leonardo, [Mark] reports its possible to twinkle 300 individual LEDs at a rate of over 50 updates a second. Using a faster microcontroller should net reliable performance with longer strings. Meanwhile, if you’re wondering how the older-style lights used to twinkle, we’ve covered that before too. Video after the break.