Raspberry Pi 3B: Learning from the ground up

Over the past couple of months I’ve been working for Dan Wildgen at Amnesia Games, on a specific game called Disenchanted Forest. I designed and built lots of electronic modules – almost all built using the Arduino platform – to detect knock patterns, control lights and faders, door solenoids and a play controller to monitor and pace the game. However, the sound tracks and audio clips of the game were programmed on a Raspberry Pi, so I thought it high-time for me to learn how to program it.

So I got myself a Raspberry Pi 3B, case and power supply…

Raspberry Pi 3B board

I started with the excellent tutorials from Adafruit and have recently just started to play with the PYTHON programming language. As I love light and light pattern animations (walk towards the light…), I decided to learn how to use Python to program WS2811-type addressable LEDs.  However, I soon found that while many code examples appear to work correctly on the rPi3B, there are subtle dependencies to watch out for. As I learn, I shall post any issues and solutions that I encounter.

NeoPixel 2811 Addressable LEDs:

I followed the guides on https://learn.adafruit.com/neopixels-on-raspberry-pi, downloaded and compiled the rpi_ws281x library, and connected up a strip of WS2812 LEDs to the breakout header. So far so good.

ISSUE: However, all of the example files to control the strip just produced random flashing of the LEDs. No control whatsoever!

SOLUTION: It turns out that on the rPi3B there is a conflict in that audio drivers use the same resources required for the strict timing requirements of the WS2812 LEDs (see https://github.com/jgarff/rpi_ws281x/issues/103). The solution that appeared to work for me was to edit the “/boot/config.txt” file and comment out the “dtparam=audio=on” line. However, this solution seems to completely disable all audio, so it’s quite a costly trade-off. Nevertheless, it did work.

# Enable audio (loads snd_bcm2835)
# dtparam=audio=on

More to come…

Come on... leave a comment...