Build it step by step
0 of 7 doneMount the piezo discs
Stick each to the underside of a foam or card pad so a tap on top transfers vibration.
Add the resistors
1 MΩ across each disc and 100 kΩ in series to the analog pin.
Wire the DFPlayer
TX to D10, RX to D11 through 1 kΩ, speaker to its SPK pins.
Load the sounds
Copy four drum samples to the card with the names 0001.mp3 to 0004.mp3.
Upload and tap
Each pad plays its sound. Adjust THRESHOLD to match how hard you tap.
Record
Press the record button, play a pattern, press again to stop, press a third time to play it back.
Tune
Change the lockout time for fast rolls.
How do you build a kids' drum pad toy?
Four piezo pads play drum sounds through a speaker, with a record-and-play-back button. You need Arduino Nano, Piezo disc buzzer element × 4, Resistor 1 MΩ × 4, Resistor 100 kΩ × 4, DFPlayer Mini MP3 module, Speaker 8 Ω 0.5 W, SanDisk microSD card 32 GB (A1, Class 10), Tactile push button 6 mm, Resistor 1 kΩ and Jumper wires male to male (40 pcs, 20 cm). It takes 7 steps and about 120 minutes.
- Level
- Beginner
- Time
- About 120 min
- Parts
- 10
Parts list
- Development BoardsBuyArduino Nano × 1
- Motors & ActuatorsBuy
- PassivesBuyResistor 1 MΩ × 4
- PassivesBuyResistor 100 kΩ × 4
- InterfacesBuy
- Motors & ActuatorsBuy
- SBC AccessoriesBuy
- SwitchesBuy
- PassivesBuyResistor 1 kΩ × 1
- PrototypingBuy
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| Each piezo disc | 1 MΩ across it, then 100 kΩ in series to Nano A0 to A3 | Pad 1 to 4, the resistor bleeds the charge |
| Piezo other wire | Nano GND | Common ground |
| DFPlayer VCC and GND | Nano 5V and GND | Supply |
| DFPlayer TX | Nano D10 | Data to the Nano |
| DFPlayer RX | Nano D11 through 1 kΩ | Data from the Nano |
| DFPlayer SPK_1 and SPK_2 | Speaker | Sound |
| microSD card | DFPlayer slot | Files 0001.mp3 to 0004.mp3 as drum sounds |
| Record button | Nano D7 and GND | Record, then play back |
Code
Arduino IDE, board "Arduino Nano" (processor ATmega328P, or ATmega328P (Old Bootloader) for clones). Install "DFRobotDFPlayerMini". Put the four drum samples on a FAT32 microSD as 0001.mp3 to 0004.mp3, in the order of the pads. Piezo discs can produce spikes much higher than 5 V on a hard hit, so the 100 kΩ series resistors protect the analog inputs, and the 1 MΩ resistors drain them. Small taps are fine, but do not hit the discs with hard objects.
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).
#include <SoftwareSerial.h>
#include <DFRobotDFPlayerMini.h>
SoftwareSerial ss(10, 11); // RX, TX
DFRobotDFPlayerMini dfp;
const byte PAD[4] = {A0, A1, A2, A3};
const byte REC = 7;
const int THRESHOLD = 120;
unsigned long lastHit[4] = {0, 0, 0, 0};
struct Hit { byte pad; unsigned long t; };
Hit tape[64];
byte tapeLen = 0;
bool recording = false;
unsigned long recStart = 0;
void setup() {
pinMode(REC, INPUT_PULLUP);
ss.begin(9600);
dfp.begin(ss);
dfp.volume(22);
}
void playPad(byte p) { dfp.play(p + 1); }
void loop() {
for (byte p = 0; p < 4; p++) {
if (analogRead(PAD[p]) > THRESHOLD && millis() - lastHit[p] > 150) { // a hit, with a lockout
lastHit[p] = millis();
playPad(p);
if (recording && tapeLen < 64) { tape[tapeLen++] = {p, millis() - recStart}; }
}
}
if (digitalRead(REC) == LOW) {
delay(250);
if (!recording && tapeLen == 0) { recording = true; recStart = millis(); } // first press: record
else if (recording) { recording = false; } // second press: stop
else { // third press: play back
unsigned long start = millis();
for (byte i = 0; i < tapeLen; i++) { while (millis() - start < tape[i].t) {} playPad(tape[i].pad); }
tapeLen = 0; // clear for a new take
}
}
}Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| Tap pad 1 | Plays 0001.mp3 |
| Hit each pad | Four different sounds |
| Record then play back | The pattern repeats with its timing |
| Light tap | Registers above the threshold |
If it does not work
No sound
The SD card is not FAT32 or the files are named wrongly. Check the DFPlayer's LED.
Double triggers
Raise the lockout time or the threshold.
Pads trigger each other
Mount each pad separately so vibration does not carry.
Buzzing speaker
Power from a good supply and keep the speaker lead short.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the kids' drum pad toy?
Arduino Nano, Piezo disc buzzer element × 4, Resistor 1 MΩ × 4, Resistor 100 kΩ × 4, DFPlayer Mini MP3 module, Speaker 8 Ω 0.5 W, SanDisk microSD card 32 GB (A1, Class 10), Tactile push button 6 mm, Resistor 1 kΩ and Jumper wires male to male (40 pcs, 20 cm).
How long does the kids' drum pad toy take to build?
About 120 minutes for a beginner maker, in 7 steps.
How do I know the kids' drum pad toy works?
Tap pad 1: Plays 0001.mp3. Hit each pad: Four different sounds. Record then play back: The pattern repeats with its timing.
No sound: what should I check?
The SD card is not FAT32 or the files are named wrongly. Check the DFPlayer's LED.
Double triggers: what should I check?
Raise the lockout time or the threshold.
Pads trigger each other: what should I check?
Mount each pad separately so vibration does not carry.
Buzzing speaker: what should I check?
Power from a good supply and keep the speaker lead short.
