Build it step by step
0 of 8 doneWire the piezo
Brass to GND, ceramic to A0.
Add the bleed resistor
1 megohm from A0 to GND.
Add the clamp diodes
One each to GND and 5V, in the directions shown.
Wire the buzzer
D8 and GND.
Upload the sketch
Open the serial monitor.
Tap the disc
Peak value and a note.
Tape it under foam
Try soft and hard hits.
Tune the threshold
Raise it if the pad triggers by itself.
How do you build a piezo drum pad?
A piezo disc under a rubber pad detects hits and their strength, and a buzzer plays a longer, higher note for a harder hit. You need Arduino Nano, Piezo disc buzzer element, Resistor 1 MΩ, Signal Diode 1N4148 × 2, Passive buzzer, Jumper wires male to male (40 pcs, 20 cm) and Breadboard 830 Tie Points. It takes 8 steps and about 150 minutes.
- Level
- Beginner
- Time
- About 150 min
- Parts
- 7
Parts list
- Development BoardsBuyArduino Nano × 1
- Motors & ActuatorsBuy
- PassivesBuyResistor 1 MΩ × 1
- SemiconductorsBuy
- Motors & ActuatorsBuyPassive buzzer × 1
- PrototypingBuy
- PrototypingBuy
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| Piezo disc brass side (outer disc) | Nano GND | Ground side of the sensor |
| Piezo disc ceramic side (centre) | Nano A0 | Signal, voltage rises on a hit |
| 1 megohm resistor | Between A0 and GND | Bleeds the charge so the signal falls back |
| 1N4148 diode 1 | Anode to GND, cathode to A0 | Clamps negative spikes |
| 1N4148 diode 2 | Anode to A0, cathode to Nano 5V | Clamps spikes above 5 V |
| Passive buzzer positive | Nano D8 | Tone output |
| Passive buzzer negative | Nano GND | Common ground |
Code
A piezo disc is a thin ceramic layer on a brass plate that makes a voltage when it is squeezed or flexed, so a tap becomes a short voltage spike. That makes it a good hit sensor for a drum pad. The spike can be far larger than 5 volts if the disc is struck hard, so two small diodes clamp it: one stops the signal going below ground and one stops it going above the supply, which protects the analog input. A 1 megohm resistor across the disc lets the charge drain away so the signal falls back to zero after each hit. The sketch waits until the reading passes a small threshold, then watches the next three milliseconds to catch the highest value, which is the peak and tells you how hard the hit was. It maps that peak to a note and a length, so a soft tap gives a short low note and a hard hit gives a longer, higher one. A passive buzzer cannot change its volume, so pitch and length stand in for loudness. After each hit the sketch pauses for 60 milliseconds so the ringing does not trigger extra notes. Tape the disc under a piece of foam or rubber for a pad.
Runs on a virtual Arduino Nano 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).
const int PAD = A0, BUZZ = 8;
const int THRESHOLD = 30; // raw counts, 0 to 1023, ignore small vibrations
const unsigned long LOCKOUT_MS = 60; // ignore the ringing after a hit
void setup() {
Serial.begin(9600);
Serial.println("Hit the pad. Peak values print here.");
}
void loop() {
int v = analogRead(PAD);
if (v > THRESHOLD) {
int peak = v;
unsigned long t0 = micros();
while (micros() - t0 < 3000) { // watch the next 3 ms for the highest value
v = analogRead(PAD);
if (v > peak) peak = v;
}
int p = constrain(peak, THRESHOLD, 800);
int freq = map(p, THRESHOLD, 800, 200, 1200); // harder hit, higher note
int dur = map(p, THRESHOLD, 800, 40, 220); // harder hit, longer note
tone(BUZZ, freq, dur);
Serial.print("Peak "); Serial.print(peak);
Serial.print(" note "); Serial.print(freq);
Serial.println(" Hz");
delay(LOCKOUT_MS);
}
}What the serial monitor should show
Open the serial monitor at the baud rate in the code. This is what our simulator prints for a virtual Arduino Nano with its sensors at their default values. Your numbers will follow your real readings, but the format should match.
Hit the pad. Peak values print here. Peak 513 note 827 Hz
Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| Light tap | Peak about 40 to 150, short low note |
| Hard hit | Peak 500 or more, longer higher note |
| No contact | No readings |
| Clamp diode check | Readings never exceed 1023 or go odd on a hard hit |
| Hit twice quickly | Two separate notes |
If it does not work
Triggers by itself
Raise THRESHOLD or move the disc away from vibrating surfaces.
No readings
Check the brass goes to GND and the ceramic to A0.
Only low values
Press the disc harder against the surface or loosen the pad.
Extra notes after one hit
Increase LOCKOUT_MS.
Buzzer silent
Use a passive buzzer, polarity matters on some.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the piezo drum pad?
Arduino Nano, Piezo disc buzzer element, Resistor 1 MΩ, Signal Diode 1N4148 × 2, Passive buzzer, Jumper wires male to male (40 pcs, 20 cm) and Breadboard 830 Tie Points.
How long does the piezo drum pad take to build?
About 150 minutes for a beginner maker, in 8 steps.
How do I know the piezo drum pad works?
Light tap: Peak about 40 to 150, short low note. Hard hit: Peak 500 or more, longer higher note. No contact: No readings.
Triggers by itself: what should I check?
Raise THRESHOLD or move the disc away from vibrating surfaces.
No readings: what should I check?
Check the brass goes to GND and the ceramic to A0.
Only low values: what should I check?
Press the disc harder against the surface or loosen the pad.
Extra notes after one hit: what should I check?
Increase LOCKOUT_MS.
