Assignment 2
Assignment 2
IV
Assignment No: 2
W C D V T Total Sign/Remark
(4 Marks) (4 Marks) (4 Marks) (4 Marks) (4 Marks) (20 Marks)
2.1 Title: To study & Implement a program to use on board LED blinking & buzzer sensor code
with Arduino UNO. (Apply this knowledge for Miniproject).
2.2 Pre-requisite: IOTL (Internet of Things Lab), Assignment 1’s LED Blinking logic.
2.3 Objectives:
Learn the interfacing of LED and Piezo Buzzer with Arduino UNO.
Learn to integrate the LED and Piezo Buzzer with Arduino UNO.
2.4 Outcomes:
After completion of this assignment students will be able to understand the use of LED and
Piezo Buzzer with the Arduino UNO and use of functions like tone () and noTone ().
2.5 Software & Hardware Requirements:
Operating System: Windows (XP/Vista/7/10)
Software: Arduino IDE 1.8.3
Hardware: Arduino UNO, Piezo Buzzer, LED Bar, Patch Cords, USB cable type A/B.
2.6 Theory Concept:
While development of this assignment various built-in functions are used as follows: -
pinMode (): This function takes pin no. & mode as parameter and is used to set mode for
the pin no. provided.
tone (): This function takes pin no. & frequency as parameter and is used to generate
music on piezo buzzer.
noTone (): This function takes pin no. as parameter and is used to stop generating music
on piezo buzzer.
delay (): This function takes milliseconds as parameter and is used to give delay in
execution.
digitalWrite (): This function takes pin no. & HIGH/LOW as parameters to
enable/disable the pin.
The basic idea of this assignment is to integrate the LED and piezo buzzer in such a way
that whenever the piezo buzzer is on the LED should blink & whenever the piezo buzzer is
off the LED should be off.
2.6.1 Circuit Diagram
2.6.3 Output
2.7 Applications:
Home Automation System
Gas Leakage Detection System
Smoke / Fire Detection System
Traffic Signals
Ambulance / Fire brigade vehicles
2.8 Conclusions:
We understood the use of digitalWrite () to control the blinking of LED.
We understood the use of tone () & noTone () to generate sounds of various frequencies
on the piezo buzzer.
Also, we learned how to integrate the LED and piezo buzzer with Arduino UNO.
2. Write and explain CODE with comment : LED BLINKING AND SOUND SENSOR.