Introduction: Arduino Powered Haunted Mansion Singing Busts

Last year I wanted to put together a Halloween display emulating my favorite Disneyland/world ride of all time. Originally this was just going to be four heads on a table with the Haunted Mansion's "Grim Grinning Ghosts" playing on a loop. But that all changed after I picked up my first Arduino UNO.

After I started learning to program my Ardunio this evolved into a photocell actuated video "on demand" Halloween display. I used an example I found on Arkadian.eu to control a Dell Mini 9 netbook running AutoHotKey. When the photocell switch is tripped the Arduino sends a serial message to the Dell laptop which is converted to a keystroke by AAC Keys which in turn triggers the below AutoHotKey Script and finally plays back using VLC. The "AAC Keys" could probably be replaced by setting up your Arduino as a USB HID but at the time this was all a foreign language to me.

So, lets get to the build!

Step 1: Hardware: Don't Lose Your Head Over This.

Sometimes (OK, lots of times) it's handy to have a retired Electrical Engineer as a father. In particular for this project he was able to provide me with a nice "industrial" photocell switch (just like at Disneyworld!) This ran off a seperate 12v power supply and was really easy to setup on a digital pin of my Arduino (more on that later). 

In addition to the switch my hardware list included:
  1. 4 styrofoam heads (found on eBay)
  2. Dell Mini 9 netbook for video playback
  3. A 800x600 VGA projector
  4. Old Karaoke machine for audio playback
  5. Arduino UNO
  6. Radioshack project box to keep the Arduino dry and happy
  7. And the previously mentioned photocell and 12v wall wart
As you can see in the photos I setup the photocell to span the width of my parent's front steps (this would not have worked so well in my apartment...). The photocell wired into a pin on my arduino to register when it was tripped. The Arduino is hooked up to my Netbook over USB and lastly the netbook hooks to the projector and karaoke machine using their respected ports. Then I setup the styrofoam heads and aligned them with the video (more on that in step 3). Whew, ok who's ready for some software?

Step 2: Software: Lets Go to the Head of the Class

Obviously one of the most important parts of this project was the source video. I was lucky enough to find some original recordings of the singing busts from Disneyland on Youtube. You can find the one I used here: "Phantom 4 of 5 Grim Grinning Ghosts". I pulled the video from Youtube and used that for both the video and audio in this project. 

As I said in the introduction I primarily used four pieces of software to run this project (all of which are free) they are:
  1. My programmed Arduino UNO
  2. AutoHotKey (Windows macro program)
  3. AAC Keys (Turns serial input into keystrokes)
  4. VLC (video playback)
I also set my Windows background to black and hid the task bar so nothing displayed when the video was not playing.

Here's the code for the AutoHotKey script:

a::

Run, c:\Program Files\VideoLAN\VLC\vlc.exe -I rc "VIDEO_FILE_NAME"
Sleep, 61000 ; Pause for video to play, prevents triggering multiple times.
Process, close, vlc.exe ; Kill vlc and make sure it stays dead.
Return

As you can see it's pretty simple. When the "a" key is pressed VLC is launched with arguments to hide everything but the video itself. The script waits for the length of the video (61 seconds) then it closes VLC to reset and run again.

The Arduino sketch isn't much more complicated it waits until the photocell is triggered, then sends the "a" key to the computer over USB (which AAC Keys turns into a keystroke) and waits for 61 seconds before it can be triggered again. 

/*
  Serial Keyboard

 Used to send keystrokes to a Windows PC running AACKeys.exe which
 turns serial data into keystrokes. Best used in conjunction with
 AutoHotKey.

 Examples and idea based on the work of http://www.arkadian.eu and
 information from http://wwww.ladyada.net

TheNewHobbyist 2010 <http://www.thenewhobbyist.com>

 */

// Initialize variables
const int buttonPin = 2;
const int ledPin = 13;
int buttonState = 0;

// Set inpout/output and start serial
void setup() {
  pinMode(ledPin, OUTPUT);
  pinMode(buttonPin, INPUT);
  Serial.begin(9600);
}

// Main code loop
void loop(){
    buttonState = digitalRead(buttonPin);
    if (buttonState == HIGH) {
        digitalWrite(ledPin, HIGH);
        Serial.print("a"); // send key to PC to start video playback
        delay(61000); // ignore input until video ends
    }
    else {
        // turn LED off:
        digitalWrite(ledPin, LOW);
    }
}     

Step 3: Putting It All Together: Heads Up!

So once you've got your hardware and software all playing nice the only thing left to do it arrange the heads in a trick-or-treater friendly area and wait to BLOW KIDS MINDS. The neighborhood kids seemed to really get a kick out of the display (some coming back with friends to show them). It was a lot of fun and taught me a thing or two about the Arduino.

Halloween Decorations Challenge

Second Prize in the
Halloween Decorations Challenge

4th Epilog Challenge

Participated in the
4th Epilog Challenge