Skip to content

Releases: RezaGooner/Traffic-Light-with-Counter

Traffic Light

09 Mar 20:53
b7c0398
Compare
Choose a tag to compare

🚦 Traffic Light with Counter - Release Version

This is the official release of the Traffic Light with Counter project using the ATmega32 microcontroller. This release provides a fully functional traffic light system with adjustable timing, a police mode, and an off mode.


🔥 What's New in This Release?

Fully Functional Traffic Light System
Adjustable Red and Green Light Durations
7-Segment Display Shows Remaining Time
Police Mode with Blinking Red Light and "PO" Display
Power-Off Mode to Turn Off LEDs and Display
Optimized Code for Stability and Performance


📥 Download & Install

1️⃣ Download the Release Files

Get the latest release from the Releases section:
👉 Latest Release

You will find:

  • HEX file: Ready to upload to your ATmega32.
  • Proteus Simulation File: Run and test the circuit in Proteus.
  • Source Code: Modify or enhance the functionality.

2️⃣ Flash the HEX File to ATmega32

To upload the firmware, follow these steps:

  1. Connect your ATmega32 to a USBasp programmer.
  2. Use AVRDude or Atmel Studio to upload the HEX file.
    avrdude -c usbasp -p m32 -U flash:w:traffic_light.hex:i
  1. Power the circuit with 5V and test the system.

🎮 How to Use

1️⃣ Normal Mode

Press the Normal button (PB0). The traffic lights cycle normally:
🔴 Red → 🟢 Green → 🟡 Yellow
The remaining time for each light is displayed on the 7-segment display.

2️⃣ Adjusting Red Light Duration

  1. Press Set Red (PB1) to enter red time adjustment mode.
    • The red LED turns on, and the current red light duration is shown on the 7-segment display.
  2. Use Time+ (PB5) to increase the red light duration.
  3. Use Time- (PB6) to decrease the red light duration.
  4. To save changes, press any other mode button.

3️⃣ Adjusting Green Light Duration

  1. Press Set Green (PB2) to enter green time adjustment mode.
    • The green LED turns on, and the current green light duration is shown on the 7-segment display.
  2. Use Time+ (PB5) to increase the green light duration.
  3. Use Time- (PB6) to decrease the green light duration.
  4. To save changes, press any other mode button.

4️⃣ Police Mode

Press the Police button (PB3).

  • The red LED blinks continuously.
  • "PO" is displayed on the 7-segment display.

5️⃣ Off Mode

Press the Off button (PB4).

  • All LEDs and the 7-segment display turn off.

🛠️ Hardware Requirements

Component ATmega32 Pin
Green LED PA0
Yellow LED PA1
Red LED PA2
7-Segment (Left - Tens Place) PORTD (PD0 - PD6)
7-Segment (Right - Ones Place) PORTC (PC0 - PC6)
Normal Mode Button PB0
Set Red Time Button PB1
Set Green Time Button PB2
Police Mode Button PB3
Off Button PB4
Increase Time (Time+) PB5
Decrease Time (Time-) PB6

🔧 Contributors:
@RezaGooner
@Hamed-Gharghi