A DIY electronic device that illuminates the keys of any musical keyboard (scales, root note, and more!)
My dad played classical guitar when I was growing up, so I never learned to play piano. I also never learned to play guitar, but it is the piano negligence I regret the most. In the following decades I have studied music theory and synthesis to obsessively analyze my favorite genre of music, but my lack of foundational keyboard-playing skills has been a constant thorn in my side. I want to improvise and make music with my synthesizers, but I don’t have the time or inclination to learn scales via discipline and practice.
What if there was a device that could highlight the keys within any arbitrary scale, identify the root note, and more? Enter the KeyLED.
My goal was to design and build a small electronic device (the KeyLED) that can be paired up with any musical keyboard to light up its keys in pre-programmed ways. I wanted the KeyLED to have a simple interface which can be used without disrupting the musical process, and I designed the lighting system to be adaptable for all possible keyboard configurations (full-size keys, slim keys, mini keys, full piano size 88 keys down to 25 keys). From a software perspective the KeyLED comes pre-loaded with all the possible information a musician might want during composition or improvisation.
My process was:
When I’m making music, I start by deciding what scale I will be playing within. That’s where the problems begin: I don’t have an intuition for which notes/keys belong to my selected scale. The KeyLED should display at a minimum:
When improvising within a scale, the root note serves as the resolution point and is frequently returned to. The KeyLED should display:
And when developing a more complex melody, the intervals of the scale become important. The KeyLED should display:
The biggest design challenge was how to deal with the wide variety of keys found in musical keyboards:
Musical keyboards come in a variety of lengths:
If I were designing a solution for a single keyboard, I could have considered embedding individual LEDs into the keys, but I wanted a solution which is modular and can be used on any keyboard the user desires. LED strips came to the rescue, in particular the ubiquitous WS2812B Individually Addressable Programmable RGB LED Strip, commonly known as NeoPixel:
They are available in a variety of LED sizes (from 2020 [2.0mm x 2.0mm] up to 5050 [5.0mm x 5.0mm]), LED densities (from 30 LEDs/m up to 144 LEDs/m), and total strip lengths, they can be programmed individually, and they are cheap and easily sourced. Considering the possible key widths and keyboard lengths, I went with a 1m strip of 5050-sized LEDs, at the maximum density of 144 LEDs/m:
I needed a way to run this strip along the top of the keys. Referring to the Oxygen 61 MIDI Keyboard (a popular entry-level USB MIDI controller), there are gaps between the keys and the case:
I took advantage of this by designing a small plastic clip which slides into the gaps and holds the LED strip in place:
The clips are easily printed in bulk:
The clip holds the LED strip in place nicely without the use of adhesive:
On higher-end keyboards/synthesizers, these gaps are not present. Users have two options in this case:
Here are the results when using the LED strips built-in adhesive backing on an ASM Hydrasynth:
Having solved the problem of interfacing with a musical keyboard, I moved on to the rest of the device.
For displaying information to the user, I used the ubiquitous backlit 1602 (16 characters, 2 lines) LCD display:
For user input, I used a rotary encoder knob with push-button:
The subtle detents of the rotary knob and the lack of a pre-determined “home” position should be very familiar to users experienced with modern synthesizer interfaces.
For a microcontroller, I went with the smallest Arduino clone - the Pro Micro (based on the ATmega32U4):
The circuit for the KeyLED is quite simple:
The rotary encoder is hooked up to two PWM I/O pins for determining the rotation direction and amount, and the pushbutton is hooked up to its own I/O pin.
The LED strip receives power and a single-wire data line using the proprietary NeoPixel protocol to control individual LED brightness and color. For connecting the LED strip I used a 3-Pin JST-SM connector:
The LCD display receives power, 4 data lines, and 2 control lines.
I threw together a quick protoboard using DIYLC:
After some soldering I had the electronics assembled in a reasonably small volume:
I next worked on an enclosure.
The display needs to be easily viewed by the musician, so I designed a tilt into the enclosure to maximize the LCD viewing angle.
I started by modelling the electronics:
I then designed an enclosure for a perfect fit:
The model is easily printed on an Ender 3:
Everything fits together nicely:
With the KeyLED assembled, I moved on to the software driving it.
I had 2 lines of 16 characters to work with on the LCD display. The most important thing to show the user was their selected scale and root note, so I dedicated the first line of the display to that.
Users only need to change two parameters under normal operation: the root note, and the scale. I handled this by using the rotary encoder pushbutton to switch between parameters, and using a visual indicator of which parameter is selected. Rotating the rotary encoder cycles through all the options.
The first 3 characters are dedicated to the root note, the 4th character is a space, and the remaining 12 characters are used for the name of the scale.
The following is the list of scales (and modes) included:
Once a root note and a scale/mode is selected, the appropriate LEDs on the keyboard are lit in an intuitive way. Root notes are marked with green, and to provide some differentiation between the naturals (white keys) and accidentals (black keys), black keys are marked with red. White keys are marked with white.
This arrangement is intuitive and unambiguous:
I had an additional 16 characters on the second row of the LCD display to convey additional information to the user. When composing or improvising, the musical impact of a series of notes often depends on the interval between them. Of particular importance is the interval between the note and the root note of the scale. I display these intervals to the user, using a standard notation:
The result:
Cycling through some scales:
I wanted the KeyLED to work on any possible combination of key widths and keyboard lengths, so I needed to present the user with a simple way of configuring the KeyLED for their particular keyboard. This was accomplished with a configuration menu which is accessed by a long-press of the rotary encoder push-button.
It offers the following configuration parameters:
Number of keys: Total number of keys present on the keyboard
1st Note on Keyboard: The musical note of the first key on the keyboard using the notation
LED Brightness: Brightness level for all illuminated LEDs
# LEDs total: Total number of LEDs in strip (multiple strips may be strung together to increase this beyond 144)
1st LED position: Moves the first LED position along the strip, to align with the first key on the keyboard
# LEDs per key: How many LEDs to assign to each key, allows for any possible key width
Collapse LED?: If the LEDs and the keys are not perfectly aligned, over time the error accumulates and the LEDs will not line up with the keys underneath them. The LED strips themselves are made up of smaller interconnected strips soldered together, with a gap at the connection point.
This parameter “collapses” two LEDs into a single LED at the selected position, bringing the LEDs and keys back into alignment.
The configuration menu in use:
The KeyLED paired with an ASM Hydrasynth:
Playing around with scales, Vangelis-style:
All of the design files and other information needed to build your own KeyLED can be found here. Enjoy!