Record video using motion detection
Jonni Bidwell does his bit for the surveillance state by setting up motion-triggered recording on the Raspberry Pi. He’s got his beady eyes on you!
Jonni Bidwell
OUR EXPERT
Jonni Bidwell is fairly contrary. His garden grows with silver bells and cockle shells and Raspberry Pis all in a row.
There are all sorts of things you can do with a Pi and a camera - some of which we dare not mention, and some of which we’ve already covered. Back in LXF265, for example, we showed you how to make a Pi bodycam. We’ve also done stop-motion video (LXF249) and a neat Pi camera booth (LXF248). Way, way back in LXF195 we also made a motion-detecting camera, and we thought it’d be good to revisit this because it’s actually much simpler to set up now. One application for this project is filming wildlife in your garden. Depending on your local climate, you’ll want to waterproof your Pi beforehand and there are a number of external cases that can do just this. You’ll need to have some means of powering it too. We used a PiJuice HAT, which you can connect to an external USB battery or solar panel to top up.
There are a few options software wise, but we’re going to use the same motion software used by Kent Elchuk in our previous motion-detecting tutorial. This will connect to your home wireless network, and enable you to stream via a web browser. By default, the stream will be quite low quality (one Jpeg image per second, which will save battery power). When motion is detected (when a pre-determined number of pixels in the image, subject to some filtering, have changed) the camera will start recording until the motion stops and save a higher-quality video file.