We wanted to add some flashy lights to Dangly Too, but assumed this was quite easy to do! How difficult can it be? Well more difficult than it should have been.
We wanted to attach a couple of NeoPixel "eyes"
These are rings of 8 WS2812 Red-Green-Blue addressable LEDs (NeoPixels), which can display a massive range of colour patters. In principle, they are easy from Python to control using the Adafruit Circuit Neopixel library using sample code. For examples see here
But this has a couple of issues, depending on which GPIO connection is being used
GPIO10 - Requires SPI to be enabled. This unfortunately runs for a second or so and then starts to fail. Also inadvertently uses GPIO11, which we might need elsewhere. Discovered this was due to the Raspberry Pi going into slower idle speed, which upsets the data being sent out!
GPIO12 - This is not usable except from root, so we need to "sudo" python to get it to work. Not great, as we don't want to run the whole robot software as root privilege if at all possible.
GPIO18 and GPIO21 - Same as GPIO10 as far as I can see
Overall, we’re going with the second option as it fits our software best. We’ll split off the driver into a separate process, and then just this can run as root. Clever IPC code will link the two together (more on this in another blog).
Comments