BBC Radio Tree is a Christmas tree which can be controlled by sending colours to it via Twitter. The tree will then respond by changing colour and notify the tweeter. For 2015 I decided to upgrade 2014’s BBC Radio Tree v1.0 which had three colours to a new build which uses 256-colour, individually-addressable NeoPixel LEDs in a custom array. This is the build blog of the 2015 build.
I popped over to the London Hackspace this evening to cut up a big section of stripboard into tiny little boards to carry a pixel each. The pixels are digital LEDs so need power (in parallel) and also a data line. It took quite a while to cut these little boards and I did 100, although I think 100 LEDs might actually be too many. I bought 100 LEDs as that was the bulk-buy discount but I might just leave some for another project in the future.
Currently I’m working on BBC Radio Tree v 2.0 (I know December has already started but I’m on holiday and not setting up the tree until I’m back in the office :) ) so it will hopefully be up and running as soon as I’m back in the office. Although I do have a lot more soldering to do as I’m making my own string of individually-addressable 256-colour LEDs.
Here is a test of the first few pixels:
…and this is what a ‘pixel’ looks like close-up:
I have Twitter streaming code mostly written although I keep on thinking up little additions to the functionality. Will upload to Github when the project is done. It’s working really well though and much more responsive than last year; although Twitter API functionality has really improved also since last year. :)
I’ve decided that the tree should support these X11 Web Colour names. I did think about just using hex codes, but it’s more interesting to talk about Chartreuse or DarkOrchid than #9932CC or #7FFF00, IMHO. :)
Spent the evening soldering and I now have around 30 pixels which I think is probably enough to be getting on with. I’m going to try them anyway and if I feel I need more then I can always add some later (the beauty of individually-addressable LEDs! :) ). They look really rad now though:
My rough plan was to run the Twitter part on a Raspberry Pi and the NeoPixel part via the Arduino but I found a Raspberry Pi Pulse Width Modulation library for WS281X LEDs which I got working with my Pi 2 really nicely.
The pixels need more power than is available from the Pi so I’m temporarily using my Arduino to power the LEDs while the data signal is coming from the Pi.
The problem last year was sending signals fast enough from the Pi running the Twitter module to the Arduino controlling the relay as I was sending the colours as a binary number of nnn such as 101 for red and blue lights on and green off. This was slow though as I had to wait for the controller to actually switch relays. But with more potential colours it makes it much more complicated to send from the Pi to the Arduino. But given I’m running everything from the Pi now, I don’t have that problem as the same code is running the LEDs as running the Twitter streaming.
So it’s starting to look pretty great!
So now, instead of using Ruby, I’m going to re-write the Twitter module in Python with Tweepy as the Pi can now run the Twitter and the NeoPixel parts together! :)
Spent this weekend finishing off the Python code and it’s running exceptionally well. The response time compared to last year is blazingly fast (as I’m now using Twitter streaming) and I’ve even got my ‘stretch goal’ of a ‘selfie’ picam working too! I’m looking forward to setting it all up at work tomorrow and having it all running, finally. Mostly so I can move onto a new project as I’ve spent a while on this and it’s been quite a lot of work. ;)
Tests today were running really well!
We’re good to go!
Check out the BBC Radio Tree page!