Arduino traffic lights
This project implements a traffic light system with a countdown timer, designed using an Arduino microcontroller. It controls a sequence of traffic lights (red, yellow, and green) and a 7-segment display counter. Hereβs a detailed description:
Features:
Traffic Light Phases:
- Red Light Phase: The red light is active for 9 seconds, during which a countdown is displayed on a 7-segment display.
- Yellow Light Phase: The yellow light blinks for 2 seconds before switching to green.
- Green Light Phase: The green light is active for 9 seconds, with the countdown displayed.
Countdown Display:
- A 7-segment display shows the countdown from 9 to 0 during the red and green light phases. This is achieved using a 4511 IC, with the display driven by 4 output pins.
Components:
- Traffic Light LEDs:
- Red, yellow, and green LEDs are connected to digital pins
11,12, and13respectively. - Controlled using
digitalWriteto turn them on or off.
- Red, yellow, and green LEDs are connected to digital pins
- 7-Segment Display:
- Driven by a 4511 IC, connected to pins
4,5,6, and7. - Displays the countdown timer during the active phases of red and green lights.
- Driven by a 4511 IC, connected to pins
Workflow:
Setup Phase:
- Configures the pins for the LEDs and the 7-segment display.
- Initializes the system with the red light on and the counter set to 9.
Loop Phase:
- Executes the traffic light phases in sequence:
- Red Light Phase: Lights the red LED and counts down from 9 to 0.
- Yellow Light Phase: Blinks the yellow LED for 2 seconds.
- Green Light Phase: Lights the green LED and counts down from 9 to 0.
- Repeats the cycle continuously.
Code Highlights:
- Pin Definitions: Predefined constants improve code readability by labeling the pin numbers.
- Modular Functions:
updateCounter(int value): Updates the display based on the counter value.countdown(int startValue): Handles the countdown logic with a 1-second delay for each decrement.
- Timing Control: Uses
delay()for time intervals, providing precise timing for LED and countdown changes.
Applications:
This project can be used as:
- A simulation of a basic traffic light system for educational purposes.
- A starting point for more complex traffic management systems.
You may also like
EmbedLab Team
Embedded systems engineer and educator. Writes weekly tutorials at EmbedLab to help beginners ship real hardware.
Related projects
Arduino and shift register
Project Description This Arduino project with code is a smart parking status display system designed to monitor and show the availability of parking spots in real-time. It leverages a 74HC165 s
Arduino and Multiplexer
Hello In this article we will see how you can increase the output of the Arduino UNO board by using the 74HC4051 Multiplixer , we wil controll 8 LEDS! This Project is simulated using Proteu
Arduino UNO and EEPROM
Project Description: EEPROM SPI Communication with Arduino In this quick tutorial, we'll explore how to communicate with an EEPROM (Electrically Erasable Programmable Read-Only Memory) using SPI (Seri
Arduino buzzer + 4511 bcd + 7SEG
This Arduino code implements a countdown timer with a 7-segment display driven by a 4511 IC, a buzzer for an alarm, and an optional start/reset button. Here's a brief explanation: Components and
Arduino IR + LCD + Proteus8
Smart parking systems are innovative solutions that use sensors and microcontrollers to detect and display parking availability. This article explains how to build a basic smart parking system



