Density Based Traffic Lightcontrol System using Raspberry Pi

Copyright © 2019 by author(s) and International Journal of Trend in Scientific Research and Development Journal. This is an Open Access article distributed under the terms of the Creative Commons Attribution License (CC BY 4.0) (http://creativecommons.org/licenses/ by/4.0) ABSTRACT In present days, vehicular traffic is increasing throughout the world, especially in urban areas. As the number of road user’s increase constantly a smart traffic control will become a very important issue in the future. Congestion in traffic is becoming a serious issue. Many vehicles are waiting at the signal for a long time due to this the time consumption is more for the human and there is a lot of problem for the people who go to their work and some to the business works.

In existing system the traffic control is not according to the density, and is not reducing the effect of traffic in urban areas. The traffic signals are prepared previously fixed for some time only after that time the signal will be changed to another signal. This makes the other side roads delay for long time. In some places traffic lights did not work properly. In the proposed system by using the image processing along with the raspberry pi, the vehicle count is measured and accordingly the traffic will be reduced. Emergency vehicles like ambulance and fire are easily allowed from the traffic by using the RF transmitter and receiver. Ambulance like vehicles send the signal to the receiver and make the green signal to glow on that road. This makes the safety of the people in the ambulance and this will be applicable to fire vehicles also. IR sensors are used to avoid the crossings of the road when the red light is on. Traffic updates are monitored with help of density based traffic control system.
The hardware components used in the project are raspberry pi and modules like camera, IR sensor, RF transmitter and receiver and actuator. These modules are interfaced to raspberry pi to control the traffic and maintain the output to be accurate. Software implementation is done by image processing technique back ground subtraction method. The programming language used for implementing is python language. By using this software and hardware components the implementation is done by using VNC viewer application. The program is previously dumped in the application and the module will run according to the program.

I.
INTRODUCTION Traffic congestion is a relentless problem in many cities around the world. Congestion means a lost worker productivity, trade opportunities, delivery delays. Traffic lights which are of current technology use manual operating system for the time allocation and also require high maintenance during the operation. This makes more and more time lapsing and increase in the vehicular traffic. This proposed system results in making the traffic less and allow the vehicles based upon the density on the road.
The aim of the project is to reduce the traffic in areas where there is a heavy density of vehicles by implementing Raspberry pi operation along with image processing.

II.
METHODOLOGY This traffic controller is designed with Raspberry Pi, Image processing using python, Pi-Camera, IR sensor, motor and RF transmitter and receiver. Image processing is performed to convert the raw images into more accessible form. Raspberry Pi is the main component which is used to control all, it acts like a controller. Traffic is captured by the pi camera and this information is sent to pc. The PC is connected to the Raspberry pi to do the hardware implementation in which it controls the signal using traffic control system.IR sensor is used to activate the motor. The motor with nails is placed below the traffic light to control the traffic when the red light is on. Emergency vehicles like ambulance or any VIP vehicles are also allowed by using the RF transmitter and receiver. The Functional block of the Density based traffic light control system is shown in the Fig.3.1. Here the Raspberry pi 3B+ is interfaced with IR Sensor to detect the vehicles, Camera to capture the vehicles on the road and the Motor which is connected to IR sensor used to avoid the vehicles crossing the road during red light. SD card is initially inserted in the Raspberry pi.
WIFI module also interfaced with in the raspberry pi which is used to connect the PC and the hardware kit. VNC viewer is used as a tool to connect the Raspberry pi to the system. Server is the system which is named as PC. Nails are connected to motor to tilt when IR sensor detects the vehicle.

IV. FLOW CHART
It follows with initializing the camera and then capturing the images. Back ground subtraction method of image processing is done to know the count of vehicles.
This count is taken by the system and according to that the function will work and the control of traffic takes place on the road. If there is any emergency vehicle on the road then it receives the signal from transmitter and allows the vehicle by giving green light to the road otherwise the normal operation is performed on that road.
If the density of the road is more, then it turns green light on and if it is less then red light is turned on that road. So we can control the traffic by implementing this method. In this way the flow of the proposed system will be done.
V. DETAILED DESIGN A. CAMERA MODULE Raspberry Pi Camera Module with adjustable-focus is compatible with the original one, supports all revisions of the Pi. The 5 megapixel OV5647 sensor is the core of the module.
The camera board attaches to the Raspberry Pi via cable. There are only two connections to make: the cable needs to be attached to the camera PCB, and to the Raspberry Pi itself. You need to get the cable the right way round, or the camera will not work. On the camera PCB, the blue backing on the cable should face away from the PCB, and on the Raspberry Pi it should face towards the Ethernet connection Transmitter emits the IR rays which will strike the object.IR sensor identifies the vehicle which crosses the road when the red light is on. When the vehicle tries to cross the road, motor is activated by IR sensor which is connected by the nails. The nails get tilted by the motor so no vehicle can cross the road when the red light is on.
The IR sensor is interfaced to raspberry pi with the wires. IR sensor has 3 pins naming VCC, GROUND, OUT. VCC is connected to motor which is used for rotating it and also connected to GPIO2 pin of raspberry pi. GROUND is connected to IC and the traffic lights. OUT pin is connected to GPIO26 of raspberry pi. These pins are used to rotate the motor when there is a vehicle crossing during red is light on. IR sensor has transmitter and receiver in it which is used to identify the vehicles. When the vehicle strikes the sensor it transmits to receiver. So the motor can rotate and the nails are tilted with the help of motor. IR sensor turns the LED in it which gives the notation that it detects the vehicle.

C. RF TRANMITTER AND RECEIVER MODULE
RF transmitter and receiver are with 434 MHz frequency is used for transmitting signals from place to another place to inform about the data. RF transmitter and receiver are used for the vehicles like ambulance, fire and police. The transmitter is connected to battery and the receiver will be connected to raspberry pi module.
The RF transmitter is fixed in the vehicles, when these vehicles got struck in the traffic, transmitter sends the information to the receiver manually, by this action the green light is allowed to that road which sends the vehicles immediately. In this way the emergency vehicles are allowed to save the life of the people who are in severe condition.

Fig 5.3 Interfacing RF TX and RX D. MOTOR
Motor is connected to VDD pin of IR sensor and to ground pin raspberry pi. This motor is placed at the end of zebra crossing to avoid the vehicles crossing the road during red light. Nails are connected to motor to control the vehicles crossing road when the red light is on. The motor turns on and start rotating. The nails which are connected to motor will tilt upwards and make the vehicle stop. These lights are operated with the help of raspberry pi which controls the system. When the vehicles are more on the road then green light will be allowed for some time and then the red light will glow after the road has less vehicles on it.

Fig 5.5 Interfacing traffic lights
VI. RESULTS An innovative system for detecting and extracting vehicles in traffic surveillance scenes is presented. This system involves locating moving objects present in complex road scenes by implementing an advanced background subtraction methodology.
The innovation concerns a histogram-based filtering procedure, which collects scatter background information carried in a series of frames, at pixel level, generating reliable instances of the actual background. The proposed algorithm reconstructs a background instance on demand under any traffic conditions. The rationale in the approach is that of detecting the moving objects from the difference between the current frame and a reference frame, often called "background image", or "background model". Background subtraction is mostly done if the image in question is a part of a video stream. Background subtraction provides important cues for numerous applications in computer vision, for example surveillance tracking or human poses estimation. In the below fig. 6.1 the hardware components are interfaced to Raspberry pi and the Raspberry pi is connected to VNC viewer through Wi-Fi.

interfacing camera
Camera module gives the output of vehicles on the road. The image converts into white spots by using back ground subtraction method and decides the red or green signal to that road.

Fig6.5 Camera output
From the fig. 6.5 the output of the camera is shown. The vehicles are detected from the camera and image processing technique is processed on the vehicles by making the boxes on each vehicle and the count is known. RF transmitter and receiver are used to allow the emergency vehicles like ambulance, fire etc in traffic the signal from the vehicle is received by receiver and the green light will allowed on that road. In accordance with the traffic congestion in urban areas, we designed a density based traffic control system by using Raspberry pi, IR sensor, Camera module, Image processing. The camera module is installed at the starting of the road. This gives the count of vehicles on the road, with the help of that count we can control the traffic by allowing the vehicles where the density is more. The system provides better flexibility to manage the traffic. The information about the ambulance is also known by transmitting the signal and will be displayed green light on the road. When the vehicle tries to cross the road during red light, it will get damaged by the nails connected to motor. Density based traffic light control system is productive and it reduces the traffic in urban areas, time consumption due to heavy traffic.