Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In this assignment, you will develop a simple traffic light control system for a four - way street intersection using Arduino Uno board. At the
In this assignment, you will develop a simple traffic light control system for a fourway street intersection
using Arduino Uno board. At the minimum, you must prepare sets of traffic lights each set consisting
of a Red, Yellow Amber and Green LEDs of adjacent streets or crossstreets, eg North and East
and switches pushtype for pedestrians, one for each of the streets eg one for North and other for
East An example of circuit connection diagram for one set is shown below left You will need to
prepare sets of this circuit for this assignment. Digital output pins and digital input pins needs to be
connected to your Arduino Digital pins between pin to
GND
As a requirement for this assignment, you will need to prepare the circuit on a breadboard with proper
connection to your Arduino and write a software code using Arduino Sketch to control the LEDs in
proper sequence and allow the switch press to modify the timing of the sequence. Normally if none of
the switches are pressed the LEDs will turn on and off in this sequence: Red Green Amber Red
etc. with the given time delay mentioned later. As soon as one of the push buttons is pressed on either of
the streets the corresponding Amber yellow LED will light up followed by Red for that side of the
street. The adjacent street must also have the opposite sequence ie opposite to Red light is Green
followed by Amber After Red light time expires, then the sequence will continue according to normal
timings. If the switch is pressed when the Red or Amber LED is ON then the switch press will be
ignored.
To construct this setup, you can follow this procedure:
First make the LED circuits shown above. Use the breadboard to setup sets of LEDs ie LEDs
in total: Red, Yellow, and Green Each set will consist of one red R one yellowamber A
and one green G LED. Each set will represent one direction of Traffic ie one set for EW & another
set for NS Each LED must have a series Resistance of or as shown. Digital output pins Digital input pin
VDD
Connect the LEDs to different Digital IO pins of the Arduino Uno you can use any Digital pin
between to eg for one set you can use pins & and for the other set you can use pins
Refer to Tutorial for further details of LED connections. Note: Do not use digital pin or
Following the Tutorial code, write a test code to turn ONOFF blink each LED independently this
process ensures that your LEDs are connected properly Note that you should change the digital pin
number in your test code to verify proper connection of each of the LEDs one by one do not connect
multiple LEDs on a single digital pin You can use this type of partial checking for correctness of
your partial hardware setup in any project circuit setup testing to avoid later pitfall a strategy known
as Divide and Conquer!
Next, you can start programming the state machine. Here you can use simple delay statements. For
the timing of the LEDs RGARGA etc. use this following sequence and times for delays.
Note: The delay of red light needs to be equal to the total delay of green and amber lights this is a
constraint of the timing for traffic signal lights.
You also need to ensure the timing of the adjacentstreet is operating opposite way see the timing
diagram below to allow proper traffic flow on both streets. An example timing diagram for the two sets
of lights are shown below. For instance, Traffic light set can be for North N direction, and Traffic light
set can be for East E direction.
Implement this first with properly thought out delay statements in Arduino Sketch. After completing
the code, upload the code to your Arduino and test LEDs for functionality.
Now, you can add two pedestrian switches. A pedestrian can press this switch to immediately change
the light to red so that heshe can cross the street. Set up the switches as given in the schematic above
for each set and connect the digital input pin to an available Digital pin between to eg digital
pin for one side and digital pin for other side Make sure these Digital pins are set as INPUT pin
in the setup for example pinMode INPUT Also, you need to read these inputs as digital logic
value in loop for example val digitalRead You can then use val as Boolean logic
TRUEFASLSE in your if statements. Note that the circuit shown above will produce logic V
when the switch is not pressed and will produce logic V when pressed a setup known as Active
Low
Now you will need to update your code to accommodate this switch presses ie if the LED color is
changing with proper timing as shown above when no switch is pressed, but if a switch is pressed
with corresponding LED in Green, the corresponding street LED needs to change to Amber followed
by Red, while the adjacent street LED needs to change to Green when other street light becomes Red.
The sequence will follow thereafter normally according to the timing diagram above.
In the assignment report, provide the followings:
a Briefly summarize the work including your objective, procedure, and key results. secRED secGREEN secAMBER
b Provide your code for this traffic light controller with sufficient comments to ensure the code is
understandable.
c Draw a FSM diagram such as StateChart for your code.
d Explain how you implemented the pedestrian switch to respond when pressed? Was it
instantaneous? What is the bestcase delay and worstcase delay from the time when the switch
was pressed and the time when the Amber yellow LED turned on Can this be improved? How?
e Provide snapshots confirming successful download of the code from computer to Arduino board.
f Provide a few pictures as evidence of successful prototyping of the hardware and operation of the
code with various combination of LEDs ONOFF
g Did you encounter any technical challenge? How did you resolve it
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started