3.7 C
Saturday, January 13, 2024

Play Music on This Lego Guitar Utilizing Capacitive Buttons and a Raspberry Pi

The idea

Element14 Presents host Katie Dumont isn’t any stranger to integrating electronics into Lego units, as her earlier Lego Raspberry Pi HQ Digicam and Raspberry Pi Lego Prepare initiatives have demonstrated. This time round, her son, John, requested that she take a Lego guitar and make it play actual music with out many modifications, which might require some inventive use of inputs so no electronics might be simply seen.

Capacitive contact sensing

The vast majority of toy guitars depend on built-in pushbuttons to sign {that a} be aware needs to be performed when it’s pressed, however on account of the truth that this guitar is supposed to be taken aside, the answer is much from very best. As a substitute, capacitive contact sensors can be utilized similar to a traditional pushbutton, besides they use the physique’s pure electrical discipline to detect adjustments in a conductor’s capacitance and report it again by way of a sensor. For her mission, Dumont chosen the Seeed Studio MPR121 Contact Sensor Board which communicates over I2C and may sense throughout a number of channels.


Primarily based on a Raspberry Pi 3A, the Python program that Dumont wrote begins with initializing the MPR121 sensor by writing a number of configuration values and clearing any current information. Subsequent, it enters into an infinite loop that repeatedly checks the MPR121 for which, if any, channels have been touched, and if they’ve, play the related sound by way of the Pygame library.

Taking part in the guitar

As soon as the copper tape was in place and lined with a skinny color-matched vinyl wrap, John acquired to jam out together with his new Lego guitar. Making issues much more convincing is how Dumont positioned the Pi, its speaker, and amp right into a mini Lego electrical guitar amp, thus finishing the set. To see extra about how this mission was made, you’ll be able to watch the video right here on the Element14 Presents YouTube channel.

Latest news
Related news


Please enter your comment!
Please enter your name here