Introduction: Smart Sound FX for Inflatable Costumes

Picture of Smart Sound FX for Inflatable Costumes

Don't just add sound FX to your costume, add Smart Sound FX!

This is a speaker system that automatically plays stomping sounds when you walk and allows you to play roars, growls, and other sound clips by simply moving your head. No fumbling with buttons or smartphones.

An Idea is Hatched

Ever since I was a child I have dreamed of becoming a T-Rex. I explored genetic modification and plastic surgery techniques, but the tech is not quite there yet. When I saw this inflatable T-Rex costume, I knew that it was the next best thing. Wearing the costume was an amazing experience for sure, but I was left disappointed. I wanted to roar, growl, and stomp around with ripple inducing loudness. There is a version of the costume that comes with "sound," but it just includes a feeble, watch battery powered hand speaker. That's not going to cause nightmares! Makers find a way so I decided to make my own. I searched around online, but most existing cosplay sound systems are button activated. This is not optimal for tiny T-Rex hands! Seriously, it seemed very difficult to fumble around with buttons while in the costume, especially for the stomping sounds. I wanted a smarter way to trigger the sounds so I put vibration sensors on my feet to detect steps and an IMU on my head to allow me to play the rest of the sounds. The system is powered by an Adafruit Feather board and the sounds are played through a boomin' rechargeable speaker. I simply raise my head to unleash a ferocious roar that would send any lawyer running for the bathroom.

Party Animal

In addition to roars, growls, and stomp sounds, I added Jurassic Park movie quotes and music. You can actually create a Dino MP3 player that you can control with your head. I loaded up the SD card with songs such as the Jurassic Park theme and the quintessential Halloween track Thriller to become a true party animal!

Adaptability

This system can be adapted for almost any inflatable monster costume. For example just replace the T-Rex MP3's with Godzilla or King Kong ones. With a little bit more work, this system can be adapted for many other types of costumes. I would just recommend a different speaker and hat setup. As these costumes become more ubiquitous, this sound system is a great way to stand out from the crowd. You may encounter other T-Rex's out in the wild, but with a speaker of this size, I guarantee that none will roar as loud as you!

Materials (I spared no expense!)

I tried the medium vibration sensor, but it did not pickup my footsteps. The fast worked for me, but this may not be the case for everybody.

I had one of these already so I decided to use it. With the inflatable costumes you have room for a pretty substantial speaker. There are a lot of great sounding speakers on the market for cheap. My suggestions for choosing a speaker. 1. Has Aux input 2. Rechargeable 3. Compact enough to fit inside costume

  • Feather Stacking Headers
  • Micro SD Card + Adapter
  • 3.5mm audio cable (short)
  • Solder
  • Various wire
  • Heat Shrink
  • Sacrificial USB Cable
  • Old hat
  • 3M dual lock (any velcro will work)
  • Masking Tape
  • Zip ties (small for electronics)
  • Large zip ties

Recommended Tools

For this project you will need experience with through hole soldering.
There isn't much soldering, but some prior experience will make it much easier. I also recommend that you have some experience programming Arduinos.

  • Soldering Iron
  • Heat Gun
  • X-acto Knife
  • Scissors
  • Soldering Stand W/ Clamps
  • Computer with Arduino IDE
  • Micro USB Cables- Charging and uploading code to Feather

Step 1: Assemble Feather Boards and Sensors

Picture of Assemble Feather Boards and Sensors

Schematic and Feather Boards

A schematic is posted above. The circuits are fairly simple with no extra electrical components needed. Start by Soldering the female headers onto the feather proto board and the male headers onto the featherwing if you have not done so already. There are plenty of tutorials out there for through hole soldering if you are unsure. I soldered all the grounds (3 total: 2 vibration sensors + Flora IMU) and the +3V (Flora IMU) to the top side of the Feather Proto board. I soldered the SDA and SCL from the Flora, and the digital input from the vibration sensors to the underside of the FeatherWing. Once the two boards are stacked, all wires should be between them.

