0% found this document useful (0 votes)
31 views4 pages

Assignment 2

The document discusses an Arduino assignment to interface an LED and piezo buzzer. It includes the objectives, requirements, theory on using functions like tone(), digitalWrite(), and delay(). The circuit diagram and code are provided to blink the LED when the buzzer sounds and turn it off when silent over 1 second intervals.

Uploaded by

Samkit Kothari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views4 pages

Assignment 2

The document discusses an Arduino assignment to interface an LED and piezo buzzer. It includes the objectives, requirements, theory on using functions like tone(), digitalWrite(), and delay(). The circuit diagram and code are provided to blink the LED when the buzzer sounds and turn it off when silent over 1 second intervals.

Uploaded by

Samkit Kothari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Department of Computer Engineering Subject: Laboratory Practice

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.

SNJB’s Late Sau. K B Jain College of Engineering, Chandwad Dist. Nashik, MS


Department of Computer Engineering Subject: Laboratory Practice
IV

 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

Fig. Connections of LED & Buzzer with Arduino UNO


2.6.2 Source Code
int buzzer = 8; //Connecting Buzzer Vcc Pin to Pin 8 on Arduino UNO
int led=9; //Connecting LED Vcc Pin to Pin 9 on Arduino UNO
void setup () {
pinMode (led, OUTPUT); //Setting Up Pin 9 for LED OUTPUT
}
void loop () {
tone(buzzer,1000); //Tone Function produces sound of 1Khz frequency on Buzzer
digitalWrite (led, HIGH); //LED Turned on
delay (1000); //Giving delay of 1 second
noTone(buzzer); //noTone function turns the Buzzer off
digitalWrite (led, LOW); //LED Turned off
delay (1000); //Giving delay of 1 second
}

SNJB’s Late Sau. K B Jain College of Engineering, Chandwad Dist. Nashik, MS


Department of Computer Engineering Subject: Laboratory Practice
IV

2.6.3 Output

Fig. LED & Buzzer Off

Fig. LED & Buzzer On

SNJB’s Late Sau. K B Jain College of Engineering, Chandwad Dist. Nashik, MS


Department of Computer Engineering Subject: Laboratory Practice
IV

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.9 Assignments Questions:

1. Exaplain terms tone, notonr,digitalwrite.

2. Write and explain CODE with comment : LED BLINKING AND SOUND SENSOR.

SNJB’s Late Sau. K B Jain College of Engineering, Chandwad Dist. Nashik, MS

You might also like