The MagPi - July 2018

(Steven Felgate) #1

Tutorial


(^64) July 2018 raspberrypi.org/magpi
WALKTHROUGH
BUILD A WILDLIFE
CAMERA TRAP WITH
OBJECT RECOGNITION
Uncover the goings-on in your garden, pond, or school playground
when no one’s looking with this easy-to-use Raspberry Pi camera trap
ver wondered what lurks at the bottom of
your garden at night, or which furry friends
are visiting the school playground once all the
children have gone home?
Using a Raspberry Pi and camera, along with
Google’s Vision API, is a cheap but effective way to
capture some excellent close-ups of foxes, birds,
mice, squirrels and badgers, and to tweet the results.
Using Google’s Vision API makes it really easy to get
AI to classify our own images. We’ll install and set up
some motion detection, link to our Vision API, and then



Pi Camera E
Module
magpi.cc/
camera
Pi NoIR Camera
Module (optional)
magpi.cc/
ircamera
ZeroCam
NightVision
(optional)
magpi.cc/
qqXcLK
Waterproof
container (like
a jam jar)
Blu Tack, Sugru,
elastic bands,
carabiners
ZeroView
(optional)
magpi.cc/
2e89hWt
You’ll
Need
JODY CARTER
Jody is a primary school teacher and
computing leader for a MAT. He is
grateful for the Raspberry Pi camera as it
saves him from having to stand outside
in the rain to take bad pictures of wildlife.
twitter.com/codeyjody
tweet the picture if there’s a bird in it. It’s assumed you
are using a new Raspbian installation on your Raspberry
Pi and you have your Pi camera set up (whichever model
you’re using). You will also need a Twitter account and a
Google account to set up the APIs.
Motion detection with Pi-timolo
There are many different motion-detection libraries
available, but Pi-timolo was chosen as it is easy to edit
the Python source code. To install, open a Terminal
window and enter:
Use sealable containers
and jars and make sure
they’re watertight
Position the camera
low and ensure it’s
tight up against any
glass or plastic
Get a decent power
bank that will last for
at least seven or eight
hours overnight
(^64) July 2018 raspberrypi.org/magpi


Free download pdf