Setting up motion detection
It would be nice if the camera is not constantly filming because that would draw too much power. However, the camera needs to know when to snap a picture. I’m using a Passive Infrared (PIR) sensor for this. This particular sensor is incredibly simple. Just three pins to consider
We can dispense with the CDS pin since it is meant to be used with a light sensitive resistor so you can suppress sensing in daylight. We will be using the PIR to sense motion at all times so we leave this pin unconnected.
I’ve played around with the PIR sensor to see how sensitive it is and whether we need to make any adjustments, see the picture of the test setup. The LED goes on when the OUT pin of the PIR is high.
It turns out that the PIR sensor is calibrated in a way that is usable for our purposes. So we can use it out-of-the box.
In the picture you can see that the PIR is already hooked up to the BB. The BB has only a few pins available which are all designated for other uses (such as serial comms, JTAG, etc.) You’ll need to free-up some pins. Again Biff comes to the rescue with a nice HOW-TO on this topic (Biff, keep up the good work).
You can find the pinout for the BB here. Here’s how I hooked up the pir sensor. I just soldered together some jumper cables from bit’s and pieces I had lying around. But you could you standard jumper cables (removing the need for a solderling skill).
The pins in the picture correspond to the pinout table with the leftmost pin being pin nr 1 (+3.3V). I’ve hooked up the PIR (VCC) pin to pin 1 (+3.3V). I’ve hooked up PIR (OUT) to pin 8 (GPIO7) on the BB and I’ve hooked up PIR (GND) to pin 6 (GND). No need for any resistors since the voltage levels match exactly. the OUT pin goes to 3.3V when HIGH which is nicely detected by OpenWRT and the file /sys/class/gpio/gpio7/value becomes 1 (if you have configured your gpio pins correctly).
So far connecting the PIR sensor. Next time we’ll cover setting up Wi-Fi on the BB…
Update: you can find part two here.