11

(Marcin) #1

Build your own ANPR home automation setup


TUTORIAL


IF THIS THEN WHAT?
IFTTT (If This, Then That) is a free online platform that
lets you join together your various apps and IoT devices.
It can talk to lots of online services and smart devices
as both trigger and action, and as the name suggests
it allows you to specify that ‘if this happens, then do
that...’ Have a play, and let your imagination run wild
at: ifttt.com.

As I’m in Europe, OpenALPR had a good go at
reading my plate when I specify ‘eu’. However,
depending on the clarity of the image and angle, etc.
it sometimes mistook the number ‘1’ for an ‘I’ for
indigo, so PA11LFP became PAIILFP, or even PAULFP.
Since the sovereign states of the EU are all able to
set their own independent standards and systems for
car number-plates, OpenALPR allows you to specify
which one, and I found that putting -c gb increased
the accuracy when dealing with 1s and capital Is. See

the ‘Accuracy Improvement’ boxout for two more top
tips for increasing accuracy of plate reading.

NETWORK ACCESS
When choosing an IP camera, you need to ensure
that it supports a resolution of at least 720p and
ideally has an automatic night-time mode, too. It also
needs to support providing a network stream via
RTSP (real-time streaming protocol) and must not be
restricted to accessing via the manufacturer’s own
app. The one I’m using cost about £30 / 30 from a
well-known internet auction website.
Connect your IP camera to the same network as
your Raspberry Pi, give it a static IP address, and set
a strong username/password combination. Some
cameras display the date/time at the top of the
picture and/or allow you to display a label such as
‘Front Driveway’. For simplicity’s sake, turn all options
like this off. If it’s a 1080p camera, turn the resolution
down to 720p, and you can also drop the frame rate
to 15 fps – these settings will be perfectly sufficient
to capture your car’s number-plate, whilst significantly
reducing the bandwidth of your stream so as not to
overload the Raspberry Pi.

MONITOR YOUR DRIVEWAY
Once you’re happy that OpenALPR is working on your
Pi with images from your camera, you can now set it
to monitor the camera’s feed.
First, we need to test that we can view the
network stream from the camera. On another
computer on your network (not the Raspberry
Pi), open up VLC (which you can download from
videolan.org) and click Media, then Open Network
Stream. Here, you need to type the address of your IP
camera’s stream which will incorporate the username/
password you set as well as its IP address etc. This
will vary depending on the make and model of your
camera; for my camera, the stream address is:
rtsp://username:[email protected]/11

To determine the correct stream for your
camera, there are a couple of places you can try.

Right
The sequence
of events and
components/services
involved. As you
park your car on
the driveway, it is
identified as yours
and your hallway
light automatically
turns on

It’s a good idea to
give your Raspberry
Pi a static IP on your
network (outside
of your router’s
DHCP range) so
that weeks later
and after several
reboots, it will still be
accessible via the
same IP address.

QUICK TIP



  1. IP camera sees car

  2. Raspberry Pi, running OpenALPR,
    monitors camera feed and scans
    for number-plates

  3. Raspberry Pi triggers web
    request to IFTTT when car
    spotted arriving

  4. IFTTT instructs Kasa to
    switch on the light bulb
    named ‘Hallway Light’

  5. Car pulls
    into driveway

Free download pdf