This project is a Halloween effects controller with video to capture the expressions of the trick-or-treaters and control some effects.

Things used in this project
Hardware components
Hand tools and fabrication machines
Hot glue gun (generic)
Story
Part 1
This was supposed to be a Google Android Things entry: https://www.hackster.io/contests/Google/projects
I found out, however, that I could finish the project in time for Halloween with just some Python code, so here it is. I found some inexpensive battery-operated motion sensing LED lights at the local hardware store.

I removed the circuit board from the housing, unsoldered the battery clips and replaced the LEDs with Molex headers.

I used a rather scary creepy clown mask to hide all the parts inside.
Part 2

I glued two LEDs into the eye holes and ran the wires back to the motion detector.
I used a Styrofoam dummy head as a base and cut out material to fit in a webcam.

The finished head looks like this:

I found some scary Halloween sounds on the net to use for this project:
http://soundbible.com/1129-Maniacal-Witches-Laugh.html
The motion detector is wired to a raspberry pi GPIO17 pin, and when the software detects a change, it captures a photo from the hidden webcam, then plays the maniacal witches laugh through a small amplifier. It will also send me an email with the photo attached if I choose. The software is based on one of the many raspberry pi doorbell projects found on the web. This is a good example:
All I have to do now is mount it on a chair and stuff some clothing with newspaper and wait for the Trick-or-Treaters.


Schematics
Scary Clown Schematic
Simple wiring

Code
import RPi.GPIO as GPIO
import time
import os
import pygame
from shutil import copyfile
IRinputPin = 17
GPIO.setmode(GPIO.BCM)
GPIO.setup(IRinputPin,GPIO.IN, pull_up_down=GPIO.PUD_UP)
count = 10
pygame.mixer.init()
pygame.mixer.music.load("/home/pi/Music/Witch.mp3")
print('System Reset')
while (count>0):
print(count)
count-=1
time.sleep(1)
print('System Armed')
while True:
print('Waiting for input')
if (GPIO.input(IRinputPin)):
time.sleep(1)
else:
print('IR input detected')
os.system("fswebcam -r 960x720 -d /dev/video0 /home/pi/webcam.jpg")
timestr = time.strftime("%Y%m%d-%H%M%S")
filename2 = ('/home/pi/'+timestr+'.jpg')
copyfile('/home/pi/webcam.jpg', filename2)
print('Saving Picture')
os.system("python /home/pi/sendnotify.py")
print('Sending email')
pygame.mixer.music.play()
print('Resetting System')
count = 30
while (count>0):
print(count)
count-=1
time.sleep(1)
print('System Armed')
The article was first published in hackster, October 27, 2017
cr: https://www.hackster.io/r-scott-coppersmith/halloween-of-things-hot-and-your-little-internet-too-3a2c7b
author: R. Scott Coppersmith
