My first halloween robotics/electronics project. I always wanted to do something for the halloween so I made this one. I had an old scary mask from last year and I’ve added two styrofoam balls inside to “fill it up”. I’ve mounted 2 LEDs (one for each eye), and then added a PIR sensor as well. I wanted to create something that moves as well as something that has sounds so I’ve bought a WAVE shield from Adafruit a few weeks ago.
Soldering time. I’ve started soldering the wave shield. The board is pretty slick and very well made. I also bought the Panavise Jr. This is so worth it. Soldering with a panavise is way way better than a 3rd hand tool.
So here’s the completed wave shield mounted on a local arduino clone (gizduino). I’ve popped in some WAV files into my SD card, did some programming and it works! Now I have to make everything work together.
I started of with controlling the eyes. So that’s pretty much easy. Just putting a HIGH signal on the I/O port where I’ve connected the LEDs, then turn off after 2 seconds. Then I did a servo test. I got an old servo lying around and started using the arduino’s “sweep” test. Cool. Works pretty well. Then I started coding the PIR sensor. I wanted to turn on the LEDs when I detect some movement. Check!
Now it’s time to combine the LED and PIR control with the audio code for the wave shield. Then a problem emerged. The LEDs doesn’t seem to turn off. It works a while ago when I haven’t integrated the code for the wave shield control. I later on found out that the pins 11,12 where I connected the LEDs is being used by the wave shield so I had to use another pair of I/O pins. Now it works!
Houston, we have another problem. Now this one started when I’m combining these code snippets (servo control, and audio for the wave shield). I’m getting a compilation error. It seems like the WaveHC library and the Servo library uses the same timer. Luckily, I’ve found a software based servo library which doesn’t use a timer.
So I got the thing working. All I have to do is to program the response I wanted whenever the PIR sensor detects some movement.
Turn both LEDs on
Move the head via the servo
Play some audio
Turn off the LEDs
Rinse and repeat
Now here’s the final product.
Robotic Halloween Mask Video