กลับไปหน้ารวมไฟล์
traffic-lights-using-7-segment-display-cb0593-en.md

Visit my blog for more information

https://www.electronicsisfun08.in/2022/12/how-to-make-traffic-lights-using-7.html

In this video I made Traffic Lights using Arduino and 7 segment display.

I used one 7 segment display to count the time from 9 seconds to 0 seconds.

This is a very good and average project which can be made by school students or engineering students to show it to their school or college.

You can easily make this project.

This is very interesting, you can edit it or you can use 2 displays to make it count more.

If you like this project respect it.

Give me suggestions so I can improve it or any feedback you want to give to my YouTube channel.

link is : https://studio.youtube.com/channel/UCaXI2PcsTlH5g0et67kdD6g

Also you can give me suggestions on "What I made next project.?"

Urban Infrastructure: 7-Segment Traffic System

Blinking three LEDs (Red, Yellow, Green) is day one of learning Arduino. The 7-Segment Traffic Lights scales this idea into a full four-way intersection model. It introduces the critical engineering concepts of "Cross-Traffic States," asynchronous pedestrian button interrupts, and real-time numerical countdowns on massive multiplexed displays.

State-Machine Cross Logic

A four-way intersection requires two sets of traffic lights (North/South and East/West).

  1. The Fatal Flaw: If you use delay(), and both lights accidentally turn Green simultaneously, you caused a catastrophic digital car crash!
  2. The State Lock: You define rigid states. State 1: NS_Green, EW_Red State 2: NS_Yellow, EW_Red State 3: NS_Red, EW_Red (Safety buffer) State 4: NS_Red, EW_Green
  3. The switch(currentState) loop rigidly enforces that State 4 can NEVER happen until State 3 finishes, guaranteeing physical safety.

Multiplexing the TM1637 Display

When the North/South light turns Red, the pedestrians need to know how many seconds they have to cross the street.

  • You wire a TM1637 4-Digit 7-Segment Display to the project.
  • A basic for loop counts down for (int i = 15; i > 0; i--).
  • However! The Arduino must multiplex the display (flickering the numbered LEDs thousands of times a second so the human eye sees the number "15"). It must do this while simultaneously listening for the Pedestrian "Walk Request" button on Pin 2 (Interrupt).
  • If the pedestrian hits the button during State 4, the Arduino seamlessly alters the state machine, dropping the EW_Green light to Yellow instantly!

Intersection Hardware Required

  • Arduino Mega/Uno.
  • 6 LEDs (2x Red, 2x Yellow, 2x Green).
  • TM1637 4-Digit Display or massive 3-inch 7-Segment blocks for realism.
  • Arcade Push Buttons acting as the crosswalk trigger.
  • Dozens of 220-ohm resistors to manage the massive LED current draw safely.
Steps to make this project:

1. Gather components like Arduino Uno, 7 segment display, resistor 330 ohm, breadboard, leds red green and yellow, Jumper wires etc.

2. Take BreadBoard place red led, yellow led and green led.

3. Connect all leds anode ( +ve terminal ) with 330 ohm resistance.

4. Connect 7 segment display on breadboard.

5. Connect common pin of 7 segment display with 330 ohm resistance.

6. Do connections from Circuit Diagram.

7. Upload the code and then check its working.

Your project is ready...!!!

Visit my YouTube channel once and see more interesting projects.

"Electronics is Fun"

If you like my channel subscribe it please.

link: https://studio.youtube.com/channel/UCaXI2PcsTlH5g0et67kdD6g

ข้อมูล Frontmatter ดั้งเดิม

apps:
  - "1x Arduino IDE"
author: "mohammadsohail0008"
category: "Home Automation"
components:
  - "1x 5 mm LED: Green"
  - "4x Resistor 330 ohm"
  - "1x 5 mm LED: Red"
  - "1x 5 mm LED: Yellow"
  - "1x 7 Segment LED Display, InfoVue"
  - "1x Jumper wires (generic)"
  - "1x Arduino UNO"
description: "Crosswalk logic! Program a full four-way intersection simulator utilizing complex state machines, cross-timer countdowns on massive 7-segment LED blocks, and pedestrian interrupt buttons."
difficulty: "Intermediate"
documentationLinks: []
downloadableFiles:
  - "https://projects.arduinocontent.cc/46f86fd9-5a16-4e73-bd1d-44fd2a6f676e.ino"
  - "https://projects.arduinocontent.cc/46f86fd9-5a16-4e73-bd1d-44fd2a6f676e.ino"
encryptedPayload: "U2FsdGVkX185pySukzWBEIdzeM58n/yzx9xyD0JbLvFCDlziYjRmyOlpjQtWHN5/Xotn7n/P/qAupqybOb7/NRQNMQ+ee3BtGNnpHHhGePA="
heroImage: "https://cdn.jsdelivr.net/gh/bigboxthailand/arduino-assets@main/images/projects/traffic-lights-using-7-segment-display-cb0593_cover.jpg"
lang: "en"
likes: 3
passwordHash: "2e5f9d79d3e62f75a1afc851f77f3e5e42d385409a028b7f005b3a314fb9a857"
price: 299
seoDescription: "Build Traffic Lights with a traffic counter using 7 segment display and Arduino. Simple step-by-step guide for traffic control projects."
tags:
  - "lights"
  - "energy efficiency"
  - "cars"
  - "passenger vehicles"
title: "Traffic Lights using 7 segment display"
tools: []
videoLinks:
  - "https://www.youtube.com/embed/avDpOO-Ul20"
views: 29277