Wiring Lengths

Before you wire everything together, skip ahead a couple of steps and figure out approximately where you are going to mount the feather board on your body. Use this to figure out cable lengths for the vibration sensors and IMU. The vibration sensors will be in your shoes and the IMU will be on your head so leave enough slack in the wiring to move around.

Flora IMU

I used an old USB cable for the Flora IMU. USB cords conveniently have 4 wires inside which is prefect for this use. Cut the outer jacket with an X-acto knife and then peel away the foil shielding to reveal the individual wires inside. Strip the ends off of each wire to prepare it for soldering. Be careful, the individual wires inside of the USB cable are usually very small, use caution when stripping. First, solder the 4 wires to Flora. Red and black wires are +3V and Ground respectively. Solder the green and white wires to SCL and SDA. Next, prepare other end of the USB cable. Solder the red and black wires to the Feather Proto Board and the green and white wires to the FeatherWing. Be sure not to cross the SCL and SDA wires! If you chose to use the green wire for the SCL, make sure that it is soldered to SCL on both boards.

Vibration Sensors

The vibration sensors are simple, but perfect for this application. Basically they consist of a spring with a metal pin in the middle. When the spring vibrates, it contacts the metal pin and closes the circuit, acting as a switch. Polarity does not matter for these switches, one end has to be connected to ground, the other has to be connected to a pin on the FeatherWing. Both sensors are connected in parallel. They each pickup a ground, but their (green) output wires are spliced together near the board so that we only get one input from both sensors. I connected the sensor input to the digital pin 0 (int2) on the featherwing. This allows for the use of an interrupt on this pin. Note, I was originally using digital pin 1 (int2), but I was having issues with the MP3 player freezing up. Apparently the FeatherWing uses this pin while in MIDI mode. Although we are not using MIDI mode for this project, signals on this pin can cause the board to hang up.

For the vibration sensors use small and flexible wire. You will need two wires going to each sensor so try to use some sort of ribbon cable. I used servo wire (removed 3rd wire) and wire from an old AC adapter. Both of these worked well because the wires are connected together. To solder, I used my electronics stand to hold the sensors in place. I soldered one lead at a time and then put a small piece of heat shrink over each lead. Once both wires were soldered, I put a large piece of heat shrink around both wires and the sensor.

Step 2: Make a Harness for Speaker and Mount Components

Picture of Make a Harness for Speaker and Mount Components

Speaker Harness

This step is where you will have the most flexibility. I chose to use large zip ties because I had some extra ones lying around from a previous project. You could easily use string, a camera strap, etc.

Start by wrapping a large zip tie around the speaker. Ensure that it will not interfere with the buttons on the speaker and leave it loose. Next, wrap smaller zip ties around the speaker to hold the large one in place. I had to daisy chain a couple together in order to fit around the speaker. Pull these very tight so that nothing moves around. I made a shoulder strap by connecting two large zip ties. I connected everything together with a smaller zip tie so that the speaker would point away from my body. Cut off all zip tie ends.

Mount Components

There is extra room on the speaker so I decided to mount the components on the top with 3M dual lock. Depending on the speaker that you use, there may not be room for the other components. Mount the Feather board stack, battery, and switch. Position the switch so that you can push the button while inside of the costume just in case you have to reboot the system. This is much more convenient than venturing out to the maintenance shed. Once the components are mounted connect the 3.5mm cable to the headphone jack on the FeatherWing and the Aux input on the speaker. Organize all of you wires with zipties. It is critical that you provide strain relief for the accelerometer and vibration sensor wires. I ziptied them to one of the straps that goes around the speaker. These wires will constantly be in motion so there is an increased chance that the wires will pull out from the circuit boards if they are not tied down.

Take an old hat and mount the flora accelerometer to the brim of the hat. Take care to mount in the center with x component facing forward. I taped the wire to the hat for strain relief. For the vibration sensors, I decided to just stuff them in my socks, but you could easily make a velco strap for a more elegant solution.

Step 3: Program

Picture of Program

Input/Output Map

Before I started to write the code, I came up with a basic map of sensor inputs to the sound outputs. If you run the code, it will preform as follows:

  • Step sensors - Play stomp sound
  • Tilt head up - Roar!
  • Tilt Head down - Growl!
  • Tilt head right - Play a JP movie sound clip
  • Tilt head left- Enter into MP3 Player Menu:
    • Tilt Head up - Play JP Theme
    • Tilt Head left- Play Halloween music
    • Tilt head right - Play party music
    • Once music is playing, tilt head up to Stop.

Libraries

Full disclosure, I reused code from Adafruit's library examples. To run this program, you will first have to get the Arduino IDE setup for the feather. Adafruit has a great overview of the board with tutorials here. Once the Arduino IDE is playing nicely with the feather, you will need to install the correct libraries.

It's no UNIX system. You will need the libraries below. Follow links to install libraries for the Music Maker FeatherWing, Flora 9DOF IMU, and Adafruit Sensor (needed for IMU).

#include <SPI.h>
#include <SD.h>
#include <Adafruit_VS1053.h>
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_LSM9DS0.h>

Constants and Variables

Progressing through the code, we define the constants and variables. Take note that this code is designed to run only on the Feather 32u4 board. You will have to modify if you are running a different setup.

//----------------------MusicMaker FeatherWing

#define VS1053_RESET   -1     // VS1053 reset pin (not used!)

// Feather 32u4
#define VS1053_CS       6     // VS1053 chip select pin (output)
#define VS1053_DCS     10     // VS1053 Data/command select pin (output)
#define CARDCS          5     // Card chip select pin
#define VS1053_DREQ     9     // VS1053 Data request, ideally an Interrupt pin

Adafruit_VS1053_FilePlayer musicPlayer =
  Adafruit_VS1053_FilePlayer(VS1053_RESET, VS1053_CS, VS1053_DCS, VS1053_DREQ, CARDCS);

// ----------------------Accelerometer

Adafruit_LSM9DS0 lsm = Adafruit_LSM9DS0(1000);  // Use I2C, ID #1000

#define LSM9DS0_XM_CS 10
#define LSM9DS0_GYRO_CS 9

#define LSM9DS0_SCLK 13
#define LSM9DS0_MISO 12
#define LSM9DS0_MOSI 11

// ----------------------Program Variables

boolean stomp = false; //Set true when step is detected

int ClipNum = 1; //used for cycling through JP sound clips

int HeadState = 0; //1=Tilted up 2=Tilted down 3=Tilt right 4=Tilt left

//Adjust these values based on accelerometer testing.
int HeadUp = 2;
int HeadDown = -9;
int HeadRight = 5;
int HeadLeft = -5;

Setup Routine

Next is the setup routine. The volume can be adjusted in this section of the code. Also of note in this section is the interrupt for the vibration sensors. First, we set Pin 0 to pinmode INPUT_PULLUP. The following line sets the parameter of the interrupt: attachInterrupt(digitalPinToInterrupt(0), Stomp, FALLING). What this does is every time a vibration sensor is connected to ground (Falling to LOW), it calls the stomp routine. If you scroll down further in the code, the stomp routine sets boolean var stomp to true. We can then use this to play the stomp sound.

One of the main reasons that I wanted to use interrupts for the stomps is so that sound clip could be played in quick succession. The clip is around 1 second long because it fades out towards the end. Originally I played the full stomp clip with each step, but I was walking faster than the clips could play. In the current code. I use the StartPlayingFile command to start playing the file. The delay(250) is to eliminate multiple readings from the vibration sensors (they contain a spring). If the user stops walking, the stomp clip plays out, but if more steps are detected, the clip will be stopped and then played again. This creates a layered effect and allows for faster walking.

