Adafruit’s ‘Neopixel’Along with plenty of footswitches to control a modelling rig, a good foot controller also needs some appropriate light-up bits to give the user feedback on what’s happening.
For STJORN, feedback from the software is displayed in two ways - RGB LEDs and Alphanumeric displays.
The most basic way of signalling feedback is with a simple LED to show an on/off status. A more interesting form is using an RGB LED to not only be able to show status with on/off but also by colour, and this is the route I decided to take for STJORN.
The simplest form of an RGB LED is the four lead variant - these have either a common anode or cathode, and then 3 of the opposite; one for each colour; effectively three LEDs in a single case. By activating each LED you can obtain a mix of red, green, and blue. Simple to achieve but has some downsides - this form is only capable of producing 7 colours (red, blue, green, cyan, yellow, magenta, and white) without having to resort to using variable resistors or PWM, and also requires three output pins on the micro-controller for each LED.
STJORN was to have 14 LEDs so using the four-lead type of LED would have required 42 pins...
The answer is to use addressable RGB LEDs. These are essentially a four-lead RGB LED along with a WS2812 controller. A commonly used version of these is Adafruit’s ‘Neopixel’ range which comes in a variety of forms. The version I am using is a generic 5mm through hole version but does exactly the same.
What the WS2812 does which makes this type of RGB LED so easy is two-fold:
The controller handles colour mixing and so hundreds of different colours are possible
Each individual LED is addressed and controlled by a single wire bus - this means hundreds of LEDs can be controller using a single pin on the micro controller!
Although this form is slightly more expensive than a basic four-lead version, the advantages are huge when using more than a couple of LEDs and worth every penny!
LEDs are great for showing a status of some particular feature, but for more detailed feedback an alphanumeric display of some form is usually required. There are many choices - LCD, OLED, multi-segement LED, LED matrix, etc - but what I settled on for STJORN was to use 14-segment LED alphanumeric screens.
The reason I chose this form is that although the text display may be rudimentary compared to LCD or OLED, this can actually be a bonus as the text is big and clear. The STJORN controller doesn’t really need to show a huge amount of text, but clarity is key and so this form won.
In a similar way to RGB LEDs, the ‘simplest’ form of multi-segment display is where each segment is treated like an individual LED. Each LED is assigned it’s own pin on the micro-controller and by turning each segment on and off you get your letters and numbers. However, here we have an even bigger problem than the RGB LEDs - the STJORN display is to have 12 characters, each with 14 segments in, and so requiring a grand total of 168 pins on the micro controller! This can be made less using matrixing etc, but there is a much simpler way...
As RGB LEDs are available with a controller, so are multi-segment displays. The ones I am using are Adafruit’s 14-segment backpacks - these are a small circuit board which attaches directly to the display ‘segments’ and allows the display to be controlled using the i2c protocol.
Each display ‘block’ is two characters and each backpack controls two blocks, therefore STJORN required three backpacks. The i2c protocol is a two-wire system and like the RGB LEDs, each display is addressed so multiple displays can be used with the same i2c bus and only needs two pins total on the micro-controller! The other benefit is that using the Adafruit’s library for these displays they can be controlled as simply as telling each character to display an ASCII character rather than having to control each individual segment (although this can be done as well if required).
By using both these forms, I was able to design STJORN with 14 RGB LEDs and 12 characters worth of alphanumeric display all whilst only taking up 3 pins on the Teensy controller and making them very easy to control.