Smart Gates


The principle of operation:

  • The car drives up to the gates.

  • Camera reads the car plate numbers.
  • Checks the read number with the database; if it finds one, then it opens the gate and lets the car pass.
  • Each car at the gates is photographed, then a photo is sent to the Telegram application with the car plate number and its status.
  • Telegram bot has the ability to open and close the gates, take a current photo and add an unknown car to the database.

It’s done with  Python + Bash + Telegram Bot.


For this you will need an RPI3 with the Ubuntu Mate installed. You can get it here:

Installing ALPR library

The easiest way to install

Install ImageMagick

Installing dependencies for Telegram bot

Installing Telegram-cli

Check this link to install and configure telegram-cli in ubuntu.

Relay connection

  • Connect relay to RPI 3. In my case I used GPIO23 pin for 1st relay and GPIO26 for the second one.

You can test the relay with shell script, just create a simple sh script and run it:

Paste the code below and run it.

Script code for relay 1:

Script code for relay 2:

  • Telegram message-send script
  • Create .sh script with the following code:

Telegram photo-send script

  • Create .sh script with the following code:

Create 2 files for the main recognition script:

In the numbers.txt – add all the known car plates numbers.

Order of the numbers.txt should be as follows:






Car plate recognition script

Leave a Reply

Your email address will not be published. Required fields are marked *