/piano-lights-sw

Displays lights (LEDs) over piano keys

Primary LanguageC++MIT LicenseMIT

Piano Lights

Displays lights (LEDs) over piano keys as they are played in real-time. This runs on an Arduino Uno and lights up LEDs on an LED strip by listening for MIDI notes generated by the piano.

Hardware

Here's the hardware used:

Note: This will not work with Neopixel LED strips (WS2811/WS2812/WS2812B), only APA102 LED strips (SK9822 is an APA102 clone). Neopixels require bit banging, which disables interrupts for too long, and interferes with the hardware UART used by the MIDI port. APA102 can use the hardware SPI of the AVR. See the FastLED Wiki page about interrupt problems for more information.

Software

Here's the software used:

How It Works

All the heavy lifting is done by the two libraries. The code reads MIDI note on and off events and turns on a corresponding LED. The LED colors are set using the HSV color space. Each key is mapped the hue, with the low A0 mapped to 0 and high C8 mapped to 255. There are two potentiometers on the MIDI shield. One is mapped to the saturation, and the other the value (brightness).

Demo Video

Demo Video