void setup() {
  Serial.begin(115200);

  pinMode(0, INPUT_PULLUP);  //vibration sensor inputs 
  pinMode(1, INPUT_PULLUP);  //Add this line to eliminate hang-ups with Music Featherwing

  // ----------------Setup MusicMaker FeatherWing
  musicPlayer.begin(); // initialise the music player

  SD.begin(CARDCS);  // initialise the SD Card

  // Set volume for left, right channels. lower numbers == louder volume!
  musicPlayer.setVolume(8, 8);

  musicPlayer.useInterrupt(VS1053_FILEPLAYER_TIMER0_INT); // timer int

  // ---------------------Setup Accel
  lsm.begin(); //Initialise the 9DOF IMU 

  //Setup the sensor gain and integration time 
  configureSensor();

  //---------------------interrupt for vibration sensors 
  attachInterrupt(digitalPinToInterrupt(0), Stomp, FALLING);  
}

Main Loop and Subroutines

There isn't much code in the main loop. Most of the heavy lifting is done in the subroutines. Here is a quick description of each subroutine.

ConfigureSensor(); Called in setup. Used to configure the Flora IMU at startup.

GetGesure(); This function determines the position of the user's head and sets the HeadState var accordingly.

stomp(); This is the interrupt routine. This function is called when a vibration sensor is triggered.

SongMenu(); Enter this function when head is tilted left. The user then can elect to play JP theme, Halloween music, or party music.

PlayHalloweenMusic(); Called from the SongMenu function. Currently will play two different Halloween songs.

PlayPartyMusic(); Called from the SongMenu function. Currently will play three party songs. If you want to add a larger playlist to the costume, I suggest that you add it here.

SongStop(); Basically a holding function. While songs are playing, it will loop until the user tilts their head up to skip or stop the current song.

PlayClips(); This function cycles through JP movie quotes.

void loop() {

  if (stomp == true) {
    musicPlayer.stopPlaying();
    musicPlayer.startPlayingFile("track001.mp3");
    Serial.println("Stomp");
    delay(250);
    stomp = false;
  }

GetGesture();  //Check head position

if (musicPlayer.playingMusic == false) { 
//Roar if head is tilted up 
        if (HeadState == 1) {
                    Serial.println("RAWR");
            musicPlayer.playFullFile("track002.mp3");
          delay(500);
          stomp = false;
         }

  //Growl if head is tilted down
        if (HeadState == 2) {
                    Serial.println("GROWL");
            musicPlayer.playFullFile("track003.mp3");
          delay(300);  
          stomp = false;  
        }

  //Play Sound clips if Tilted Right
        if (HeadState == 3) {
          PlayClips();
          stomp = false;
        }

  //Enter Song Menu if head tilted left
        if (HeadState == 4) {
          SongMenu();
          stomp = false;
        }  
}
}

void configureSensor(void){
//Configures the gain and integration time for the TSL2561
  
  // 1.) Set the accelerometer range
  lsm.setupAccel(lsm.LSM9DS0_ACCELRANGE_2G);

  // 2.) Set the magnetometer sensitivity
  lsm.setupMag(lsm.LSM9DS0_MAGGAIN_2GAUSS);

  // 3.) Setup the gyroscope
  lsm.setupGyro(lsm.LSM9DS0_GYROSCALE_245DPS);
}

//Interrupt Routine
void Stomp(void)  { 
  stomp = true;
}

void GetGesture(void) {
HeadState = 0; //Reset HeadState 

  sensors_event_t accel, mag, gyro, temp;
  lsm.getEvent(&accel, &mag, &gyro, &temp);

//Head is tilted up 
        if (accel.acceleration.x > HeadUp) {
          HeadState = 1; 
         }

  //Head is tilted down 
        else if (accel.acceleration.x < HeadDown) {
          HeadState = 2;   
        }

  //Head is Tilted Right
        else if (accel.acceleration.y > HeadRight ) {
          HeadState = 3;
        }

  //Head is Tilted Left
        else if (accel.acceleration.y < HeadLeft ) {
          HeadState = 4;
        }
        delay(400);
   }
  
