I’ve started reading a lot about tracking motion, about playing sound files on Arduino and about similar projects. Here are some excerpts of my Work-in-Progress.
Hardware
Input: For detecting motion I started working with a PIR motion sensor (Noel has done a good description on it here). PIR stands for passive infrared. After calibrating in a still environment It takes infrared images of it continuosly and compares each new one to the last one. In this default state it sends 5 V (HIGH) to a digital pin. When something moves (i.e. a person walks in), the two images do not match anymore and the signal turns to 0 V (LOW).
Output: To output sounds I started using an MP3 Player shield. It’s chip can preocess sound files and it provides a Micro SD slot and a female 3.5 audio jack to plug in an active speaker. I soldered stackable header pins onto it, to be able to stack it onto an Arduino Uno board. I found a great tutorial on sparkfun, that helped me hook up the shield.
Code
Before I started coding, I prepared some sound files. I found different bell sounds online, that I edited down to short MP3 clips. I had to give them specific names (so called “8.3″s) before I copied them on te the SD card.
I then downloaded two libraries, that make using the shield easier. The main one tells the chip to read out the files on the SD card in a specific order and play them, when specific commands are entered via the serial monitor. Then I proceeded, by assigning one free pin to each sound file, that is then played, when this pin is grounded (i.e. button is pressed).
Next
Next, I will try to break it down to just one button, that will trigger one of the sounds randomly. I will then try and replace it with the motion sensor. Whenever this sensor outputs LOW, a sound should be triggered.
…meanwhile I’ve started experimenting with the sensor and its sensitivity. I set up a Quik’N'Dirty prototype, to test how wide and how high a hole would need to be in order for it to reliably detect a moving body but nothing more.