IOT Exp 3
IOT Exp 3
IOT Exp 3
Experiment 3
Student Name: Zatch UID:
Branch: CSE Section/Group:
Semester: 5th Date of Performance:
Subject Name: IOT Subject Code: 22CSP-329
1. Aim: To Develop a smart traffic light management system with the help of
IOT.
2. Objective:
1. Learn about interfacing.
2. Learn about IoT programming
3. Input/Equipment Used:
1 × Breadboard
1 × Arduino Uno R3
3 × LEDs (Red, Yellow, Green)
3 × 220Ω Resistor
3 × Jumper
4. Theory:
Nowadays, everyone prefers a personal vehicle. Hence, the number of
vehicles on the road is increasing continuously, which results in traffic
jams. Traffic light controller helps to manage the traffic and to maintain
proper traffic management. These systems are placed at the intersections of
the road or at the crossings to avoid congestions and accidents. The systems
indicate to the driver by using different colors of light. Therefore it is simple
to avoid congestion at the intersections.
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
5. Procedure:
• Place Arduino Uno on the breadboard.
• Connect LEDs (Red, Yellow, Green) to digital pins of Arduino via
resistors
• Open Arduino IDE and start a new sketch
• Write code to initialize pins for LEDs and sensors, and define traffic
light control logic based on sensor inputs
• Connect Arduino Uno to your computer via USB cable
• Compile and upload the code to the Arduino board using Arduino IDE
• Observe the behavior of LEDs (simulating traffic lights) based on sensor
inputs or predefined timings
• Verify all wires and components are securely connected
Connections:
• This is the circuit diagram for the traffic light controller by using
Arduino.
• Connect LEDs on the breadboard as Red, Yellow, Green, respectively.
• Connect the negative terminal of the LED and connect the 220 Ohm
resistor in series.
• Connect these negative terminals to the ground.
• Connect the positive terminal of the LEDs to the pins 2 to 10, respectively.
• Power the breadboard by using 5V and GND on the Arduino
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
6. Code:
void setup() {
// configure the output pins
pinMode(2,OUTPUT);
pinMode(3,OUTPUT);
pinMode(4,OUTPUT);
pinMode(5,OUTPUT);
pinMode(6,OUTPUT);
pinMode(7,OUTPUT);
pinMode(8,OUTPUT);
pinMode(9,OUTPUT);
pinMode(10,OUTPUT);
} void loop()
{
digitalWrite(2,1); //enables the 1st set of signals
digitalWrite(7,1);
digitalWrite(10,1);
digitalWrite(4,0);
digitalWrite(3,0);
digitalWrite(6,0);
digitalWrite(8,0);
digitalWrite(9,0);
digitalWrite(5,0);
delay(5000);
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
digitalWrite(3,0);
digitalWrite(5,0);
digitalWrite(6,0);
digitalWrite(9,0);
digitalWrite(10,0);
delay(5000);
digitalWrite(9,1); //enables the yellow lights
digitalWrite(3,1);
digitalWrite(7,0);
digitalWrite(8,0);
digitalWrite(4,0);
delay(1000);
}
7. Result:
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
8. Conclusions:
You should see your LEDs turn on and off. If the required output is not
seen, make sure you have assembled the circuit correctly and verified and
uploaded the code to your board. This traffic light controller includes a
crosswalk signaling system. The traffic light controller in this system can
be implemented practically and expanded further.