Build it step by step
0 of 6 doneWire the sensor
Connect the MPR121 on I2C and upload the sketch.
Check one key
Touch electrode 0 with your finger and hear a note.
Add the clips
Clip each electrode to a different fruit.
Tune
Change the thresholds until all keys respond but none triggers alone.
Pick the notes
Edit NOTES to a scale you prefer.
Play a tune
Touch the fruit in order to play a simple melody.
How do you build a fruit touch piano?
An MPR121 turns bananas, apples or foil pads into piano keys that play notes when touched. You need Arduino Uno R3, MPR121 capacitive touch sensor, Passive buzzer, Crocodile clip test leads (10 pack) and Jumper wires male to male (40 pcs, 20 cm). It takes 6 steps and about 45 minutes.
- Level
- Beginner
- Time
- About 45 min
- Parts
- 5
Parts list
- Development BoardsBuyArduino Uno R3 × 1
- SensorsBuy
- Motors & ActuatorsBuyPassive buzzer × 1
- Connectors
- PrototypingBuy
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| MPR121 VIN, GND | Uno 5V, GND | Power (the usual breakout has a regulator; check yours) |
| MPR121 SDA, SCL | Uno A4, A5 | I2C |
| Passive buzzer + | Uno D8 | Sound |
| Passive buzzer - | Uno GND | Return |
| MPR121 electrodes 0 to 7 | Crocodile clips to fruit or foil pads | Piano keys |
| Your other hand or a clip to GND | MPR121 GND is not required | The body provides the capacitance path |
Code
Arduino IDE, board "Arduino Uno". Install "Adafruit MPR121". Use whole, clean fruit or foil-covered card pads as electrodes and wash hands afterwards; do not eat food that the clips have touched. Hold the fruit or touch with a bare finger: the sensor reads how much your body adds to the capacitance. Raise the thresholds for big, wet objects and lower them for small foil pads.
Runs on a virtual Arduino Uno in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).
#include <Wire.h>
#include <Adafruit_MPR121.h>
Adafruit_MPR121 cap = Adafruit_MPR121();
const int NOTES[8] = { 262, 294, 330, 349, 392, 440, 494, 523 }; // C4 up to C5
const byte BUZZER = 8;
void setup() {
Serial.begin(9600);
if (!cap.begin(0x5A)) { Serial.println("MPR121 not found"); while (true); }
cap.setThresholds(12, 6); // touch and release thresholds; raise for large objects
}
void loop() {
uint16_t touched = cap.touched();
int note = 0;
for (byte i = 0; i < 8; i++) if (touched & (1 << i)) note = NOTES[i]; // the highest touched key wins
if (note) tone(BUZZER, note); else noTone(BUZZER);
delay(10);
}Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| Nothing touched | Silent |
| Touch a fruit | Its note plays |
| Two fruits at once | The higher note plays |
| Release | Sound stops |
If it does not work
MPR121 not found
Check I2C wiring and its supply voltage.
Keys trigger by themselves
Raise the touch threshold or move the clips apart.
Some keys do not react
Lower the thresholds or touch more firmly.
Notes are scratchy
A passive buzzer is harsh. Try a small speaker with a 100 Ω resistor.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the fruit touch piano?
Arduino Uno R3, MPR121 capacitive touch sensor, Passive buzzer, Crocodile clip test leads (10 pack) and Jumper wires male to male (40 pcs, 20 cm).
How long does the fruit touch piano take to build?
About 45 minutes for a beginner maker, in 6 steps.
How do I know the fruit touch piano works?
Nothing touched: Silent. Touch a fruit: Its note plays. Two fruits at once: The higher note plays.
MPR121 not found: what should I check?
Check I2C wiring and its supply voltage.
Keys trigger by themselves: what should I check?
Raise the touch threshold or move the clips apart.
Some keys do not react: what should I check?
Lower the thresholds or touch more firmly.
Notes are scratchy: what should I check?
A passive buzzer is harsh. Try a small speaker with a 100 Ω resistor.