void SongMenu(void)  {
  delay(2000); //Give user time to put head level once SongMenu is called

  HeadState = 0;
  Serial.println("Song Menu");
  
  while (HeadState == 0){ //Stay in SongMenu until user chooses song
  GetGesture();
  }
  
  //Play Jurassic Park Theme if head is tilted up 
        if (HeadState == 1) {
          Serial.println("Playing JP Theme");
          musicPlayer.startPlayingFile("song001.mp3");
          SongStop();
         }

  //Play Party Music if Tilted Right
        if (HeadState == 3) {
          Serial.println("Play Party Music!");
          PlayPartyMusic();
        }

  //Play Halloween Songs if Tilted Left
        if (HeadState == 4) {
          Serial.println("Playing Halloween Mysic");
          PlayHalloweenMusic();
        }  
Serial.println("Done Playing Music");
}

void PlayHalloweenMusic(void) {
    musicPlayer.startPlayingFile("song002.mp3"); 
    SongStop();
    musicPlayer.startPlayingFile("song004.mp3"); 
    SongStop();
}

void PlayPartyMusic(void){
  musicPlayer.startPlayingFile("song003.mp3"); 
  SongStop();
  musicPlayer.startPlayingFile("song005.mp3"); 
  SongStop();
  musicPlayer.startPlayingFile("song006.mp3"); 
  SongStop();
}

void SongStop(void){
  delay(2000); //Give user time to put head level after song starts playing
  
  while (musicPlayer.playingMusic) {    
    GetGesture();

  //stop or skip song if head is tilted up
        if (HeadState == 1) {
           musicPlayer.stopPlaying();
         }  
    delay(1000); //Give user time to put head level after song stops playing
  }
}

void PlayClips(void)  {

if (ClipNum == 1){
       musicPlayer.playFullFile("Clip001.mp3");
       Serial.println("Clip1");
}
else if (ClipNum == 2) {
       musicPlayer.playFullFile("Clip002.mp3"); 
       Serial.println("Clip2");
}
else if (ClipNum == 3) {
       musicPlayer.playFullFile("Clip003.mp3"); 
       Serial.println("Clip3");
}
else if (ClipNum == 4) {
       musicPlayer.playFullFile("Clip004.mp3"); 
       Serial.println("Clip4");
}
else if (ClipNum == 5) {
       musicPlayer.playFullFile("Clip005.mp3"); 
       Serial.println("Clip5");
}
else if (ClipNum == 6) {
       musicPlayer.playFullFile("Clip006.mp3");
       Serial.println("Clip6"); 
}
else if (ClipNum == 7) {
       musicPlayer.playFullFile("Clip007.mp3"); 
       Serial.println("Clip7");
}
else if (ClipNum == 8) {
       musicPlayer.playFullFile("Clip008.mp3"); 
       Serial.println("Clip8");
}
else if (ClipNum == 9) {
       musicPlayer.playFullFile("Clip009.mp3"); 
       Serial.println("Clip9");
}
else if (ClipNum == 10) {
       musicPlayer.playFullFile("Clip010.mp3"); 
       Serial.println("Clip10");
       ClipNum = 0; //Last clip. Play first clip next cycle. 
}
ClipNum++; //Advances to the next clip when PlayClips is ran again
}

Step 4: Edit Audio and Load to SD Card

Picture of Edit Audio and Load to SD Card

Edit Audio

I used Audacity to edit the sound files. It gives you the ability to cut/trim, convert, and adjust the volume of audio files. Be sure to also download the LAME MP3 Encoder on the download page. This allows you to export MP3's.

