Introduction: Minimal Arduino Sound Effect Box

This is a quick project of a sound effect box.
The device reads a prerecorded wav file from a microSD assigned to a specific button and plays it when pressed.

Step 1: You Will Need :

Arduino pro mini (or other)
microSD module
A speaker with TRS (mic / aux) connection
Female TRS connector
4 Push Buttons
4 220ohm Resistors
Battery holder and batteries - I used the 2 CR2032 coin batteries but you can use other
Double sided male TRS (headphone) cable

Step 2: Connections

Each buttons connected to VCC and through a 220ohm resistor to GND (for pulling down false current on the cable) ahead of the resistor each button connected to the Arduino's digital pins 5,6,7,8.

The TRS connector is connected to GND and to the Arduino's 9th digital pin.

The microSD module is connected to the Arduino as follow :
Vcc => Vcc
MISO => 12
MOSI => 11
CS => 4
SCK => 13

The battery + is connected to RAW and - to GND

Step 3: Setting the Wave Files

The wav files should be at 16000khz 8bit mono.
Name them by the button number you are going to assign them (1,2,3,4)

You can use this site to convert your files

Step 4: The Code

The code uses 2 libraries you should make sure you have (if you don't download them through the lib manager) :

#include                            //include SD module library
#include //include speaker control library #define SD_ChipSelectPin 4 //define CS pin #define B1 5 //4 buttons pins connections #define B2 6 #define B3 7 #define B4 8 TMRpcm tmrpcm; //crete an object for speaker library void setup() { Serial.begin (9600); pinMode (5, INPUT); //4 bottons initialise as INPUTS pinMode (6, INPUT); pinMode (7, INPUT); pinMode (8, INPUT); tmrpcm.speakerPin = 9; //define speaker pin. //you must use pin 9 of the Arduino Uno and Nano //the library is using this pin if (!SD.begin(SD_ChipSelectPin)) { //see if the card is present and can be initialized return; //don't do anything more if not } tmrpcm.setVolume(6); //0 to 7. Set volume level"start.wav"); //the sound file "1" will play each time the arduino powers up, or is reset } void loop() { // Serial.println (digitalRead (8)); if (digitalRead (B1)) { Serial.println ("B1");"1.wav"); delay (100); } if (digitalRead (B2)) { Serial.println ("B2");"2.wav"); delay (100); } if (digitalRead (B3)) { Serial.println ("B3");"3.wav"); delay (100); } if (digitalRead (B4)) { Serial.println ("B4");"4.wav"); delay (100); } }

Step 5: Final Connections...

Connect the device through the TRS connector with the TRS cable to the speaker.
Connect the device to power and turn it ON

...HAVE FUN...

Arduino Contest 2019

Participated in the
Arduino Contest 2019