Christmas Lights!

Well, it was a Hack Friday on Dec 1st, and I had this spare string of WS2812 NeoPixel LEDs. What happened next is obvious.


Except I didn’t have time to write it up, so here I am keeping a weekend eye on support and writing up my new Christmas lights. I also promised to ping @sonyagreen when I published, because she wants a set, and will hopefully have better pictures.


I used

  • A string of WS2812 lights.
  • A Hack Friday on Dec 1st.
  • An RPi Zero Wireless and a PiBow case.
  • Not quite enough time to write it up.
  •, etcher, etc. My standard IOT toolchain.
  • The rpi-ws281x-native, color and lodash npm libraries.


The wiring for this project is really easy.

  • GPIO 18 (library default) to Data In of the WS2812 string
  • An independant 3.3v power supply to provide the amperage
  • Connect the +ve of the power supply to the string
  • Share the 0v of the power supply with the Pi


The software was also fairly simple. My thanks to some great libraries.

  • The top block imports the three libraries
  • Then I parse the environment and initialise some global variables and library bits
  • Then I populate the internal array representing the LED string with white
  • Then I set up a render loop that simply pushes the relevant part of the array to the library
  • Then I start the fade of a LED every once in a while
  • Then I deal with each step of the fade

Circuit Board Christmas Tree


How festive are your diodes



My usage, and so the photo, shows some different components. In all honesty I’ve got several half-finished starter boxes that I keep pulling bits out of for projects. I think that the list is complete enough - but also welcome Pull Requests if not.




  1. Solder the headers onto the Pi
  2. Put the Pi into the case
  3. Snip out the PCB and push the largest panel onto the Pi
  4. Push the other two panels onto the PCB


  1. Create a new app in your account
  2. Download and etch the resinOS for this app
  3. Replicate this repo into that app, git has several ways to do this
  4. Insert the microSD and power up

Expected behaviour

  1. As the device boots all of the lights ought to shine for a second or two, as a hardware test (Leds.init())
  2. Then a number of lights equal to the number of days through advent should flicker (Leds.step())

So, my son’s birthday was yesterday, which means today the decorations actually go up, which means that there’s a brief update to this project!
I also note that there’s another device listed in the application, I think @sonyagreen might have been deploying her fleet of decorations.