In 2013 I put my first set of programmable Christmas lights together, a very simple project which involved hanging a 5m addressable RGB LED strip (based on LDP8806) outside my house, driven by a Raspberry Pi and my first ever experiments in Python. It was awesome, and because the RPi was on WiFi, I could SSH from my bed (where I had clear view of the lights outside the house) and incrementally tweak the light sequence, or add extra patterns I'd dreamt up during the day.
The LDP8806 strips were a simple way to get started, because the protocol they speak is basically SPI. Since the RPi has hardware SPI support, this means talking to them is pretty much as simple as writing bytes to /dev/spidev0.0. You have to write the right bytes of course, but even that's pretty simple - write as many G,R,B bytes as you have pixels, then a trailing zero. And again, Adafruit have great tutorials with ready-to-roll sample code (including a gamma correction).
I was hooked. But what became immediately apparent was that 5m wasn't going to cut it. Wrapped round the 'Christmas tree' in a spiral it suddenly looked a lot smaller. I needed moar pixels.
So last year (2014) I started playing with WS2812-based lights (aka Neopixels). These have the advantage over the LDP8806's of being significantly cheaper per LED, however because of the tight timing requirements of their data signal, they are traditionally driven using a microprocessor like an Arduino (which isn't going to get preempted or multitask).
(The WS2812 LED, with integrated controller chip visible)
So the question arises, how to control the WS2812's from the Raspberry Pi. This will be the topic of the next post.
(Of course just when you thought you were on top of it all everything all changes again. Adafruit is now selling a range of LED strips under the brand 'DotStar' which claim to be a fair bit easier to talk to than WS2812, and as best I can tell from the RPi Python demo code they talk SPI).
Tuesday, May 19, 2015
Summary: Even if you think you know what you're doing, it is not safe to store anything in a ThreadStatic member, CallContext or Thread...
I love PowerShell, and use it for pretty much everything that I’m not forced to compile. As a result I’ve got fairly competent, and people h...
Look, it’s really not that hard. Programs are still in the same place, in %ProgramFiles%, unless you need the 32 bit version, which is in...