Digital Fundamentals - Group Project - Report - Redback Spider
Digital Fundamentals - Group Project - Report - Redback Spider
Outputs:
● Dashboard Lamps (Simulation): Visually represent the state of the traffic
lights (red, yellow, green) and pedestrian lights (red, green).
● LEDs (Hardware): Replicate the functionality of the simulated traffic lights
using actual red, yellow, and green LEDs.
2. Algorithm Design
2.1. Part 1: Counter-Based Simulation (Combinational Logic)
Truth Table:
To determine the state of each light (Red, Yellow, Green, Pedestrian Red, Pedestrian
Green) based on the counter outputs (A, B, C, D), we'll create a truth table. Each
combination of A, B, C, and D represents a specific count value from the counter block.
2
A, D being the MSB (Most Significant Bit) and LSB (Least Significant Bit) respectively. B
and C being the bits in between.
Output for our traffic lights are in ‘0’ or ‘1’, zero being ‘Off’ and one is when the light is
‘On’.
INPUT OUTPUT
A B C D G Y R P(G) P(R)
0 0 0 0 1 0 0 0 1
0 0 0 1 1 0 0 0 1
0 0 1 0 1 0 0 0 1
0 0 1 1 1 0 0 0 1
0 1 0 0 1 0 0 0 1
0 1 0 1 1 0 0 0 1
0 1 1 0 1 0 0 0 1
0 1 1 1 0 1 0 0 1
1 0 0 0 0 1 0 0 1
1 0 0 1 0 1 0 0 1
1 0 1 0 0 0 1 1 0
1 0 1 1 0 0 1 1 0
1 1 0 0 0 0 1 1 0
1 1 0 1 0 0 1 1 0
1 1 1 0 0 0 1 1 0
1 1 1 1 0 0 1 1 0
Table 1: Truth Table for Simulation
G, Y, R, P(G) and P(R) are for Green, Yellow, Red, Pedestrian Green and Pedestrian
Red lights, respectively.
Integer
Counter
to Bit
Karnaugh Maps:
For each of five outputs we can transformed into a Karnaugh map using our truth table
above (refer to Table 1).
3
Green Light
C’.D’ C’.D C.D C.D’
A’.B’ 1 1 1 1
A’.B 1 1 0 1
A.B 0 0 0 0
A.B’ 0 0 0 0
Yellow Light
C’.D’ C’.D C.D C.D’
A’.B’ 0 0 0 0
A’.B 0 0 1 0
A.B 0 0 0 0
A.B’ 1 1 0 0
Red Light
C’.D’ C’.D C.D C.D’
A’.B’ 0 0 0 0
A’.B 0 0 0 0
A.B 1 1 1 1
A.B’ 0 0 1 1
Pedestrian Green
C’.D’ C’.D C.D C.D’
A’.B’ 1 1 1 1
A’.B 1 1 1 1
A.B 0 0 0 0
A.B’ 1 1 0 0
Pedestrian Red
C’.D’ C’.D C.D C.D’
A’.B’ 0 0 0 0
A’.B 0 0 0 0
A.B 1 1 1 1
A.B’ 0 0 1 1
Table 2: Karnaugh map for every output
Green Light: y = A'B' + A'C' + A'D’ Pedestrian Red Light: y = A' + B'C'
Yellow Light: y = AB'C' + A'BCD Pedestrian Green Light: y = AC + AB
Red Light: y = AC + AB
4
Image 1: Screenshot of our logic gates connected according to the logical expressions in Simulink.
5
In this FSM-based system, we don't directly generate lighting outputs using Boolean
expressions. Instead, the state transitions determine which lights are active based on
the current state.
● State 1 (Traffic): Green light and Pedestrian Red light are active.
● State 2 (Caution): Yellow light and Pedestrian Red light are active.
● State 3 (Pedestrian): Red light and Pedestrian Green light are active.
The logic for activating these lights can be implemented within the FSM block itself
using Simulink constructs.
Additional Notes:
● In the algorithmic state diagram, timers are not explicitly shown for simplicity.
However, the state durations (3 seconds for Caution and 6 seconds for
Pedestrian) would be implemented within the FSM block to trigger state
transitions.
● Techniques like counters or timers within the FSM can be used to manage these
durations.
This approach using an FSM allows for a more flexible and adaptable traffic light system
compared to the counter-based approach in Part 1. The FSM can be easily modified to
incorporate additional functionalities or adapt to changing traffic patterns.
Flowchart:
Default
state
Variable button is an input here which takes the value ‘1’ when pressed and ‘0’ when
released. Glight, Ylight, and Rlight are variable that define the state of our traffic lights,
one for ‘On’ and zero for ‘Off’.
7
3. Hardware Implementation
Upon successful simulation, the Simulink models will be adapted for Arduino Uno
hardware, facilitating real-world deployment. Simulated lamps will be substituted with
physical red, yellow, and green LEDs, enhancing the system's practicality and
applicability. The pushbutton component will be replaced with a physical momentary
switch on the breadboard, emulating pedestrian button functionality. Active-high logic
will govern the system, with LEDs illuminated for a HIGH signal and extinguished for a
LOW signal. A meticulously organized and wired breadboard configuration is imperative
for achieving a polished and functional hardware implementation.
3.1. Components:
• Red, Yellow, Green LED lights
• Resistors
• Jumper wires
• Breadboard
• Arduino Uno
• Connector Cable
• Push Button (Only for part - 2)
Part : 1
Cable
connected to Ground Wire
our computer
Part : 2
Counter Block
Image 5: Screenshot of our Simulink module using Arduino blocks for Part 1
9
Digital Output
Blocks
Part: 2
Image 6: Screenshot of our Simulink module using Arduino blocks for Part 2
Part 2:
In this part, a push button is added. Our green traffic light and red pedestrian lights stay
‘On’ until someone presses the pedestrian push button. Once the push button is
pressed, yellow traffic light immediately lights up, whereas red pedestrian light stay ‘On’.
The yellow traffic light and the red pedestrian light stay ‘On’ for the next three seconds.
After that, the red traffic light and green pedestrian light lights up for the next six
seconds. Only one traffic light, and only one pedestrian light is on at a time.
(P.T.O)
12
State 2: Button
Pressed. Yellow
light turns on.
13
5. Conclusion
This project investigated the design and implementation of a smart traffic light system
using simulation and Arduino. We successfully built a two-part Simulink model:
We then translated the FSM model to a functional Arduino system using LEDs,
demonstrating the feasibility of hardware implementation.
● Static Timings: While FSMs offer flexibility, the timing within each state remains
fixed. Implementing timers or adaptive control algorithms could further optimize
traffic flow based on real-time data.
● Simplified Pedestrian Detection: The current model uses a button for
pedestrian activation. Future advancements could integrate real-world sensors
(e.g., pressure pads) for more accurate pedestrian detection.
Overall Significance:
To conclude, the current project can be regarded as a contribution to the development
of intelligent traffic management systems. The FSM-based approach proves the
possibility of developing adaptable traffic light control to better meet pedestrian
requirements and potentially view the entire traffic flow more operational. If the current
limitations are addressed, further versions may promote the development of a more
efficient and user-friendly transport system.
6. Contribution Table
Tasks Who contributed (by percentage)
Making Simulink models and Hardware Aryan Sawan (50%) & Jaivardhan Singh
Implementation (50%)
Presentation Aryan Sawan (50%) & Jaivardhan Singh
(50%)
Report Aryan Sawan (20%), Jaivardhan Singh (60%)
& Achintya Gupta (20%)
7. Referencing
[1]. https://www.tinkercad.com/dashboard : Used to create circuits for hardware implementation
part.