Happy New Year

I’ve been playing a lot with Neopixels during the holidays. I made a bracelet, a pendant, and earrings for my wife, and also had a 4m 240 LED strip on display over my window.

The NeoPixo library

All of these projects share the same animations, just with slightly different parameters: the bracelet has 30 LEDs, the earrings/pendant have 16, and the strip has 237 (some of the Neopixels didn’t quite make it, sadly). Also timings have to be adapted to the form factor. But still most of the code is naturally sharable, so I made a little library I call NeoPixo which handles all the animations.

Here is the library itself: http://github.com/robidouille/robidouille/tree/master/Arduino/libraries/NeoPixo

And examples using it: http://github.com/robidouille/robidouille/tree/master/Arduino/neopixel


Wait this is all nice and everything, but how do I get the hardware to use this on?

Well Adafruit has a bunch of tutorials for this, here are some links:

Adding a Raspberry Pi


While the bracelet, pendant, and earrings, just cycle through the different programs, the strip is very different. It’s connected to a Raspberry Pi, which can program the Arduino using Ino. Ino is a command-line version of the Arduino-IDE, but much better suited for the Raspberry Pi. I have a tutorial covering  Ino here.

The christmahanukwanzaa-tree example above used an Arduino Yun for this, I chose a Raspberry Pi instead. Having a Raspberry Pi opens a lot more possibilities. The Arduino can listen for commands on its serial port, and the Pi can schedule the programs now, and also play sounds through an attached speaker.


One way is through a web-page, allowing users to click and select the program they want. PHP scripts turn the button clicks into serial port commands, which in turn drive the Arduino.

It’s important to grant Apache permission to use the serial port, for things to work properly. To do this run “sudo usermod -a -G dialout www-data” on the Raspberry Pi itself, and then restart Apache. More details on this are available in these pages.

The code for the web pages I use for this is here: http://github.com/robidouille/robidouille/tree/master/WebSites/html/neopixels

New-Year countdown

Since the Raspberry Pi has an NTP synchronized clock, it’s perfect for a precise countdown until the exact New Year moment.

I have a python script, exactly for that purpose: http://github.com/robidouille/robidouille/tree/master/Tools/python/NewYear

It wakes up 13 seconds before the target time, opens the serial port, and starts sequencing events every second. It also uses to the Raspberry Pi audio out jack to play sounds.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: