As I posted previously 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.

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 laptop using AutoHotKey. When the photocell switch it tripped the Arduino sends a serial signal 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.

I had access to a industrial photocell switch (just like at Disneyworld!) which required an additional 12v power supply but I imagine this could be modified to work with a cheap ultrasonic or IR range finder.

This AutoHotKey script is running on the PC waiting for the “a” key to be pressed. When the key is pressed VLC launches full screen and ignores input for the duration of the video (60 seconds). It then closes VLC and waits to be triggered again.

a:: Run, c:Program FilesVideoLANVLCvlc.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

This Arduino sketch waits until the Photocell switch on pin 2 is tripped, then sends a serial character to the Dell laptop it’s connected to. It also ignores any input during video playback to avoid confusing the computer.

/* 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 */ // 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); } }

Here are the installation photos and video compilation (note: the audio is a little out of sync after uploading to youtube).

While we didn’t get too many trick-or-treaters this year the ones that stopped by after dark really enjoyed it. I’m really happy with the way this turned out and I recommend anyone new to Arduino give it a shot. It really wasn’t hard to put together and they payoff was great.