Projects / Sound effects board

Sound effects board

Beginner1 hGuided buildReviewed

Build it step by step

0 of 7 done
  1. NANO

    Test the keypad

    Print each key on the serial monitor.

  2. NANODFPLAYSANDIS

    Prepare the card

    Copy 16 MP3 files named 0001 to 0016.

  3. NANO

    Test the player

    Play track 1 from code.

  4. NANO

    Join them

    Play the track for the key pressed.

  5. NANO

    Add the volume knob

    Map the pot to 0 to 30.

  6. NANO

    Label the keys

    Write the sound name on each.

  7. NANOABS

    Box it

    Cut a window and speaker holes.

In short

How do you build a sound effects board?

Twelve buttons each play a sound effect from an SD card, for plays, games or classroom quizzes. You need Arduino Nano, DFPlayer Mini MP3 module, Speaker 8 Ω 0.5 W, 4x4 matrix keypad (membrane), SanDisk microSD card 32 GB (A1, Class 10), Resistor 1 kΩ, ABS project box (100 × 60 × 25 mm) and Potentiometer 10 kΩ. It takes 7 steps and about 60 minutes.

Level
Beginner
Time
About 60 min
Parts
8

Parts list

Tick what you already own. It saves to My Garage, so “Build with what I have” knows.

Wiring

FromToWhy
Keypad pins 1 to 4 (rows)Nano D2, D3, D4, D5Row scan
Keypad pins 5 to 8 (columns)Nano D6, D7, D8, D9Column scan
DFPlayer VCC and GNDNano 5V and GNDPower
DFPlayer TXNano D10Replies
DFPlayer RXNano D11 through a 1 kΩ resistorCommands
DFPlayer SPK1 and SPK2SpeakerSound
Volume pot wiperNano A0 (ends to 5 V and GND)Volume knob

Code

The keypad scan finds which of the 16 keys was pressed and the code looks up its track number, so key 1 plays 0001.mp3 and key D plays 0016.mp3. Name the files in the order of the keys and stick a label with the sound name on each button. The DFPlayer reads MP3 files from a FAT32 SD card; put short effects on the card in the order you want them. Use a 1 kΩ resistor on the DFPlayer's RX pin to stop noise on the serial line. The speaker connects straight to the DFPlayer for about 3 W; for a bigger sound add a small amplifier. Keep the volume modest around children's ears. Use only a 5 V USB supply. A project box with a drilled keypad window and a speaker grille makes it sturdy for a classroom. Arduino IDE, board "Arduino Nano" (try the Old Bootloader option if the upload fails).

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).

// Sound effects board. Libraries: Keypad (Mark Stanley), DFRobotDFPlayerMini. Board: Arduino Nano.
// SD card: files 0001.mp3 to 0016.mp3 in the root folder, one per key.
#include <Keypad.h>
#include <SoftwareSerial.h>
#include <DFRobotDFPlayerMini.h>

const byte ROWS = 4, COLS = 4;
char keys[ROWS][COLS] = {{'1','2','3','A'},{'4','5','6','B'},{'7','8','9','C'},{'*','0','#','D'}};
byte rowPins[ROWS] = {2, 3, 4, 5}, colPins[COLS] = {6, 7, 8, 9};
Keypad pad = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);

SoftwareSerial mp3(10, 11);
DFRobotDFPlayerMini player;
int lastVol = -1;

int trackFor(char k) {                                   // map each key to a track number 1 to 16
  const char order[16] = {'1','2','3','A','4','5','6','B','7','8','9','C','*','0','#','D'};
  for (int i = 0; i < 16; i++) if (order[i] == k) return i + 1;
  return 0;
}

void setup() {
  mp3.begin(9600);
  player.begin(mp3);
  player.volume(15);
}

void loop() {
  int v = map(analogRead(A0), 0, 1023, 0, 30);
  if (abs(v - lastVol) > 1) { player.volume(v); lastVol = v; }     // volume knob, only when it moves
  char k = pad.getKey();
  if (k) {
    int t = trackFor(k);
    if (t) player.play(t);                               // a new press replaces the sound that is playing
  }
}

Test checklist

What you should see at each check. If a reading is far off, stop and use the troubleshooting list.

CheckExpected
Press key 1Sound 1 plays
Press another keyReplaces the first sound
Turn the knobVolume changes
Power off and onAll sounds still work

If it does not work

No sound

Check the card is FAT32 and the files are named correctly.

Wrong sound

Check the order of the file names against the key order.

Keys do nothing

Check the keypad pin order.

Hiss

Add the 1 kΩ resistor and use a better supply.

Still stuck? Find the fault step by step with your multimeter →

Ask Lark AI

Common questions

What parts do I need for the sound effects board?

Arduino Nano, DFPlayer Mini MP3 module, Speaker 8 Ω 0.5 W, 4x4 matrix keypad (membrane), SanDisk microSD card 32 GB (A1, Class 10), Resistor 1 kΩ, ABS project box (100 × 60 × 25 mm) and Potentiometer 10 kΩ.

How long does the sound effects board take to build?

About 60 minutes for a beginner maker, in 7 steps.

How do I know the sound effects board works?

Press key 1: Sound 1 plays. Press another key: Replaces the first sound. Turn the knob: Volume changes.

No sound: what should I check?

Check the card is FAT32 and the files are named correctly.

Wrong sound: what should I check?

Check the order of the file names against the key order.

Keys do nothing: what should I check?

Check the keypad pin order.

Hiss: what should I check?

Add the 1 kΩ resistor and use a better supply.