Industrial manufacturing
Industrial Internet of Things | Industrial materials | Equipment Maintenance and Repair | Industrial programming |
home  MfgRobots >> Industrial manufacturing >  >> Manufacturing Technology >> Manufacturing process

Build a Realistic Traffic Light Simulator with Arduino UNO

Components and supplies

Build a Realistic Traffic Light Simulator with Arduino UNO
Arduino UNO
Any kind of 'Uno" will do. I have a Geekcreit Uno that works fine.
×1
Build a Realistic Traffic Light Simulator with Arduino UNO
Breadboard (generic)
×1
Build a Realistic Traffic Light Simulator with Arduino UNO
Jumper wires (generic)
Male/Male required
×1
Build a Realistic Traffic Light Simulator with Arduino UNO
LED (generic)
You will need red, green, and blue lights
×3
Arduino USB 2.0 data Cable
×1
Build a Realistic Traffic Light Simulator with Arduino UNO
Resistor 100 ohm
Brown, Black, Brown
×1

Apps and online services

Build a Realistic Traffic Light Simulator with Arduino UNO
Arduino IDE

About this project

This simple little project uses an Arduino and some LEDs to replicate a traffic light. It uses code as an internal timer and continues to run until you cut the Arduino's power supply.

Okay. The materials are here as follows:

1. Arduino/Genuino/Geekcreit/Whatever Uno

Build a Realistic Traffic Light Simulator with Arduino UNO

2. Breadboard

Build a Realistic Traffic Light Simulator with Arduino UNO

3. Jumper Wires

Build a Realistic Traffic Light Simulator with Arduino UNO

4. Red, Yellow, and Green LED lights

Build a Realistic Traffic Light Simulator with Arduino UNO

5. Arduino USB 2.0 Cable

Build a Realistic Traffic Light Simulator with Arduino UNO

Alright. Let's begin, shall we??

Step 1: Supply power to the breadboard

Build a Realistic Traffic Light Simulator with Arduino UNO

Yes, I know that there's only one wire where there would usually be two, but trust me: Follow this exactly the way you see it. I've revised this post over and over, it's completely correct.

Insert one side of the jumper wire into GND on the board. Lead the other side to the breadboard. Put it on the far right column on the breadboard, at the top. This is the ground column. ALL the way to the right. Take a look at the picture and/or the schematics if you don't understand.

Step two: Adding the LEDs

Build a Realistic Traffic Light Simulator with Arduino UNO

Take out your LEDs and resistors. Place one end of the resistor in the column on the right, the same column we connected our jumper wire to. Extend the other end of the breadboard into the main part of the breadboard. Attach the resistor to any row you like. Our LEDs will go on the same row. We will stick one end of the LED on one side of the breadboard, and the other end on the other side of the breadboard. The short end of the LED will go on the side your resistors are on, the right side. Extend the other end of the LED to the right side of the breadboard. (If you don't put the LEDs in correctly, the project will not work.)

Step three: Completing the circuit

Build a Realistic Traffic Light Simulator with Arduino UNO

Alright. This is the last part. Take another jumper wire, put it on the same row that you have an LED on. This is where the wires will go:

Green LED: Port 2, Digital PWM section

Yellow LED, Port 3, Digital PWM section

Red LED, Port 4, Digital PWM section

If you don't understand, check the schematics are refer to the pictures.

Now, upload your code and you're finished!

(See, what did I tell ya?? It works!!)

Code

  • Arduino Traffic Light Code
Arduino Traffic Light CodeArduino
// variables
int GREEN = 2;
int YELLOW = 3;
int RED = 4;
int DELAY_GREEN = 5000;
int DELAY_YELLOW = 2000;
int DELAY_RED = 5000;


// basic functions
void setup()
{
  pinMode(GREEN, OUTPUT);
  pinMode(YELLOW, OUTPUT);
  pinMode(RED, OUTPUT);
}

void loop()
{
  green_light();
  delay(DELAY_GREEN);
  yellow_light();
  delay(DELAY_YELLOW);
  red_light();
  delay(DELAY_RED);
}

void green_light()
{
  digitalWrite(GREEN, HIGH);
  digitalWrite(YELLOW, LOW);
  digitalWrite(RED, LOW);
}

void yellow_light()
{
  digitalWrite(GREEN, LOW);
  digitalWrite(YELLOW, HIGH);
  digitalWrite(RED, LOW);
}

void red_light()
{
  digitalWrite(GREEN, LOW);
  digitalWrite(YELLOW, LOW);
  digitalWrite(RED, HIGH);
}

Schematics

Build a Realistic Traffic Light Simulator with Arduino UNO

Manufacturing process

  1. Traffic Signals: Engineering, History, and Future Innovations
  2. Smart Traffic Light: Adaptive Street Lighting Powered by IoT
  3. Build a Basic Calculator with Arduino UNO – Easy Project
  4. Build a Portable Persistence of Vision Display with Arduino UNO and ATtiny85
  5. Smartphone-Based Temperature Monitoring System with Arduino and Bluetooth
  6. Arduino Laser Tripwire Project: Build a Simple Intrusion Detector
  7. Building an Arduino LIDAR System with VL6180X and Servo Motor
  8. Gesture‑Controlled Robot Project: Build Your Own Motion‑Sensing Bot
  9. Arduino UNO Guitar Pedal: DIY, Open‑Source, Beginner‑Friendly
  10. Arduino-Based Altair 8800 Simulator Kit – Build & Program Retro Computer