Friday, 6 November 2015

Full colour guitar LED neck with WS2812B RGBs

While we've been casting and waiting for resin to go off, we've also been looking at our guitar LED system. It works quite nicely, but it somehow seems to be lacking that "wow" factor. Or maybe it's just because until now, we've not really come up with anything "new" - just recreated existing guitar light systems, like the FretLight guitar.

It was while pondering how to really make our effort stand apart from the crowd, that someone suggested a full-colour RGB system.

The good old WS2182B RGB LED. To this day, I can't bring myself to call them "neopixels". I think the idea of "neopixels" along with the Arduino plug-n-play style approach to coding is pretty limiting in a lot of respects. Neopixels are what WS2812B LEDs become when sold through the Adafruit store. But I can't help but make the distinction - in much the same way an AVR ATMega328P microcontroller is not an Arduino (even though it is used in most Arduino Uno boards).

Anyway, with all that out of the way, we finally settled on using an AVR (and, yes, the pre-built FastLED libraries for Arduino) to drive an array of RGB LEDs. But that's only because when I shared my PIC-based code to do the same thing on a 32Mhz 16F1825 a few of the nerds said "if you built it in Arduino, we could share code" (although "share code" doesn't mean "work together on this project" as I often expect it to, and more often means "give me what you've done, once you've written and debugged it, and I'll make demands on what else I want it to do in the future" - but that's a whole other rant about why I personally don't usually bother much with building projects on the Arduino platform!)

So having agreed to "share code" and use the Arduino platform, we set about building a RGB LED matrix to replace our shift-register based, single-colour LED guitar board(s).

The great thing about the WS2812B LEDs is that they are easily daisy-chained, making laying out the circuit board quite easy - even for etch-at-home, single-sided boards.

As the LEDs could end up drawing a bit of current (each one up to 60mA at full 100% white brightness) a single, snaking power line is unlikely to be able to handle the current requirements. So we redesigned the board, added some through-holes and ran some big wide copper strips up the back!

Big, wide, copper strips are connected to the front of the circuit board.... using some 1mm PCB rivets and plenty of solder!

A bit of Arduino-style copy-and-paste coding, and the LEDs were soon lit up

(so far we've only soldered up six out of a possible nine "frets" or columns of LEDs, but enough to prove that the concept works - the circuit design is then repeated across a number of sections to create one, large, fingerboard-length circuit.)

We added an LCD screen and rotary encoder, and built a simple menu system to allow the user to select from a number of options, including setting the brightness, the default LED colour, serial baud rate and so on.

We also added a serial/I2C eeprom chip, so that we could store multiple "patterns" to display on the LEDs. A simple protocol allows us to define a 16-colour palette, and then display any pattern (or image if you want to think of them like that) on the LEDs. Here's an early development version being tested:

Current functionality includes:
  • change overall brightness
  • set the key and scale type (major/minor)
  • change between midi and serial data mode
  • set serial baud rate (most common baud rates supported)
  • load and display patterns from external eeprom
  • play "twinkles" animation
also included (but not shown in the video) are:

  • allow two or more patterns to be displayed on top of each other
  • change between full-colour and monochrome (single, default colour, mode)
Colour patterns and images are currently stored on an external eeprom chip and are displayed by selecting them from the menu. Image/pattern data can also be sent to the device via serial at a number of different baud rates - this would allow an animation to be controlled by an external device (PC or other microcontroller) and sent to the guitar fretboard, allowing interactive, animated patterns to be displayed along the neck during a performance.