I was looking for a better way to add and control lighting effects on Pocket universe project before going down to Burning man this year. A friend of mine ( Fishboy ) tuned me on to Hyperion an ambient light system for TVs that has a native Android/IOS app/a web interface, and a bunch of per programmed effects.
There was several problems with it.
- No support WS2812b LED Strips because the Raspberry PI can’t keep up with the clock frequency in the WS2812b chips
- Will not compile for the Raspberry PI 2.
- I need to run 3000 LEDS and the max seems to be 255
- Baud rate, how to stream that many LEDs to the Arduino in a reasonable amount of time.
The first problem with the lack of support for the WS2812b was resolved by using Adalight protocol on a Arduino, and connecting the LED strips to the Arduino instead of directly to the Raspberry PI. With a little fandanling I got Hyperion to support the Adalight protocol. This means in the future any LED strip lighting that works with the Arduino should also work with Hyperion. Its a 3rd “box” solution but it works for me.
Next was that it wasn’t compatible with Raspberry PI 2. I removed parts of Hyperion that didn’t support the newest version of GCC and was able to compile. The only reason that this worked for me is because I was using the Arduino to run the LEDs. Your mileage may vary.
next running ~3000 LEDs. Has been a bit of a problem because the Adalight protocol holds the LED light info in memory (3 bytes per light). With all the other junk that Arduino adds into the atmega there just isn’t enough space for the buffer. I recompiled the Adalight sketch with Atmel Studio instead of the Arduino IDE, removed all the unneeded junk and was able to reduce the memory to fit onto the Arduino.
Normally the max baud rate of an Arduino pro mini is 115200. At 115200 to update ~3000 LEDS (9000 BYTES + 5 header) it would take approximately ~620ms to do a full update. That is < 1 FPS for you gamers out there. Too slow! But 115200 is just a suggestion based on the clock rate. The Arduino Pro Mini has a 16mhz processor so anything that is divisible by its clock frequency should work, it needs to match up with the Raspberry PI 2 clock frequency too. This makes it stupid hard to debug but it does work. So I used the BAUD rate ~500,000. Luckily Raspberry PI 2 and Hyperion don’t put any stupid arbitrary limits (has to be one of these enumerations, I hate that, I am looking at you windows) on the BAUD rate. at 500,000 baud rate the LEDs can update in 140ms or 8 FPS. Much better.
It was a fun 4 hour build while drinking beer and watching Rick and Morty
All my code as always is on github