I exclusively used MP3 files. If you use other file types or names, you will have to update the code. track001, track002, and track003 are available for download in this instructable. I got the JP clips and theme song from Here and Here. I did not post the song downloads because of copyright issues. They are readily available elsewhere for download or use any other songs that you would like.

List of Audio Files

  • track001 = Step (~1 sec long)
  • track002 = Roar
  • track003 = Growl
  • song001 = JP Theme
  • song002 = Party Song1
  • song003 = Thriller
  • song004 = Ghost Busters Theme
  • song005 = Party Song2
  • song006 = Party Song3
  • clip001 through clip010 = Some of my favorite quotes from JP

Format SD Card

Once you have all of your audio files in one location, it is time to add them to the micro SD card. First, it is reformat the card to FAT16 or FAT32. Make sure that the card is completely empty then drag and drop your MP3's to the card. They should be at the top level and not in any folders. If you are having trouble with playback, there are issues with the FeatherWing reading from cheap micro SD cards, so try a better quality one.

Step 5: Get Accelerometer Values for Head Gestures

Picture of Get Accelerometer Values for Head Gestures

Gesture Recognition 101

I chose 4 basic gestures for controlling the sound. I experimented with more complex gestures, but these 4 seemed to work the best. I only used the accelerometer values, you could also incorporate readings from the mag and gyros. If you are unfamiliar with accelerometer, here is a quick rundown on the theory. Basically it measures acceleration in the X, Y, and Z directions. When Z is pointed up and X and Y are level with the earth, Z will measure 9.8 m/s^2 acceleration due to gravity. X and Y will be around 0. For our purposes, when the hat is tilted the X and Y values will change. We can figure out trigger values and use them to trigger events within the program.

Here are the 4 triggers that I used:

1. Tilt Head up (trigger when X value is high)

2. Tilt Head down (trigger when X value is low)

3. Tilt head left (trigger when Y value is high)

4. Tilt head right (trigger when Y value is low)

Accelerometer Values

We have to run a couple of tests to get threshold values for the accelerometer. Load the sensorapi example that comes with the Flora IMU library and then open the serial monitor in the Arduino IDE to see what the accelerometer is reading. The trick is to find values that limit accidental triggers. Take note of the X and Y values for all 4 gestures. Update the code with these values if necessary. The left and right tilt motions work pretty well because you don't naturally do this with your head. You get more accidental triggers with the up down gestures, but this can be reduced.

//Adjust these values based on accelerometer testing.
int HeadUp = 2;
int HeadDown = -9;
int HeadRight = 5;
int HeadLeft = -5;

Step 6: Put on the Costume and Start T-Rexin!

Picture of Put on the Costume and Start T-Rexin!

This system is designed to be independent of the costume so that you can hook up all the electronics first, then step into the costume. Before you venture out in your costume, ensure that both the speaker and the battery that powers the Feather boards are charged! Note, the Feather Proto Board has a built-in battery charger. Just connect to USB and ensure that the switch is powered on.

  1. Hang speaker from shoulder.
  2. Put on hat.
  3. Put Vibration sensors in socks.
  4. Power system on.
  5. Put on costume.
  6. T-Rex!

Hold on to your butts, it's time to start T-Rexin! Enjoy it, you pretty much have the most awesome costume ever created. Adding this sound system exponentially increases the awesomeness factor of these inflatable costumes. This is the sound system that this costume deserves. Tiny hand speakers and cell phones simply cannot compare with carrying around this Amazon BT speaker. With a speaker of this caliber you can really let out a roar worthy of a T-Rex, then you can get the dance party started. Happy Halloween and after careful consideration, please decide to endorse my Instructable!

Comments

About This Instructable

1,259views

3favorites

More by bigdom324:Smart Sound FX for Inflatable CostumesBack to the Future Model DeLorean Interactive Display
Add instructable to: