Introduction: Spooky Whispering Prank

About: My name is Randy and I am a Community Manager in these here parts. In a previous life I had founded and run the Instructables Design Studio (RIP) @ Autodesk's Pier 9 Technology Center. I'm also the author of t…

The Spooky Whispering Prank is a device which whispers scary things when the lights are out and it senses someone is present. This joke device tells whether or not someone is there based on the amount of noise being made. If the lights are out and there is a loud noise, it assumes someone is present and intermittently begins to whisper until the lights are turned on. This is a great gift for anyone who is at all scared of the dark, monsters, and/or ghosts. It particularly goes over well with children.

Note: Albeit this should go without saying, do not remove, replace, disable or take apart any existing fire alarms in your home or the home of anyone else. Get a brand new smoke detector from the store for this project.

Step 1: Materials

For this project you will need:

(x1) Smoke Alarm
(x1) Arduino Micro
(x1) Audio FX Board***
(x1) Mono Amp Board***
(x1) Electret Microphone Amplifier
(x1) Photocell
(x1) 2.2K resistor (or similar)
(x1) Adafruit 1/4-sized PCB "proto board"
(x1) Female header pins
(x1) Assorted shrink tube
(x1) Assorted stranded wire
(x1) Double-sided tape squares

***Since making this project, Adafruit seems to have temporarily discontinued the Audio FX board with the built-in amp. In the meantime you will need to use the non-amplified audio board with this additional external amp board.

To do this, wire the audio output of the audio board to the audio input of the amp. Next, connect the 5V power pin from the Arduino board to the V-in pin on the amp board, and wire both grounds together. Finally, attach the speaker to the amp board as appropriate.


(Note that some of the links on this page are affiliate links. This does not change the cost of the item for you. I reinvest whatever proceeds I receive into making new projects. If you would like any suggestions for alternative suppliers, please let me know.)

Step 2: Open

Open up the smoke detector.

Step 3: Remove the Board

Remove the smoke detector circuit board from the smoke detector's enclosure.

Step 4: Attach the Headers

Slide the female header pins onto the Arduino micro's male header pins. If the headers are too long for the board, break a few off using pliers until they fit into the board.

Insert the pins from the female headers into the PCB and solder them in place.

Once complete, remove the Arduino from the headers.

Step 5: Attach Wires

Trim the leads of the photocell shorter and solder wires to them.

Insulate any exposed metal connections with shrink tube.

Step 6: Wire the Photocell

Notice on the Adafruit PCB that the rows are numbered and the columns are marked with letters.

Find the pin in 'row 14' and 'column i.' Wire a 1K resistor between there and ground.

Connect one of the wires from the photocell next to the resistor in 'row 14.'

Connect the other wire to the power rail.

Step 7: Connect the Microphone

Solder a wire between the microphone board ground connection and ground on the PCB.

Next, do the same for the power connection.

Finally, wire the output on the microphone board to row 13 on the PCB (the row right next to the photocell).

Step 8: Power and Ground

Solder a red wire between the power rail and row 6 (on the same side of the board as the sensors).

Solder a black wire between ground and row 4 (also on the same side of the board.

Step 9: Upload

Upload audio to the Audio FX Board as you would if you were copying audio files to a hard drive.

The audio should either be in formatted to .WAV or .OGG file types. More audio can be fit on the board with .OGG, but .WAV sounds better.

You can add as many clips as will fit on the board.

I recorded my audio files on my computer using Audacity (free audio editing software) and the computer's built in microphone. You can use whatever works best for you.

When creating your audio files, it is best to name them sequentially (i.e. 00SCARE.WAV, 01SCARE.WAV, 02SCARE.WAV, etc), but ultimately you must live your trust.

I numbered my files ##SCARE.WAV. If you break from my naming convention, remember that you need to update the code to match your file names.

Step 10: Attach Wires

Solder 5" wires to the following pins on the Audio FX Board:

V-in
GND
RST
TX
RS
UG

Step 11: Connect the Boards

Now is time to connect the audio board to the PCB.

To begin, wire the reset pin to row 15 on the opposite side of the board from the sensor.

In row 14, next to the reset pin wire, connect the audio board's TX pin.

In row 13, just next to that, connect the RX pin.

Finally, wire the audio board's V-in pin to the PCB's power rail, and connect ground on each board together.

If you are uncertain, you can double check all of your connections against the above wiring diagram.

Step 12: Attach the Speaker

Attach the speaker to the amplified audio output terminals of the audio fx board.

Step 13: Program the Arduino

Program the Arduino with the following code:

<p>/*****************************************************<br> *                                                   *
 *   SPOOKY WHISPERING PRANK                         *
 *   instructables.com/id/Spooky-Whispering-Prank/   *
 *                                                   *
 *****************************************************</p><p>/Add libraries to the Arduino sketch.
#include <spi.h>
#include <softwareserial.h>
#include <adafruit_soundboard.h></adafruit_soundboard.h></softwareserial.h></spi.h></p><p>// Set constant pins for the sound FX board:
// Transmit, Receive and Reset
#define SFX_RX 8
#define SFX_TX 9
#define AUDIO_RESET 10 </p><p>//Start a software serial connection for the Audio board.
SoftwareSerial ss = SoftwareSerial(SFX_TX, SFX_RX);</p><p>//Start an instance of the soundboard. This is the name of the board.
Adafruit_Soundboard sfx = Adafruit_Soundboard(&ss, NULL, AUDIO_RESET);</p><p>//Establish a charachter array for the audio filenames
//If you decide to use .ogg files change WAV to OGG
char filename[12] = "        WAV"; </p><p>// This is where you specify the actual filenames of your audio
// Each name must have characters no matter what. 
// In other words, if the filename is 6 characters long, then
// add two blank spaces between the quotes to make it 8 characters long.
static const char PROGMEM bigStringTable[] =  // play() index
  "00SCARE " "01SCARE " "02SCARE " "03SCARE "  //  1-4
  "04SCARE " "05SCARE " "06SCARE " "07SCARE "  //  5-8
  "08SCARE " "09SCARE " "10SCARE " "11SCARE "  //  9-12
  "12SCARE " "13SCARE " "14SCARE " "15SCARE "; //  13-16</p><p>// The threshold for the light sensor
int threshold = 100;</p><p>// The threshold for the audio sensor
float soundCompare = 0.3;</p><p>// A variable for measuring the peak-to-peak volts of the audio signal
double volts;</p><p>// The sample window (frequency) for reading the audio sensor (50 mS = 20Hz)
const int sampleWindow = 50;  
unsigned int sample;</p><p>// Setup the sketch by engaing the Software Serial and Hardware Serial connections
void setup(void) {
  ss.begin(9600);
  Serial.begin(115200);
}</p><p>//The body of the sketch
void loop(void) {</p><p>  // Read the light and the sound sensors
  int sensorValue = analogRead(A0);
  soundReading();</p><p>    // If the light sensor is less than the comparison threshold
    if(sensorValue < threshold){</p><p>       // And if the sensor hears something loud
       if (volts > soundCompare){ </p><p>           // Play some audio
           play(random(16));
           delay(1000);
           
           //While ten seconds pass, if light goes on stop the sound and reset
           for (int i=0; i <= 100; i++){
             sensorValue = analogRead(A0);
             delay(100);
             if(sensorValue > threshold){
               sfx.stop();
               break;
             }
           }</p><p>       }
    }</p><p>}</p><p>// Function for playing audio
void play(uint16_t i) {
  memcpy_P(filename, &bigStringTable[i * 8], 8); //changed 8 to 14 // PROGMEM -> RAM
  Serial.println(filename);
  sfx.playTrack(filename);
}</p><p>//Function for reading the audio sensor
void soundReading(){
   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(A1);
      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
   volts = (peakToPeak * 5.0) / 1024;  // convert to volts
 
   //Serial.println(volts);
}</p>
/*****************************************************
 *                                                   *
 *   SPOOKY WHISPERING PRANK                         *
 *   instructables.com/id/Spooky-Whispering-Prank/   *
 *                                                   *
 *****************************************************/


//Add libraries to the Arduino sketch.
#include <SPI.h>
#include <SoftwareSerial.h>
#include <Adafruit_Soundboard.h>


// Set constant pins for the sound FX board:
// Transmit, Receive and Reset
#define SFX_RX 8
#define SFX_TX 9
#define AUDIO_RESET 10 


//Start a software serial connection for the Audio board.
SoftwareSerial ss = SoftwareSerial(SFX_TX, SFX_RX);


//Start an instance of the soundboard. This is the name of the board.
Adafruit_Soundboard sfx = Adafruit_Soundboard(&ss, NULL, AUDIO_RESET);


//Establish a charachter array for the audio filenames
//If you decide to use .ogg files change WAV to OGG
char filename[12] = "        WAV"; 


// This is where you specify the actual filenames of your audio
// Each name must have characters no matter what. 
// In other words, if the filename is 6 characters long, then
// add two blank spaces between the quotes to make it 8 characters long.
static const char PROGMEM bigStringTable[] =  // play() index
  "00SCARE " "01SCARE " "02SCARE " "03SCARE "  //  1-4
  "04SCARE " "05SCARE " "06SCARE " "07SCARE "  //  5-8
  "08SCARE " "09SCARE " "10SCARE " "11SCARE "  //  9-12
  "12SCARE " "13SCARE " "14SCARE " "15SCARE "; //  13-16


// The threshold for the light sensor
int threshold = 100;


// The threshold for the audio sensor
float soundCompare = 0.3;


// A variable for measuring the peak-to-peak volts of the audio signal
double volts;


// The sample window (frequency) for reading the audio sensor (50 mS = 20Hz)
const int sampleWindow = 50;  
unsigned int sample;


// Setup the sketch by engaing the Software Serial and Hardware Serial connections
void setup(void) {
  ss.begin(9600);
  Serial.begin(115200);
}


//The body of the sketch
void loop(void) {

  // Read the light and the sound sensors
  int sensorValue = analogRead(A0);
  soundReading();


    // If the light sensor is less than the comparison threshold
    if(sensorValue < threshold){

       // And if the sensor hears something loud
       if (volts > soundCompare){ 

           // Play some audio
           play(random(16));
           delay(1000);
           
           //While ten seconds pass, if light goes on stop the sound and reset
           for (int i=0; i <= 100; i++){
             sensorValue = analogRead(A0);
             delay(100);
             if(sensorValue > threshold){
               sfx.stop();
               break;
             }
           }

       }
    }

}


// Function for playing audio
void play(uint16_t i) {
  memcpy_P(filename, &bigStringTable[i * 8], 8); //changed 8 to 14 // PROGMEM -> RAM
  Serial.println(filename);
  sfx.playTrack(filename);
}


//Function for reading the audio sensor
void soundReading(){
   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(A1);
      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
   volts = (peakToPeak * 5.0) / 1024;  // convert to volts
 
   //Serial.println(volts);
}

Step 14: Plug in the Arduino

Insert the Arduino into the breadboard sockets such that pin A0 on the Arduino lines up with the row on the board connect to the photocell.

Some pins from the Arduino will not be inserted into a header socket. That is okay.

Step 15: Trim the Battery Terminals

Trim the battery terminals inside of the smoke detector enclosure so that they are shorter.

Step 16: Solder Wires

Solder a red wire onto the lead terminal which connects the positive contact on the battery.

Solder a black wire to the other lead terminal.

Step 17: Trim

Use diagonal cutting pliers to trim away any unnecessary support tabs inside of the enclosure. The goal is to make the enclosure as open as possible to fit the circuit boards inside.

Step 18: Drill Holes

Drill a 1/4" hole in the top of the smoke detector enclosure to be used with the photocell to sense light.

Drill a 3/8" hole in the side of the enclosure to insert the electret microphone through to detect sound.

Step 19: Attach Power

Solder the 9V power wire to the row which line up with the Arduino's V-in socket.

Solder the ground wire from the battery to ground on the circuit board.

Fully attach the battery to the terminals if you have not already done so.

Step 20: Mount the Circuits

Normally I am not a fan of hot glue, but this is a case in which I think it's the best tool for the job. It gets the job done quickly and efficiently. This device does not need to last a million years, but just long enough for your victim to discover it and smash it over your head.

Anyhow...

Hot glue the microphone board in place.

Next, hot glue the photocell flush with the 1/4" hole that was drilled to let light in.

Finally, hot glue the speaker to the grill already present in the smoke detector.

Don't worry too much about the PCB or audio fx board. They can 'float' on the inside of the enclosure, and will just sort of shuffle themselves into place when you close it up.

Step 21: Close It Up

When all the glue has set, shut the enclosure.

Step 22: Stage the Prank

Mount the double sided tape to the bottom of the enclosure and stick it high up on the wall or on the ceiling.

The prank is now in effect.

Did you find this useful, fun, or entertaining?
Follow @madeineuphoria to see my latest projects.