The MPR121 is a capacitive touch sensor. Originally produced by Freescale (now NXP), the part is end-of-life but still widely available, especially on breakout boards.
I wrote some code and built a little penny (5 cent actually) organ to test it out. It implements a simple 12-tone (chromatic scale from C5/523.25Hz) organ:
- on interrupt from the MPR121..
- uses the Adafruit_MPR121 library to get touch state via I2C/Wire
- sounds the corresponding tone with a speak on pin 8
As always, all notes, schematics and code are in the Little Electronics & Arduino Projects repo on GitHub
Here’s a quick demo: