Programmable Christmas Lights Using Arduino and Neopixels

satb100I have a little Christmas tree that I put up in my office every year that I call my “Charlie Brown tree”. It’s a scrawny looking little artificial tree with a little white Christmas balls on it and a strand of cheap flights. This year I decided to fancy it up a little bit by adding a 3 meter strand of Adafruit neopixels containing 90 pixels. I started out with the standard strand test sketch that is available from Adafruit and then modified it to add my own special patterns. I showed it on a recent Adafruit Saturday night Show-and-Tell Google+ video chat. There were a number of other Christmas displays shown that night but people seem to especially like my candy stripe pattern.

One viewer liked it so much he wrote me and asked me for the candy stripe code. He then incorporated it into his outdoor display and showed it in a subsequent Show-and-Tell a few weeks later. I had always intended to write a blog post about it and to include the code but I got so busy over the holidays that I didn’t have time to clean up the code and make it suitable for public sharing. The holidays are over and I’m finally getting around to sharing the code.

Here is a YouTube video showing a slightly earlier version of the pattern.

Here is the Adafruit Show-and-Tell on Google+ where I showed off the tree and my blinking Christmas card.

Here is the Show-and-Tell of the other guy named Kenneth who borrowed my candy stripe code. His display used a full 10 meters of pixels. Unfortunately there were bad audio problems that evening but I will put the video here anyway. His segment starts at about six minutes into the video.

Here are some links to the products used in this project. All were purchased from

Now finally here is the code edited for public consumption with comments.

Hope you find this code useful. Have a very Merry Christmas and a blessed new year.

8 thoughts on “Programmable Christmas Lights Using Arduino and Neopixels

  1. Hi thanks for the code, I loaded it to two pro mini arduinos each with a 24 led neo pixel ring attached and fitted them inside two christmas stars, looks fantastic. Thanks you

  2. Excellent, thanks for sharing. I am just learning Arduino and your post has helped me loads. I have modified the code and got just candy cane and random colours cycling over 2 minutes. I now am on a mission to incorporate a light sensor so that it is read and directly effects the brightness so that the lights are bright during the day and dimmer at night.

  3. Hi,
    thanks for sharing your project! I’d like to ask, how can I run the CandyCane program at reverse direction? I’ve changed this command: for(int i=0;i0; i–) but doesn’t work. Thanks for your help!
    Merry Christmas!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.