Traffic Signal Controller: A Technical Overview
This document provides a concise technical overview of a working embedded system project: a four-way traffic signal controller implemented using digital logic principles and a microcontroller, demonstrating precise timing and sequencing.
View Source Code
Precise Timing and Core Sequence
The system's operation relies on down-clocking the internal 50 MHz clock to a manageable 1 Hz signal. This 1 Hz base frequency ensures accurate timing for the signal sequence. The sequence progresses in a clear, directional pattern before looping:
North Signal
South Signal
East Signal
West Signal
Visual Representation of the State Machine
The following image illustrates the intended flow and state transitions of the traffic light control system, showing the cyclical nature of the programmed sequence.
Detailed Signal Timing and Red Light Logic
Upon completing the West phase, the sequence automatically transitions back to the North signal, ensuring continuous traffic management. The timing for each phase is meticulously defined:
1
North Green Phase
Active for approximately 4 seconds, allowing through traffic from the North direction.
2
North Yellow Phase
Active for approximately 2 seconds, serving as a caution period before the signal turns red.
3
Transition to South
North light implicitly turns red, and the South Green light activates, initiating the next major phase.
4
Subsequent Cycles
The 4-second Green and 2-second Yellow pattern repeats for the South, East, and West directions.

Implicit Red State
The controller does not utilise a separate red light variable. The Red state for any signal is implicitly activated when both the corresponding Green and Yellow lights are simultaneously deactivated.
System Output Designations
The outputs for the traffic lights are categorised by colour and direction for clear identification within the system's code and hardware interface.
Green Light Outputs
  • ng (North Green)
  • sg (South Green)
  • eg (East Green)
  • wg (West Green)

Yellow Light Outputs
  • ny (North Yellow)
  • sy (South Yellow)
  • ey (East Yellow)
  • wy (West Yellow)
Manual Override and Emergency Input
The controller is equipped with four independent manual input overrides. This feature is crucial for emergency situations or specific traffic management needs, allowing immediate user intervention over the automated cycle.
Input Activation
A high signal on the manual input immediately forces the corresponding light to the Green state, overriding the standard timing sequence.
Sustained Green
The selected signal will remain Green for as long as the manual input signal is maintained high, providing continuous passage.
Cycle Resumption
The system reverts to its normal, automated sequence immediately upon the manual input being returned to the low (zero) state.
Each input corresponds to one of the four directions (North, South, East, West).
Hardware Implementation Detail
This photograph illustrates the hardware setup, providing a tangible view of the signal connections, the microcontroller, and the LED outputs that represent the traffic lights for each direction.
Observe the wiring complexity required to manage the eight distinct light outputs and the four manual inputs within the embedded environment.
Made with