This was supposed to be a Hackster.io Google Android Things contest 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.
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...........
Wiring:
Python 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')
Top Comments