0% found this document useful (0 votes)
146 views

Lab Report Stand NO 08 (Trafic Signal by Arduino)

The document describes an Arduino traffic light coding project. It explains that Arduino can read inputs and turn them into outputs. It then discusses analog and digital technology. It provides the code for an Arduino traffic light that rotates between green, yellow, and red lights, and includes a pedestrian crossing light. It concludes that the Arduino traffic light project demonstrates a real-world application and is useful for learning microcontrollers.

Uploaded by

moin hasan
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
146 views

Lab Report Stand NO 08 (Trafic Signal by Arduino)

The document describes an Arduino traffic light coding project. It explains that Arduino can read inputs and turn them into outputs. It then discusses analog and digital technology. It provides the code for an Arduino traffic light that rotates between green, yellow, and red lights, and includes a pedestrian crossing light. It concludes that the Arduino traffic light project demonstrates a real-world application and is useful for learning microcontrollers.

Uploaded by

moin hasan
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Wyższa Szkoła Bankowa

Kierunek:
w Poznaniu
Engineering Management

Course: Laboratory of Engineering Science Group:

Name and Surname:

Subject: Arduino( Trafic Signal Coding) Syed Moinul HASAN

Stand NO: 08 Data:

General information:
 Arduino:
Arduino is an open-source electronics platform based on easy-to-use hardware and
software. Arduino boards are able to read inputs - light on a sensor, a finger on a button, or
reading a message - and turn it into an output - activating a motor, turning on an LED, publishing
something online.

 Analog Technology:
In analog technology, a wave is recorded or used in its original form. So, for example, in
an analog tape recorder, a signal is taken straight from the microphone and laid onto tape. The
wave from the microphone is an analog wave, and therefore the wave on the tape is analog as
well. That wave on the tape can be read, amplified and sent to a speaker to produce the sound.

 Digital Technology:
In digital technology, the analog wave is sampled at some interval, and then turned
into numbers that are stored in the digital device. On a CD, the sampling rate is 44,000 samples
per second. So on a CD, there are 44,000 numbers stored per second of music. To hear the
music, the numbers are turned into a voltage wave that approximates the original wave.

 Arduino Traffic Light:


One of the very famous projects to start work with Arduino is to make the traffic light
project. It’s an incredibly simple project but it teaches us some of the most relevant fundamentals
of the Arduino. We made the Arduino traffic light project in this tutorial, step by step in a
simple to understand way. It’s a great way to introduce us to electronics, programming, and
micro-controllers.

The wiring of the Arduino traffic light project is beyond simple. It’s partly what makes it one of
those great educational projects. Each LED will connect to a dedicated pin on the Arduino and
share a common ground. (NB: Show the video in Drive with given link bellow)

Exercise:

 Procedure:
The Change-Lights function performs all the hard work. This rotates the traffic light
through yellow and red, then back to green. As this gets called inside the loop function, the
Arduino will run this code forever, with a 30/15-second pause every time (According To Code).

The Change-Lights function consists of four distinct steps:

 Green on, yellow off


 Yellow off, red on
 Yellow on, red on
 Green on, red off, yellow off

These four steps replicate the process used in real traffic lights. For each step, the code is very
similar. The appropriate LED gets turned on or off using Digital-Write. This is an Arduino
function used to set output pins to HIGH (for on), or LOW (for off). After enabling or disabling
the required LEDs, the Delay makes the Arduino wait for a given amount of time.
Arduino Traffic Light Code:
The complete Arduino code and Video for this Arduino Traffic Light Project is given below.

const int greenlight = 13; // green light for vehicles

const int yellowlight = 12; // yellow light for vehicles

const int redlight = 11; // red light for vehicles

const int button = 8; // button for pedestrian crossing

const int greenlight2 = 4; // green pedestrian light

const int redlight2 = 5; // red pedestrian light

void setup() {

pinMode(13, OUTPUT);

pinMode(12, OUTPUT);

pinMode(11, OUTPUT);

pinMode(8, INPUT);

pinMode(4, OUTPUT);

pinMode(5, OUTPUT);

pinMode(3, OUTPUT);

void loop() {

digitalWrite(greenlight, 1);

digitalWrite(redlight2, 1);

if (digitalRead(button) == HIGH) {

delay(1);
if (digitalRead(button) == HIGH)

changeLights();

delay(0);

void changeLights() {

digitalRead(button) == LOW;

digitalWrite(greenlight, 0);

digitalWrite(yellowlight, 1);

delay(3000);

digitalWrite(yellowlight, 0);

digitalWrite(redlight, 1);

delay(3000);

digitalWrite(redlight2, 0);

digitalWrite(greenlight2, HIGH);

delay(10000);

digitalWrite(greenlight2, LOW);

delay(500);

digitalWrite(greenlight2, HIGH);

delay(500);

digitalWrite(greenlight2, LOW);

delay(500);

digitalWrite(greenlight2, HIGH);
delay(500);

digitalWrite(greenlight2, LOW);

delay(500);

digitalWrite(greenlight2, HIGH);

delay(500);

digitalWrite(greenlight2, LOW);

delay(500);

digitalWrite(greenlight2, HIGH);

delay(500);

digitalWrite(greenlight2, LOW);

delay(500);

digitalWrite(greenlight2, HIGH);

delay(300);

digitalWrite(greenlight2, LOW);

delay(300);

digitalWrite(greenlight2, HIGH);

delay(300);

digitalWrite(greenlight2, LOW);

delay(300);

digitalWrite(greenlight2, HIGH);

delay(300);

digitalWrite(greenlight2, LOW);

delay(300);

digitalWrite(greenlight2, HIGH);
delay(100);

digitalWrite(greenlight2, LOW);

delay(100);

digitalWrite(greenlight2, HIGH);

delay(100);

digitalWrite(greenlight2, LOW);

delay(100);

digitalWrite(greenlight2, HIGH);

delay(100);

digitalWrite(greenlight2, LOW);

delay(100);

digitalWrite(redlight2, 1);

digitalWrite(greenlight2, 0);

delay(3000);

digitalWrite(redlight, 1);

digitalWrite(yellowlight, 1);

delay(3000);

digitalWrite(redlight, 0);

digitalWrite(yellowlight, 0);

Video Link:
https://drive.google.com/file/d/1tViehJ-5RlmFBXelpkBhnkRk-RcOwDIS/view?usp=sharing

Conclusion:
Arduino Traffic Light Controller Project is simple and can be easily understood. It is one
of the most popular open source micro controller board which is highly useful for doing DIY
projects. Here we have demonstrated Traffic lights for the 2 ways road and the code glows
LED’s on all the two sides in a particular sequence, in which the actual Traffic Lights works.

Sources :
1. https://circuitdigest.com/microcontroller-projects/arduino-traffic-light-controller-project
2. https://pimylifeup.com/arduino-traffic-light-project/
3. https://www.makeuseof.com/tag/arduino-traffic-light-controller/

You might also like