Boots Prank
Supply List:
- Arduino
- a pair of rain boots
- an external speaker
- VS1053 Codec + MicroSD Breakout from Adafruit (http://www.adafruit.com/products/1381)
- a headphone jack that will connect your breakout to the external speaker
- MAX4466 (the microphone amplifier)
- battery with a battery holder to power the Arduino
This was an April fools prank that my friend and I did this year. It was my friend's idea, and I helped her build it! :)
The MAX4466 detects the sound level in the bathroom, and when there is an external sound like closing the door, the Arduino will start playing a laughing sound using the VS1053 breakout. We locked the door where the Arduino was sitting and placed a pair of rain boots to trick as if there was a lady sitting on the toilet, laughing hysterically. As you can see from the video, it was quite creepy, and we were successful in scaring people; Happy April Fools!
* When uploading this file, add the "laughing.mp3" file in the same folder as your code so that the Arduino will know which file to play.
-this "laughing.mp3" file can be anything from a laughing man to a laughing child.
- (laughing is a little better than crying.. Crying could actually freak some people out :P)
Have fun!
- Arduino
- a pair of rain boots
- an external speaker
- VS1053 Codec + MicroSD Breakout from Adafruit (http://www.adafruit.com/products/1381)
- a headphone jack that will connect your breakout to the external speaker
- MAX4466 (the microphone amplifier)
- battery with a battery holder to power the Arduino
This was an April fools prank that my friend and I did this year. It was my friend's idea, and I helped her build it! :)
The MAX4466 detects the sound level in the bathroom, and when there is an external sound like closing the door, the Arduino will start playing a laughing sound using the VS1053 breakout. We locked the door where the Arduino was sitting and placed a pair of rain boots to trick as if there was a lady sitting on the toilet, laughing hysterically. As you can see from the video, it was quite creepy, and we were successful in scaring people; Happy April Fools!
* When uploading this file, add the "laughing.mp3" file in the same folder as your code so that the Arduino will know which file to play.
-this "laughing.mp3" file can be anything from a laughing man to a laughing child.
- (laughing is a little better than crying.. Crying could actually freak some people out :P)
Have fun!
// include SPI, MP3 and SD libraries
#include <SPI.h>
#include <Adafruit_VS1053.h>
#include <SD.h>
// #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
#define RESET 9 // VS1053 reset pin (output)
#define CS 10 // VS1053 chip select pin (output)
#define DCS 8 // VS1053 data/command select pin (output)
#define CARDCS 4 // card chip select pin
#define DREQ 3 // VS1053 data request, ideally an interrupt pin
// DREQ should be an Int pin, see http://arduino.cc/en/Reference/attachInterrupt
Adafruit_VS1053_FilePlayer musicPlayer = Adafruit_VS1053_FilePlayer(RESET, CS, DCS, DREQ, CARDCS);
//Adafruit_VS1053_FilePlayer musicPlayer = Adafruit_VS1053_FilePlayer(MOSI, MISO, CLK, RESET, CS, DCS, DREQ, CARDCS);
const int sampleWindow = 50; // Sample window width in mS (50 mS = 20Hz)
unsigned int sample;
int Pin = 5;
int n = 200; // "threshold"
void setup() {
Serial.begin(9600);
Serial.println("Adafruit VS1053 Simple Test");
Serial.println(" ...beginning musicPlayer");
int mp = 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(0x00, 0x00);
musicPlayer.useInterrupt(VS1053_FILEPLAYER_PIN_INT); // DREQ int
// used as an interrupt to do something while the music is still playing
// musicPlayer.startPlayingFile("laughing.mp3");
}
void loop() {
unsigned long startMillis= millis(); // Start of sample window
unsigned int peakToPeak = 0; // peak-to-peak level
unsigned int signalMax = 0;
unsigned int signalMin = 1024;
// collect data for 50 mS
while (millis() - startMillis < sampleWindow){
sample = analogRead(Pin);
if (sample < 1024){ // toss out spurious readings
if (sample > signalMax){
signalMax = sample; // save just the max levels
}
else if (sample < signalMin){
signalMin = sample; // save just the min levels
}
}
}
peakToPeak = signalMax - signalMin; // max - min = peak-peak amplitude
Serial.print("peakToPeak: "); Serial.println(peakToPeak);
if (peakToPeak > n ) { // when someone opens the door
if (!musicPlayer.playingMusic) {
Serial.println("starting laughing.mp3");
musicPlayer.startPlayingFile("laughing.mp3");
}
}
else {
}
}