Introduction: Magic Sound Suitcase

Hello there!!

Today I will be explaining how me and my team made a 'attention grabbing suitcase' that plays sounds on demand :)

The suitcase is dirty and worn on the outside, but within lays a great secret!

Step 1: Get Yourself a Suitcase, Arduino and More.

For this project you wil need:

  • A suitcase or box like object (preferably with lid).
  • A big red button.
  • Some smaller buttons for every song or sound you want to be able to play.
  • A wooden board (I suggest mDF or something else cheap).
  • A wooden stick to be cut into pieces of around 7cm (to fit the board onto inside the casing).
  • A powerbank
  • A speaker (for this project we used a bluetooth speaker that functions as a powerbank aswell).
  • A 3mm Audio jack
  • An Arduino DUE
  • An Arduino Audio Shield with SD card reader.

The first thing to do is to get yourself a worn old suitcase or something else that looks like a box. In this you will fit your electronics.

Step 2: Cut the Wooden Board and the Stick to Size.

In this step you will need to measure and cut the board to fit the insides of the suitcase. After that you will need to measure the height of the inside of the case so that you can cut the stick into 6 (or more) pieces the height of the case to support the wooden board you just cut.

After you cut the stick and the board you apply the cut pieces of the stick onto the board (preferably the corners), so that they suppor the board inside the case.

Step 3: Drill Holes in the Board.

To fit the buttons into the board you will need to drill holes into the board.

Step 4: Fit the Buttons Into the Board and Start Soldering.

After you cut the holes in the board and fitted the buttons, it is time to start soldering the buttons. For this project we used 1 big red button as a play/pause button and 3 smaller buttons to select songs.

Step 5: Start Configuring the Arduino

After you soldered the buttons, apply the arduino due to the board alongside the shield. Plug the 3.6mm jack into the shield and the speaker and power the arduino.

Use this code:

// --------------------------------- AUDIO SHIELD --------------------------------- //
// include SPI, MP3 and SD libraries #include #include #include

// define the pins used #define CLK 13 // SPI Clock, shared with SD card #define MISO 12 // Input data, from VS1053/SD card #define MOSI 11 // Output data, to VS1053/SD card // Connect CLK, MISO and MOSI to hardware SPI pins. // See http://arduino.cc/en/Reference/SPI "Connections"

// These are the pins used for the music maker shield #define SHIELD_RESET -1 // VS1053 reset pin (unused!) #define SHIELD_CS 7 // VS1053 chip select pin (output) #define SHIELD_DCS 6 // VS1053 Data/command select pin (output)

// These are common pins between breakout and shield #define CARDCS 4 // Card chip select pin // DREQ should be an Int pin, see http://arduino.cc/en/Reference/attachInterrupt #define DREQ 3 // VS1053 Data request, ideally an Interrupt pin

Adafruit_VS1053_FilePlayer musicPlayer = Adafruit_VS1053_FilePlayer(SHIELD_RESET, SHIELD_CS, SHIELD_DCS, DREQ, CARDCS);

// --------------------------------- PINS --------------------------------- // const int BigKnobLEDPin = 23; const int Knob1LEDPin = 25; const int Knob2LEDPin = 27; const int Knob3LEDPin = 29;

const int BigKnobButtonPin = 31; const int Knob1ButtonPin = 33; const int Knob2ButtonPin = 35; const int Knob3ButtonPin = 37;

int BigKnobButtonState = HIGH; int Knob1ButtonState = HIGH; int Knob2ButtonState = HIGH; int Knob3ButtonState = HIGH;

bool BigKnobLEDState = false; bool Knob1LEDState = false; bool Knob2LEDState = false; bool Knob3LEDState = false;

// 0: off, 1: on, 2: blink int BigKnobLEDType = 1; int Knob1LEDType = 1; int Knob2LEDType = 1; int Knob3LEDType = 1;

int selectedSong = 0;

bool isPlaying = false; int playingSong = 0;

// -------------------------------- SETUP -------------------------------- // void setup() { // ----------------- Pin setup ----------------- // // Output pinMode(BigKnobLEDPin, OUTPUT); pinMode(Knob1LEDPin, OUTPUT); pinMode(Knob2LEDPin, OUTPUT); pinMode(Knob3LEDPin, OUTPUT); // Input pullup pinMode(BigKnobButtonPin, INPUT_PULLUP); pinMode(Knob1ButtonPin, INPUT_PULLUP); pinMode(Knob2ButtonPin, INPUT_PULLUP); pinMode(Knob3ButtonPin, INPUT_PULLUP);

// ------------------ Serial ------------------ // Serial.begin(9600); Serial.println("Don't judge a book by it't koffer");

// ------------------ AUDIO SHIELD ------------------ // if (! musicPlayer.begin()) { // initialise the music player Serial.println(F("Couldn't find VS1053, do you have the right pins defined?")); while (1); } Serial.println(F("VS1053 found")); if (!SD.begin(CARDCS)) { Serial.println(F("SD failed, or not present")); while (1); // don't do anything more } // Set volume for left, right channels. lower numbers == louder volume! musicPlayer.setVolume(1,1);

musicPlayer.useInterrupt(VS1053_FILEPLAYER_PIN_INT); // DREQ int }

