Automatic gateman
A car approaches the boom barrier near the desolate gate. The automatic speaker asks the driver to slow down and come closer not beyond 6 meter distance. A secret high fidelity camera reads the car registration plate, compares its database and if it finds there in its database, opens the boom barriers and asks the driver to proceed. If not, tells the driver to move off the gate. If a new residence comes, his car registration number is updated and the process keeps running. No IR tag, nothing...
Automatic gateman: This is a very common sight. The gate is covered by boom barrier. The car slows down and passes below an IR scanner which reads the faint radiation of IR tag pasted on the car wind shield and the boom barrier opens if the tag is found in its database. The process is highly efficient and works unhindered. However, the only flip side is that the process can work unless there is tag or no damaged tag or no unidentified tag.
The modified gateman: The car approaches the boom barrier near the gate. The automatic speaker asks the driver to slow down and come closer not beyond 4 meter distance. A high fidelity camera reads the car registration plate, compares its database and if it finds there in its database, opens the boom barriers and asks the driver to proceed. If a new residence comes, his car registration number is updated in the car database and the process keeps running. No IR tag, no pasting or no big disk antenna like IR Scanner at the gate… the process can be automated without stopping of the car by incorporating better camera & computer.
Project: A powerful Raspberry Pi 4 computer is deployed for this project. For measuring distance the same image analytic can be deployed but to make process simple we have deployed an HC-SR04 ultrasonic sensor. The moment a vehicle comes within 4 to 6 meter distance the moderately built camera takes a frontal picture of the vehicle and analyze its registration plate with its already available numbers in its database.
HC-SR04 cannot measure beyond 4 meters. To make it 6 meters, it can be fitted on a long 2 meters lead pole with wires in front of the camera on the side of the passage such that when the barrier opens, it will go up with the barrier.
We have used voice synthesizer ‘espeak’ to issue voice instruction to guide the driver. Like it will speak up - come closer, slow down, go away, welcome etc etc. To increase range of measurement from mere 6 meter to 12 meter a TFMini – S [3.4 degree aperture] can be used but a 4 to 6 meters distance is just right for this work. For IR Tag systems the distance is about 2 meters from the scanner.
If anyone thinks that by holding a registration plate in hand will allow it pass, is not possible at all. The car classifier model “haarcascade_russian_plate_number.xml” is used here to identify the car first and then the number plate is identified, scooped and read by the model.
Software:The opensource software – python3, opencv2, espeak, PiCamera, gpiozero, pytesseract, tesseract-ocr ,numpy.
While all these are all opensource software therefore, all can be installed very easily by the following commands on any Raspberry Pi computer.
# sudo apt-get update
# sudo apt-get upgrade
# sudo pip3 install pillow
# sudo pip3 install pytesseract
# sudo apt-get install tesseract-ocr
# sudo pip3 install opencv-python
# sudo pip3 install numpy
# sudo apt-get install espeak
# sudo apt install python3-gpiozero
# sudo pip3 install gpiozero
# sudo apt-get install python3-picamera
Operating Principle: First the HC-SR04 finds the car reaches within 4 or 6 Meter distance of the camera. If not, it will speak out to slow down and proceed further to bring the car within the measured distance. Then it takes a snap of the frontal view of the car.
It then analyze it for being a car. If it finds it being a car, it zooms on its number plate and analyze the number plate. Removes the ‘-‘ and ‘ ‘ from the number and redisplays it.
The database of known number plates are kept ready in a string array [carpool] separated by commas. Each number element of the database is compared against this number to find out the match.
You can say our database being a small one is managed in one string array called carpool which can hold 200 numbers comfortably.
carpool=['OR06F4630','UP16BY0538','MP10CA4768','MH03AW2684','MHO3AW2684']
if a match is found, it will trigger the GPIO21 to open the gate or close it.
There are many more GPIOs available which can be used for multiple triggering of the boom barrier or the gate mechanism – like green light, red light, gate open, gate close etc.
This is how this works.
BOM:
01. Raspberry Pi 3 or 4 computer with 4/8 GB RAM – INR 6000.00 / 8000.0002.
02. Raspberry Pi camera - https://www.electronicscomp.com/ir-cut-camera-5-mp-ov5647-manually-switch-day-and-night-mode-module-with-light-for-raspberry-pi-3-4?search=Raspberry%20pi%20camera INR 1435.0003.
03. Power supply for Raspberry Pi 4 - https://www.electronicscomp.com/official-usb-type-c-15.3w-power-supply-for-raspberry-pi-4-black-us-pin-layout?search=Raspberry%20pi%204%20power%20supply INR 625.0004.
04. Camera extension cord –https://www.amazon.in/gp/product/B09K3FGMV3/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&psc=1 INR 333.0005.
05. HC – SR04 ultrasonic probe https://robu.in/product/easymech-cartoon-bracket-with-hc-sr04-ultrasonic-sensor INR 150.0006.
06. 7” Touch screen for Raspberry Pi [Optional] - https://www.electronicscomp.com/7-inch-lcd-touch-screen-display-with-hdmi-for-raspberry-pi-800x480-resolution?search=touch%20screen%20for%20raspberry%20pi INR 3695.00
Total : INR 14238.00 / USD 180$
Actual deployment:
During actual deployment we found that for cheap quality camera, the lighting creates an issue. What becomes clear during day hours becomes unclear during night time.
However, with good quality camera the problem was overcame.
We have used a camera which has Infra Red light source attached which gives extra edge during night time detection.
A 5 meter camera extension cord is used so that camera can be placed at the center of the boom barrier for proper detection.
The TFT touch screen, the keyboard, mouse etc are all optional. Once the project is deployed at operation level, all these can be stripped off the computer.
Raspberry Pi 4 or 3 can be used for this project. The speaker is to be inserted in the earphone jack. An amplifier or Bluetooth Amplibox can be used for louder & clear voice reproduction. The espeak synthesizer has many options - "espeak","-ven+f3", "abcdefgh 1234567890” “- ven+f3” is for female voice reproduction.
Search internet for more options.
Parts of prototype: [see pics]
Aftermath: The above car is one of the several cars with which we tested the prototype. Each car is allowed to slow down between 4 & 5 meter distance.
The prototype is able to aptly identify the car & the number plate & compared with carpool array and triggers the GPIO-21 of the raspberry pi computer.
Sometimes it misses 0 [zero] for O [O of onion].
This can be tackled in logical level such that the letters at 3,4,7,8,9,10 positions are numbers only. Rests are alphabets.
So the model can rectify the missing number or alphabet accordingly.
The main python script – automatic-numberplate-identification.py runs non stop.
Software: automatic-numperplate-identification.py and numberplate22.py is included here.
Bye, bye
S. Bera
Northkaranpura
Diskussion (4 Kommentare)