Music Controlled Raspberry Pi Lights Change Color by Playing Piano

Raspberry Pi projects don’t have to be complex to be incredible and this Pi project is a shining example. RandomBrasilian has created a Raspberry Pi Zero-powered set of Christmas lights that react to different musical notes played on a keyboard. According to the original post shared to Reddit, this was their first Pi project ever making the creation that much more impressive.

My_first_pi_project_digital_piano_pi_zero_xmas from r/raspberry_pi

In our experience, some of the best Raspberry Pi projects have a few iterations before reaching their final design. We reached out to RandomBrasilian who explained that a prototype was created using Philips Hue lights connected to their computer. But to make things more dynamic, they decided to use WS2811 Christmas lights and to power the project with a Raspberry Pi Zero instead of a PC.

Article continues below

The keyboard outputs data to the Pi via USB in the form of MIDI. This input is read using Mido lib, a Python library created for working with MIDI input. As each note is recognized, the next light in the string changes to a predetermined corresponding color. Another concept that failed to make it to the final product was the idea to illuminate a light only while the note is played but as only one light shows at a time, this proved to be much less dazzling.

Check out the original thread from Reddit for a demo video of these lights in action and be sure to follow RandomBrasilian for updates on this exciting Pi project.

Ash Hill
Contributing Writer