0% found this document useful (0 votes)
11 views2 pages

Traffic Light Control System with PIC16F877A

Uploaded by

yassinahmad851
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views2 pages

Traffic Light Control System with PIC16F877A

Uploaded by

yassinahmad851
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Name: Yassin Ahmad Nasr

Task 2
TRAFFIC LIGHTS Project using PIC16f877A:-

- The circuit was designed by proteus 8.3.

- A microcontroller was used int the circuit to implement the program of shifting the lights.

- The IC chip PIC16f877A was used and "mikroC pro" was used to implement that program.

- The mechanism and details of the circuit:

There are two roads intersecting each other. Each one has a traffic light, the two streets cannot
allow the cars to pass at the same time. So, the lights on the southern street should go with the
following order (23 sec 'red', 12 sec 'green', 3 sec 'yellow'), and the lights on the western street should
go with the following order (15 sec 'red', 20 sec 'green', 3 sec 'yellow'). So, the best way to apply the
best timing is to align the southern red with green and yellow of the western street, and align the red of
the western street with the green and yellow of the southern.

There is a manual mode and an automatic one, with a switch to shift between both, and there’s
another switch to shift between streets in manual mode.

- First with the hardware:

* Four decoders of model '7448' were used.

* Four NPN transistors.

* PIC16F877A.

* Six resistors were used, four of value 4.7K, two of value 10K.

* Two switches.

* Two traffic lights (six leds: two green, two yellow and two red)

* Four seven segment display.

* One push button to reset the IC chip.

* Three capacitors (two of value 33pF and one of value 100nF)

* One crystal used to compute time.

- Second with the software:


An array that contains decimal numbers that when turned to binary, the first four bits
represent the units of the counter, and the least four bits represent the tens of the counter. Port a, b, c,
d are declared outputs. And to make the counters start counting, a for loop was implemented to iterate
through the array of segments from the end (the declared starting digit) till it reaches zero , at the same
instance it turns color. In the manual mode, two while loops were made to define the two modes, each
for one street to let the cars pass and for the other to stop them. In the manual mode each street yellow
light should wait tree seconds, so, when the manual mode is applied, the selected street should remain
red until the three seconds pass and the other traffic light turns red, then the selected street can turn
green.

Common questions

Powered by AI

Safety features in the traffic light system include a predefined sequence with staggered timing to prevent concurrent green lights on intersecting streets . The 3-second yellow light period acts as a buffer between red and green phases, warning drivers to slow down and prepare to stop . In terms of software, the microcontroller program ensures that timing and sequence are consistently followed, reducing the risk of synchronization errors, while manual mode features allow operators to control traffic directly if needed .

The hardware components such as the decoders, transistors, LEDs, and the microcontroller need to be cohesively programmed and connected to fulfill the traffic light project's objectives of safe and efficient traffic management . The PIC16F877A is programmed to send signals to transistors and decoders, dictating the light state changes visible using LEDs, while the seven-segment displays give a numerical readout of time intervals . Resistors manage current flow to these components, while capacitors smooth out voltage fluctuations, with the crystal oscillator ensuring timing accuracy. This synthesis of hardware and software is crucial for reliable operation .

The PIC16F877A microcontroller is used to implement the program that controls the shifting of the traffic lights. It manages the timing of each light's color changes on two intersecting roads by aligning the red lights of one street with the green and yellow lights of the other. This ensures that cars do not pass at the same time on both streets .

The crystal oscillator is crucial in defining precise timing intervals in the traffic light control system. It provides accurate timekeeping for switching the lights between red, yellow, and green states . This precision enhances performance by ensuring consistent operation of the light cycles, essential for maintaining safe and predictable traffic flow and supporting manual overriding operations without time discrepancies .

The circuit requires several key components including four decoders (model '7448'), four NPN transistors, a PIC16F877A microcontroller, six resistors (four 4.7K, two 10K), two switches, two traffic lights with six LEDs (two each of green, yellow, and red), four seven-segment displays, a reset push button, three capacitors (two 33pF and one 100nF), and a crystal for timing . The microcontroller coordinates timing and operation, while the decoders control LED displays and the transistors act as switches to power the LEDs. Resistors manage current flow, the capacitors stabilize voltage, and the crystal ensures accurate timing synchronization .

Potential improvements could include incorporating sensor technology to detect traffic density and adjust timing dynamically, integrating wireless communication for remote control and monitoring, or adding solar panels to enhance energy efficiency. Moreover, upgrading to a more modern microcontroller with internet capabilities could allow for traffic data analytics to improve traffic patterns comprehensively . Such innovations could optimize traffic flow and enhance safety further .

The 'mikroC pro' software is used for programming the PIC16F877A microcontroller in the traffic light circuit. It allows designers to write and simulate the control logic for the traffic lights, enabling precise management of light changes and ensuring the alignment of timings between the two intersecting roads . By using mikroC pro, developers can effectively manage the automatic cycling and manual operations needed for safe traffic management .

The southern street follows a sequence of 23 seconds red, 12 seconds green, and 3 seconds yellow, while the western street follows 15 seconds red, 20 seconds green, and 3 seconds yellow . This staggered timing ensures that while one street's light is red, the other can turn green, preventing cars from moving simultaneously through the intersection, thus minimizing chances of accidents . The 3-second yellow period warns drivers of impending stops, adding an additional layer of safety .

In the manual mode, the operation requires manual intervention with a switch to change the light from red to green for one of the streets. The yellow lights still maintain a fixed 3-second duration before allowing the selected street to turn green, ensuring safety . In contrast, the automatic mode follows a pre-defined timing sequence without the need for manual switches, cycling through the colors based on programmed intervals .

Modifying resistors can impact the current level reaching LEDs, potentially affecting brightness and lifespan, while extreme values may cause failure. Changes in capacitor values could affect the circuit's voltage stability, leading to irregular timing and unreliable light switching, especially under fluctuating power conditions. Precision in these components ensures stable and predictable system operations, essential for maintaining public safety . The careful balance designed into the current configuration ensures reliability and performance efficiency .

You might also like