DHA - Assignment 2
DHA - Assignment 2
AUTOMATION
ASSIGNMENT - 2
TINKERCAD
SIMULATION
NAME: JEEL ALPESHBHAI SAPKAL
ENROLLMENT NUMBER: ET24BTCL051
DIVISION: J (CIVIL ENGINEERING DEPARTMENT)
SUBJECT: TRENDS IN DIGITAL HOME AUTOMATION
SUBJECT CODE: BTEC18118
1
CONTENT
1. Single LED Blinking
2. Two LED Blinking simultaneously
3. Two LED Blinking alternately
4. LED On-Off using switch
5. LED blinking rate controlling by
potentiometer
6. LED fading
7. Two way traffic light signaling
2
1. SINGLE LED BLINKING
Description:
This project demonstrates a simple LED
blinking using an Arduino. The LED turns ON
for a specific duration and then turns OFF,
repeating the cycle continuously.
Schematic Diagram:
3
Components Required:
4
Algorithm:
1. Start
2. Set the LED pin as OUTPUT
3. Turn LED ON
4. Wait for 1 second
5. Turn LED OFF
6. Wait for 1 second
7. Repeat steps 3-6
C PROGRAM:
void setup()
{
pinMode(13, OUTPUT);
}
void loop()
{
digitalWrite(13, HIGH);
delay(1000); // Wait for 1000 millisecond(s)
digitalWrite(13, LOW);
delay(1000); // Wait for 1000 millisecond(s)
}
5
Applications:
Power Indicators – Used in home appliances,
showing power status.
Notification Alerts – Blinking LED on mobile
phones for notifications.
Heartbeat Monitoring – In medical devices to
indicate status.
Warning Lights – Used in machines when a
fault occurs.
6
2. TWO LED BLINKING
SIMULTANEOUSLY
Description:
Two LEDs blink at the same time, turning ON
and OFF together
Schematic Diagram:
7
Components Required:
8
Algorithm:
1. Start
2. Set LED pins as OUTPUT
3. Turn both LEDs ON
4. Wait 1 second
5. Turn both LEDs OFF
6. Wait 1 second
7. Repeat
C PROGRAM:
void setup() {
pinMode(5, OUTPUT);
pinMode(10, OUTPUT);
}
void loop() {
digitalWrite(5, HIGH);
digitalWrite(10, HIGH);
delay(1000);
digitalWrite(5, LOW);
digitalWrite(10, LOW);
delay(1000);
}
9
Applications:
Decorative Lighting – Synchronized blinking
in festival lights.
Emergency Signaling – Used in police and
ambulance sirens.
Aircraft Lighting – Navigation lights blinking
together for visibility.
Security Alarms – Dual blinking LEDs
indicate system activation.
10
3. TWO LED BLINKING
ALTERNATELY
Description:
Two LEDs blink alternately—when one is ON,
the other is OFF.
Schematic Diagram:
11
Components Required:
12
Algorithm:
1. Start
2. Set LED pins as OUTPUT
3. Turn LED1 ON, LED2 OFF
4. Wait 1 second
5. Turn LED1 OFF, LED2 ON
6. Wait 1 second
7. Repeat
C PROGRAM:
void setup() {
pinMode(5, OUTPUT);
pinMode(10, OUTPUT);
}
void loop() {
digitalWrite(5, HIGH);
digitalWrite(10, LOW);
delay(1000);
digitalWrite(5, LOW);
digitalWrite(10, HIGH);
delay(1000);
}
13
Applications:
Pedestrian Crossing Lights – Alternating
signals for walk/stop.
Railway Crossing Warning – Blinking
alternately to indicate approaching trains.
Bicycle Indicators – Left and right LED
indicators for turns.
Factory Alert Systems – Machine status
indicators switching between ON/OFF.
14
4. LED ON-OFF USING
SWITCH
Description:
An LED is controlled using a push button.
Pressing the button turns the LED ON, and
releasing it turns it OFF.
Schematic Diagram:
15
Components Required:
16
Algorithm:
1. Start
2. Set LED as OUTPUT and button as INPUT
3. Read button state
4. If pressed, turn LED ON
5. If not pressed, turn LED OFF
6. Repeat
C PROGRAM:
void setup() {
pinMode(9, OUTPUT); // LED
pinMode(2, INPUT); // Push button
}
void loop() {
if (digitalRead(2) == HIGH) { // If button is pressed
digitalWrite(9, HIGH); // Turn LED ON
} else {
digitalWrite(9, LOW); // Turn LED OFF
}
}
17
Applications:
Home Automation – Light switches in smart
homes.
Doorbell Indicators – LED turns ON when the
doorbell is pressed.
Machine Start/Stop Buttons – Used in
industrial machines.
Call Buttons in Elevators – Pressing a button
lights up an indicator.
18
5. LED BLINKING RATE
CONTROLLING BY
POTENTIOMETER
Description:
A potentiometer controls the blinking speed of
an LED.
Schematic Diagram:
19
Components Required:
20
Algorithm:
1. Start
2. Set LED as OUTPUT, Potentiometer as
INPUT
3. Read potentiometer value
4. Map value to delay time
5. Blink LED with mapped delay
6. Repeat
C PROGRAM:
void setup() {
pinMode(9, OUTPUT);
}
void loop() {
int potValue = analogRead(A0);
int delayTime = map(potValue, 0, 1023, 100, 1000);
digitalWrite(9, HIGH);
delay(delayTime);
digitalWrite(9, LOW);
delay(delayTime);
}
21
Applications:
Fan Speed Control – Adjusting motor speed
in appliances.
Dimmable LED Lights – Used in smart home
lighting systems.
Analog Volume Control – Adjusting sound
levels in radios/speakers.
Game Console Controllers – Used in
sensitivity adjustment for joysticks.
22
6. LED FADING
Description:
An LED gradually increases and decreases
brightness using PWM.
Schematic Diagram:
23
Components Required:
24
Algorithm:
1. Start
2. Set LED as OUTPUT
3. Gradually increase brightness
4. Gradually decrease brightness
5. Repeat
C PROGRAM:
void setup() {
pinMode(9, OUTPUT);
}
void loop() {
for (int i = 0; i <= 255; i++) {
analogWrite(9, i);
delay(10);
}
for (int i = 255; i >= 0; i--) {
analogWrite(9, i);
delay(10);
}
}
25
Applications:
Soft Dimming Streetlights – LEDs fade
instead of instant ON/OFF.
Car Dashboard Lighting – Smooth transitions
in brightness.
Breathing LED Effect in Laptops – Used in
power indicators (e.g., MacBooks).
Smartphone Notification LED – Smooth
pulsing effect for notifications.
26
7. TWO WAY TRAFFIC
LIGHT SIGNALING
Description:
Simulates a basic two-way traffic light system.
Schematic Diagram:
27
Components Required:
28
Algorithm:
1. Start
2. Green for Road A, Red for Road B
3. Yellow for Road A
4. Red for Road A, Green for Road B
5. Yellow for Road B
6. Repeat
C PROGRAM:
void setup() {
pinMode(9, OUTPUT); // Road A Green
pinMode(10, OUTPUT); // Road A Yellow
pinMode(11, OUTPUT); // Road A Red
pinMode(6, OUTPUT); // Road B Green
pinMode(7, OUTPUT); // Road B Yellow
pinMode(8, OUTPUT); // Road B Red
}
void loop() {
digitalWrite(9, HIGH);
digitalWrite(8, HIGH);
delay(5000);
digitalWrite(9, LOW);
29
digitalWrite(10, HIGH);
delay(2000);
digitalWrite(10, LOW);
digitalWrite(11, HIGH);
digitalWrite(6, HIGH);
digitalWrite(8, LOW);
delay(5000);
digitalWrite(6, LOW);
digitalWrite(7, HIGH);
delay(2000);
digitalWrite(7, LOW);
}
Applications:
Road Traffic Management – At intersections to
control vehicle flow.
Smart Traffic Lights – Automated control based
on sensors.
Railway Crossings – Lights switch between red
and green to stop traffic.
Pedestrian Crossing Signals – Used at zebra
crossings to manage walkers.
30