In this lab, you will design and build a traffic control scheme that uses a finite state machine and ultrasonic sensors to manage traffic at a busy T intersection.
New for this lab are callouts with lecture or textbook sections for each exercise.
<aside> 📖 Example textbook callout
</aside>
Resistors needed to pair with the LEDs will be available in Singer 246.
The T intersection appears as shown in the image below. Cars entering the intersection from the bottom (car in blue) may only make a right hand turn onto the street. Cars on the busier road (cars in red) can only go straight, either to the left or the right depending on the lane.
Image source (cars), Image source (stoplights).
Your traffic control scheme should monitor traffic flowing to the right and traffic flowing from the bottom and use this information to control two stoplights: one stoplight controls the blue traffic, and the other controls the red traffic.
The control scheme should work as follows:
Scenario | Red Lane Behavior | Blue Lane Behavior |
---|---|---|
Red cars detected, no blue cars detected | Green light | Red light |
Blue cars detected, no red cars detected | Red light | Green light |
Both types of cars detected | On for two minutes, off for one minute | Off for two minutes, on for one minute |
No cars detected | Green light | Red light |
For safety reasons, the following conditions should also be met: