RING RING RING RING RING RING RING BANANAPHONE
This project transforms everyday fruits into a playful and interactive MIDI instrument using the MPR121 capacitive touch sensor. By attaching 12 different fruits (like bananas) to the sensor, each fruit becomes a musical note, allowing you to play melodies just like on a piano but with a fun twist.
- Arduino-compatible microcontroller (RP2040 tested)
- MPR121 Capacitive Touch Sensor
- 12 pieces of conductive material (fruits like bananas, apples, etc.)
- Jumper wires
- USB cable for USB MIDI
- A spdt or spst switch (optional, for switching octave)
- A button (optional, for cycling scales)
- Arduino IDE
- Adafruit MPR121 Library
- Adafruit TinyUSB Library
- MIDI Library
- Connect the MPR121 sensor to your microcontroller using I2C (SDA to 16, SCL to 17).
- Connect the ground and VCC of the MPR121 to the microcontroller.
- Attach each fruit to one of the 12 capacitive touch inputs on the MPR121.
- Connect the center pin of the octave switch to 14 and one of the pins of each switch to ground
- Connect one side of the scale button to 15 and the other side to ground
- Install the required libraries (
Adafruit_MPR121
,Adafruit_TinyUSB
,MIDI
) in the Arduino IDE. - Load the provided code onto your microcontroller.
- If using a MIDI to USB interface, connect the microcontroller to the MIDI device. Be sure to select
Adafruit TinyUSB
under Tools > USB stack - If you can't get it to upload, unplug the usb, then plug it back in while holding down the boot button (may be a different button depending on the model of RP2040)
- Touching each fruit will send a MIDI note corresponding to its position in the selected musical scale (Major, Minor, or Chromatic).
- The octave can be changed using a designated switch attached to the microcontroller.
- The scale can be changed using a designated switch attached to the microcontroller.
setup()
: Initializes the MPR121 sensor, MIDI configurations, and other necessary setups.loop()
: Constantly checks for touch inputs and sends MIDI signals based on the touched fruit.handleNoteOn()
andhandleNoteOff()
: Handle the sending of MIDI note on and off messages.getNoteOffset()
: Determines the note to be played based on the selected scale and the position of the touch input.
- You can modify the
currentScale
variable to switch between different scales. - Add additional scales by defining them as arrays and adding corresponding cases in the
getNoteOffset
function.
Contributions to this project are welcome. Feel free to fork the repository, make your changes, and submit a pull request.