0% found this document useful (0 votes)
85 views16 pages

Digital Fundamentals - Group Project - Report - Redback Spider

The document describes a project to design and implement a smart traffic light system using a microcontroller. It includes simulations of basic traffic light sequences and a dynamic system using finite state machines. The simulations are then adapted for implementation on an Arduino board with physical LEDs and a button.

Uploaded by

Aalu Singh
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)
85 views16 pages

Digital Fundamentals - Group Project - Report - Redback Spider

The document describes a project to design and implement a smart traffic light system using a microcontroller. It includes simulations of basic traffic light sequences and a dynamic system using finite state machines. The simulations are then adapted for implementation on an Arduino board with physical LEDs and a button.

Uploaded by

Aalu Singh
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
You are on page 1/ 16

DIGITAL FUNDAMENTALS

Group Project - Report

Report By: Redback Spider


Members are:
Aryan Sawan
Jaivardhan Singh
Achutya Gupta
1

1. Requirement of The Task


1.1. Problem Statement
Traditional traffic light systems rely on fixed timers for state transitions, limiting flexibility
and adaptability in managing traffic flow. This project addresses this challenge by
designing and implementing a smart traffic light system with two key functionalities:
• Simulating a basic traffic light sequence: This involves repeating a fixed cycle of
green, yellow and red lights to control traffic.
• Developing a dynamic traffic light system: Based on simulation incorporating
finite state machine (FSM) and pedestrian button activation. FSM allows real-
time adjustment of light sequences based on pedestrian button presses,
improving responsiveness and potentially increasing traffic efficiency.

1.2. Input - Output Descriptions


Inputs:
● Counter Block (Simulation Part 1): Generates a free-running counter, that
counts from 0 to 15 every second, to determine the traffic light sequence
timing.
● Pushbutton (Simulation Part 2): Simulates or acts as a physical pedestrian
button to initiate a state transition in the FSM

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

Minimized Logical Expressions:


We can use K-maps to simplify the logic for each light output. Analyzing the truth table,
we can derive the following minimized expressions:

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

Final Logical Circuit:


We can now design our final logical circuit in Simulink using the above logical
expressions.

Image 1: Screenshot of our logic gates connected according to the logical expressions in Simulink.
5

2.2. Part 2: Simulation with Push Button

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.

Here's a breakdown of the lighting behavior for each 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:

STATE 1 Button STATE 2 STATE 3


Green Pressed Yellow Red
6

Stateflow Chart Blocks:


Once we are done making the flowchart for our different states, we can now jump onto
our next step, where we then convert that idea into something much more technical.
We’ll make Stateflow chart using Stateflow block present in Simulink library.

Default
state

Image 2: Screenshot of our Stateflow chart in Simulink

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)

3.2. Circuit Design:

Part : 1

Cable
connected to Ground Wire
our computer

Traffic LEDs Pedestrian LEDs

Image 3: Circuit diagram of part - 1


8

Part : 2

Push Button for pedestrians

Image 4: Circuit diagram of part - 2

3.3. Addition of Arduino Blocks:


Using Arduino add-on in Simulink, we will now connect our inputs and outputs with Digital Input
and Digital Output blocks, respectively, from the Simulink library. We will then assign a unique
pin to the input and output block, which will then be associated to actual Arduino pin on our
Arduino Uno. Digital Output
Blocks

Counter Block

Image 5: Screenshot of our Simulink module using Arduino blocks for Part 1
9

Digital Output
Blocks

Part: 2

Digital Input Block


for push button

Image 6: Screenshot of our Simulink module using Arduino blocks for Part 2

4. Simulation and Hardware Testing


4.1. Simulation Testing:
Part 1:
For first seven seconds green traffic light and red pedestrian light glows, then, for next
three yellow traffic light glows and the red pedestrian light remains ‘On’ for this time
period. For last six seconds, all the traffic lights are turned ‘Off’ except the red light, and
with that our green pedestrian light lights up. This cycle should then keep repeating till
we stop our simulation. Only one traffic light and only one pedestrian light is ‘On’ at a
time. This is how our simulation is meant to work.
10

For first seven


seconds

For next three


seconds
11

For last six seconds

Image 7,8,9: Screenshot of our Simulink module while running. PART - 1

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 1: Button Not


Pressed

State 2: Button
Pressed. Yellow
light turns on.
13

State 3: Red light


turns on after 3
seconds

Image 10,11,12: Screenshot of our Simulink module while running. PART - 2

4.2. Hardware Testing:

Image 13: Hardware Testing – PART - 1


14

Image 14: Hardware Testing – PART - 2

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:

1. Counter-based Model (Strength): Provided a straightforward foundation for


understanding basic traffic light sequencing.
2. FSM-based Model with Pedestrian Activation (Strength): Introduced dynamic
control, improving adaptability to real-time events like pedestrian button presses.

We then translated the FSM model to a functional Arduino system using LEDs,
demonstrating the feasibility of hardware implementation.

Areas for Improvement:

● Limited Traffic Complexity: The current model simulates a single intersection.


Future iterations could explore multi-lane scenarios and coordinated traffic flow
across networks.
15

● 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.

You might also like