Traffic Light Controller

Manju S
2 min readApr 14, 2021

--

Aim : To design a simple traffic light controller.

Design Tool : Tinkercad.

Abstract: The use of personal vehicles is very common now a days and a result, the number of vehicles on the roads are exponentially increasing. Roads without any supervision or guidance can lead in to traffic congestions and accidents. Traffic Lights or Traffic Signals are signalling devices that are used to control the flow of traffic. Here traffic lights are fully controlled by providing inputs through arduino.

Components Used:

  1. Arduino Uno R3
  2. 100Ω Resistor (3 no’s)
  3. LED (3 no’s i.e., Red, Yellow and Green)

Working:

  1. When the user provides input as ‘r’ or ‘R’ red color led is turned ON.
  2. When the user provides input as ‘y’ or ‘Y’ yellow color led is turned ON.
  3. When the user provides input as ‘g’ or ‘G’ green color led is turned ON.
  4. When the user provides input as ‘a’ or ‘A’ all LEDs are turned ON with some delay.
  5. When the user provides input as ‘q’ or ‘Q’ the led traffic controller will be turned OFF.

NOTE: The inputs should be provided in serial monitor.

Circuit:

Code:

char s;
void setup()
{
pinMode(13, OUTPUT);
pinMode(12, OUTPUT);
pinMode(11, OUTPUT);
Serial.begin(9600);
}

void loop()
{
if(Serial.available())
{
s = Serial.read();
}
if (s == ‘r’ || s ==’R’)
{
digitalWrite(13,1);
digitalWrite(12,0);
digitalWrite(11,0);
}
if (s == ‘y’ || s == ‘Y’)
{
digitalWrite(13,0);
digitalWrite(12,1);
digitalWrite(11,0);
}
if(s == ‘g’ || s == ‘G’)
{
digitalWrite(13,0);
digitalWrite(12,0);
digitalWrite(11,1);
}
if (s == ‘q’ || s == ‘Q’)
{
digitalWrite(13,0);
digitalWrite(12,0);
digitalWrite(11,0);
}
if (s == ‘a’ || s == ‘A’)
{
digitalWrite(13,1);
digitalWrite(12,0);
digitalWrite(11,0);
delay(1000);
digitalWrite(13,0);
digitalWrite(12,1);
digitalWrite(11,0);
delay(1000);
digitalWrite(13,0);
digitalWrite(12,0);
digitalWrite(11,1);
delay(1000);
}
}

Link: https://www.tinkercad.com/things/bZkjrw5lE2o-a-small-traffic-lighting-control

Conclusion:

The main purpose is to design a simple traffic light controller.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Manju S
Manju S

No responses yet

Write a response