07-03-2016, 02:47 PM
hello all.please i am looking forward to your help on the programming of a traffic light controller using the Visual Basic programming language basically based on the density of cars and also the timing of the traffic lights (red,green and yellow).
Regards, Sajor Barrie.
Posts: 8,059
Threads: 1
Joined: Mar 2014
code for traffic light controller based on density
Nowadays, controlling the traffic becomes major issue because of rapid increase in automobiles and also because of large time delays between traffic lights. So, in order to rectify this problem, we will go for density based traffic lights system. This article explains you how to control the traffic based on density.
In this system, we will use IR sensors to measure the traffic density. We have to arrange one IR sensor for each road; these sensors always sense the traffic on that particular road. All these sensors are interfaced to the microcontroller. Based on these sensors, controller detects the traffic and controls the traffic system.
Density Based Traffic Signal System Circuit Principle:
The main heart of this traffic system is microcontroller. IR sensors are connected to the PORT C (PC0, PC1, PC2, and PC3) of the microcontroller and traffic lights are connected to PORT B and PORT D. If there is a traffic on road then that particular sensor output becomes logic 0 otherwise logic 1. By receiving these IR sensor outputs, we have to write the program to control the traffic system.
Actually this is remote traffic monitoring and control system in which a police man can control the flow of traffic from a remote location through his computer. He can generate all three traffic signals (red, green & yellow) on a click of mouse only. Also he can divert the flow of traffic by monitoring it on his computer screen through camera.
The program written in VC++ controls the traffic flow in both the manners automatic and manually. In automatic mode traffic flow is controlled by predetermined time periods and in manual mode a police man can open or close any lane depending on the traffic density on each lane. Means if on one lane traffic is much more than any other then that lane is open till any other lane has a greater traffic density.
One more added feature is alarm system. Whenever any driver wants to drive out in red light the laser beam will be interrupted and it will ring an alarm in police station.
Note:- complete project is developed by two students Patel Bhavin and Tandel Jiten of 4th EC from Dr. J. N. Meha Govt. Polytechnic, Amreli under my guidance.
There are two sections of the project (1) Hardware section (2) software section
Hardware section is to switch ON/OFF Red, Green & Blue LEDs of all four lanes. Depending upon the input code given to the circuit by computer program, it will ON or OFF particular LED.
The software section just gives the proper code to the circuit depending upon the user command like to open lane 1 or lane 2 or anything else.
it will be better to understand software codes if we first see the logic behind the hardware circuit.