An LED strip that reacts to notes played in a keyboard.
As an avid piano player, I was inspired by videos on YouTube where the keys would light up based on the notes played. I wanted to replicate the same effect with a WS2812B LED strip and an Arduino Micro.The program currently has the following lighting modes, rotating between them pressing a connected pushbutton. Optionally, the user can customize the effect by adjusting a potentiometer:
The video above showcases Palette mode (mode 4):
The picture below shows the wiring schematic:
A custom PCB was designed for the project, after verifying that the wiring works with a rough prototype. This simplified the wiring considerably and made it easier to deattach and reattach components such as the power supply, the LED strip and the MIDI cable. Everything was neatly packed in a 3D-printed box.
Multiple challenges were found throughout the project, which spans several years. This gave me invaluable experience in PCB design, 3d-printing, but also the limitations of microcontrollers such as the ATmega32U4.
There's currently a bug where, ocassionally, ghost MIDI messages are received, effectively turning on certain LEDs in an arbitrary manner. The issue is exacerbated when the user plays many notes at once or in quick succession.
After much debugging in such a limited environment, the most plausible cause for it is that MIDI messages are stored in the serial buffer, and it's processed in the main loop where the LEDs are updated. Under certain circunstances, the buffer overflows and we start seeing corrupt data, which might explain why random LEDs light up (because the MIDI messages received are corrupted).
After trying to improve the performance of the program in hopes of avoiding buffer overflows as much as possible, the issue is much less noticeable, but still happens ocassionally. The most ideal solution would be switching to a more powerful board with more memory and processing power, such as the Teensy or the NodeMCU.
Feel free to contact me if you have any questions or comments, or if you'd like to make this for your keyboard.
Here's another video showcasing Velocity mode (mode 5):