Vehicle Control Using Raspberrypi and Image Processing

The objective of the proposed work is to implement the available technique to detect the stop board and red traffic signal for an autonomous car that takes action according to traffic signal with the help of raspberry pi3 board. The system also uses ultrasonic sensor for distance measurement for the purpose of speed control of vehicle to avoid collision with ahead vehicle. Rpi camera module is ued for signboard detection and ultrasonic sensors are used to get the distance information from the real world.The proposed system will get the image of the real world from the camera and then masking and contour techniques are used to detect the red signals of the traffic and To determine the traffic board signs like stop board system will use haar cascade technique to determine the stop words.So car will be able to take action and reduces the chances of human errors like driver mistakes that results road accidents .The coding for this whole system is in python and for image processing opencv is used that is much efficient as compare to the matlab .Ultrasonic sensor is used for the obstacle detection in place of camera because distance finding from the camera is more complex and computational as compare to the ultrasonic sensor. Ultrasonic sensor directly gives the obstacle distance infront of it without more complex computations.


INTRODUCTION
As a result of a survey more than 90 percent of road accidents happen due to the driver mistakes.These mistakes are red signal jumping,over speeding,not following road signs like stop board etc [5]. So to overcome this problem designing of a system that itself takes the real world data of the traffic and take action in the cause driver will not responding according to the traffic signals . So that we can reduce the human error as well as reduce the traffic problems caused by human due to phone calls and other facilities of entertainment or by the human avoidance of the traffic signals.So ,proposed system can assure that the people in the car and outside the car both are saves while travelling to their destinations.System of the car automatically determine the distance of the vehicles a head of our car using ultrasonic sensor module accordingly we can slow down or speed up the car.Using Ultrasonic sensor at the back of the car will also reduce the problem of parking accidents because of unaware of the distance of the obstacles at the back of the car since system will get the distance of the obstacles without seeing it. People will also able to do their work while driving because car itself take the responsibility and perform required action like controlling brakes,speed,wheels control etc.

METHODOLOGY
Due to low budget we used a two wheel chasis for the car and implemented all the techniques that gives accurate results.

Traffic signs and signal detection
The main work of the proposed system is to detect the sign boards like stop board and signals like red light signal. For red signal system will always trying to determine between the lower and upper range of the red colour and a rectangle be formed on the red signals.The rectangle formed on the red light signal has a fixed area by the use of that area system creates a signal that control the gpio pins of the raspberrypi.
For the detection of the stop board sign system used cascade classifier in which it compare the xml file of different size of stop word with the input available from real world of traffic signboards using camera.After match found it generates a signal so the pi sends a control signal to the l293d to control the motors of the chasis.

Obstacle detection
Using the ultrasonic sensor system get the distance of the objects ahead of the car [8] .It gives the distance upto the 4 metre and to control the car and applied the break 1 metre distance is enough so when any objects comes at the range of the car it slow down the wheels using PWM And when objects comes at the range of 50 cm ,it stops the wheels to avoid the accidents[9].

Security for parking
During parking of the car there is problem of back side damages by accident so we used an ultrasonic sensor at the backside of the car to avoid these errors .So by the use of an ultrasonic sensor we can save our time and money as well and design a car more technically efficient in performance.

Speed to overtake
In this project using ultrasonic sensor and image processing we can get the exact speed to overtake a vehicle ahead of us.When any vehicle comes at the range of my car ultrasonic sensor gives the distance of the next car at regular interval and backside ultrasonic sensor also gives the distance of the result so by getting distance of the next car at regular time we can calculate the maximum speed of our car to overtake the next vehicle that is ahead of my car.

A. Raspberry pi3
Raspberry pi is a small chip of single board computer .There are various model of raspberrypi available in the market i.e. the Raspberry Pi1 Model B,Raspberry Pi1 Model B+,Raspberry pi2,Raspberry Pi3 Model B.These all are differ in memory capacity and hardware features like Raspberry pi3 has inbuilt Bluetooth and wifi modules whereas in previous versions these modules were not available .It has 1.2 GHz 64-bit quadcore ARMv8 CPU with 1 GB of RAM [4]. B. Pi camera Camera is used to take the continuous images to get the traffic signs and signals from the real world .According to the images available through the camera we can send these images to the raspberry pi to perform the action to control the car .   Fig 2:picamera C. Ultrasonic sensor Ultrasonic sensor(hc-sr04) is used to detect the obstacles and avoid the accident [2] .It has 4 pin vcc,gnd,trig and echo [3].It gives upto 4 metre information and we need to stop our vehicle at the distance of 1 metre before any vehicle which is ahead of ours. D. Motor driver IC L293D is a motor driver IC that can control two DC motors at a time .Input 00 and 11 stop the motors whereas logic 01 and 10 starts the rotation of the motors in clockwise and anticlockwise directions, respectively[7]. Low anti-clockwise E. Python software Python is a high level ,general purpose programming language used widely in industries and research work also used in making general purpose projects[6].It`s software comes in various version i.e. IDLE python 2 ,python 3 also in these two types different version of python IDLE are available for programming the python language. F.Opencv It stands for Open Source Computer Vision .It has a library of programming function mainly for real time computer visions. It has over more than 2500 optimize algorithms for set of classical algorithm as well as for the state of art algorithms in the computer visions [8].Opencv is basically used for image processing in which we used it for the face detection ,object detections,image recognition,traces and also for other functions [8].

HARDWARE CONNECTION
The 2 wheels of chasis connected with two motors .Motor driver IC l293d is used to control the motor, one motor driver IC can control only two motors .So the proposed system used one l293d that is enough to control the motors.So the input for motor driver IC is given by the Raspberrypi and the output pins of the motor IC are connected to the motor of the chasis.
For movement of the car in forward and backward direction system will rotate the wheels in equal speed whereas to move left or right system will slow down the one wheel as compare to the other one according to the turning points i.e. if system need to rotate the turn in left direction system have to slow down the left wheel and if there is need to turn in right direction system have to slow down the right wheel. In the proposed system the input to the motor driver IC from is given from the GPIO pins(2,3) for driving the left motor and GPIO pins(9,10) is used to drive the right motor from l293d. Block diagram of connection: 4. PROJECT PHASES 4.1 Phase 1: Remote control car A car controlled by some remote media it can be mobile or web interface.But on remote control car ,car was not able to take any actions by itself ,to drive that car every actions accordingly real world data has been taken by a person so that it was just like a person is driving a car not more than that.Also the problems of delay occurred because for each signal send by a person ,it may be low or high data that takes some amount of time and it generates the delay.There may be the chances of error since each low and high signal has individual operation and while sending every time new data if signal exchange then it cause a problem due to human errors [8].

Phase 2: Autonomous obstacle avoidance
Cars comes up with the obstacle avoidances features using IR sensors in which distance measurement problem at Innovative Systems Design and Engineering www.iiste.org ISSN 2222-1727 (Paper) ISSN 2222-2871 (Online) Vol. 8, No.2, 2017 48 low cost price sensor and it also not accurate with every colours so it was not good to use .Another method to find the distance of any object using cameras but on that large computation required that makes processor so busy and takes time for that whereas in this proposed system ultrasonic sensor is used that takes less computation time and gives accurate results in the form of the distances[1].

CONCLUSION
In this paper, a method to make a self responding robot car is represented.Working of different hardware components are described.A way to find the stop signsboard and red signals have been defined and also way to detect the obstacles .All methods and algorithm mentioned in this paper are successfully implemented in a robot car of chasis having two wheels.

FUTURE WORK
To enhance it more in the future machine learning algorithms can be used so it can be able to determine each objects .The current performance is good but to make it more efficient it is necessary to implement it using machine learning and other algorithms so it will undersatand more things.So in future to make it more advance it