void loop(){ if (musicPlayer.stopped()) { // TODO: Done playing } checkPins(); handleLeds(); delay(1); }

void checkPins(){ int BigKnobButtonStateTMP = digitalRead(BigKnobButtonPin); int Knob1ButtonStateTMP = digitalRead(Knob1ButtonPin); int Knob2ButtonStateTMP = digitalRead(Knob2ButtonPin); int Knob3ButtonStateTMP = digitalRead(Knob3ButtonPin);

if(BigKnobButtonStateTMP!=BigKnobButtonState){ BigKnobChanged(BigKnobButtonState, BigKnobButtonStateTMP); BigKnobButtonState = BigKnobButtonStateTMP; } if(Knob1ButtonStateTMP!=Knob1ButtonState){ Knob1Changed(Knob1ButtonState, Knob1ButtonStateTMP); Knob1ButtonState = Knob1ButtonStateTMP; } if(Knob2ButtonStateTMP!=Knob2ButtonState){ Knob2Changed(Knob2ButtonState, Knob2ButtonStateTMP); Knob2ButtonState = Knob2ButtonStateTMP; } if(Knob3ButtonStateTMP!=Knob3ButtonState){ Knob3Changed(Knob3ButtonState, Knob3ButtonStateTMP); Knob3ButtonState = Knob3ButtonStateTMP; } } void handleLeds(){ // ------------------ LED State OFF ------------------ // if(BigKnobLEDType==0){ digitalWrite(BigKnobLEDPin, LOW); BigKnobLEDState = false; } if(Knob1LEDType==0){ digitalWrite(Knob1LEDPin, LOW); Knob1LEDState = false; } if(Knob2LEDType==0){ digitalWrite(Knob2LEDPin, LOW); Knob2LEDState = false; } if(Knob3LEDType==0){ digitalWrite(Knob3LEDPin, LOW); Knob3LEDState = false; }

// ------------------ LED State ON ------------------- // if(BigKnobLEDType==1){ digitalWrite(BigKnobLEDPin, HIGH); BigKnobLEDState = true; } if(Knob1LEDType==1){ digitalWrite(Knob1LEDPin, HIGH); Knob1LEDState = true; } if(Knob2LEDType==1){ digitalWrite(Knob2LEDPin, HIGH); Knob2LEDState = true; } if(Knob3LEDType==1){ digitalWrite(Knob3LEDPin, HIGH); Knob3LEDState = true; }

// ------------------ LED State BLINK ----------------- // if((millis()%500) == 0){ if(BigKnobLEDType==2){ digitalWrite(BigKnobLEDPin, BigKnobLEDState); BigKnobLEDState = !BigKnobLEDState; } if(Knob1LEDType==2){ digitalWrite(Knob1LEDPin, Knob1LEDState); Knob1LEDState = !Knob1LEDState; } if(Knob2LEDType==2){ digitalWrite(Knob2LEDPin, Knob2LEDState); Knob2LEDState = !Knob2LEDState; } if(Knob3LEDType==2){ digitalWrite(Knob3LEDPin, Knob3LEDState); Knob3LEDState = !Knob3LEDState; } } }

void BigKnobChanged(int oldState, int newState){ printStateChanged("BigKnob", oldState, newState); if(newState==0){ if(isPlaying && (selectedSong==playingSong)){ musicPlayer.pausePlaying(true); isPlaying = false; } else if(isPlaying && (selectedSong!=playingSong)){ musicPlayer.stopPlaying(); if(selectedSong==1){ musicPlayer.startPlayingFile("/track001.mp3"); Knob1LEDType = 1; } else if(selectedSong==2){ musicPlayer.startPlayingFile("/track002.mp3"); Knob2LEDType = 1; } else if(selectedSong==3){ musicPlayer.startPlayingFile("/track003.mp3"); Knob3LEDType = 1; } playingSong = selectedSong; } else if(!isPlaying && (selectedSong!=playingSong)){ musicPlayer.stopPlaying(); if(selectedSong==1){ musicPlayer.startPlayingFile("/track001.mp3"); Knob1LEDType = 1; } else if(selectedSong==2){ musicPlayer.startPlayingFile("/track002.mp3"); Knob2LEDType = 1; } else if(selectedSong==3){ musicPlayer.startPlayingFile("/track003.mp3"); Knob3LEDType = 1; } playingSong = selectedSong; isPlaying = true; } else if(!isPlaying && (selectedSong==playingSong)){ musicPlayer.pausePlaying(false); isPlaying = true; } } } void Knob1Changed(int oldState, int newState){ printStateChanged("Knob1", oldState, newState); digitalWrite(Knob1LEDPin, !newState); if(newState==0){ selectSong(1); } } void Knob2Changed(int oldState, int newState){ printStateChanged("Knob2", oldState, newState); digitalWrite(Knob2LEDPin, !newState); if(newState==0){ selectSong(2); } } void Knob3Changed(int oldState, int newState){ printStateChanged("Knob3", oldState, newState); digitalWrite(Knob3LEDPin, !newState); if(newState==0){ selectSong(3); } }

void selectSong(int song){ Serial.print("selectSong: "); Serial.println(song); selectedSong = song; Knob1LEDType = 0; Knob2LEDType = 0; Knob3LEDType = 0;

if(song==1) Knob1LEDType = 2; else if(song==2) Knob2LEDType = 2; else if(song==3) Knob3LEDType = 2; }

void printStateChanged(String id, int oldState, int newState){ Serial.print(id); Serial.print(" Changed. Old: "); Serial.print(oldState); Serial.print(" New: "); Serial.println(newState); }

Step 6: Fix All the Cables Under the Board and Put It in the Suitcase :)

Congratulations! You just made an interactive sound suitcase!