0% found this document useful (0 votes)
18 views6 pages

Lesson 5 Passive Buzzer

Uploaded by

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

Lesson 5 Passive Buzzer

Uploaded by

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

Lesson 5 Passive Buzzer

Introduction

In this lesson, you will learn how to use a passive buzzer to generate eight
different sounds, each sound lasting 1 seconds: from Alto Do (262Hz), Re
(294Hz), Mi (330Hz), Fa (349Hz), So (392Hz), La (440Hz), Si (494Hz) to
Treble Do (524Hz).

Hardware Required

 1 * RexQualis UNO R3

 1 * Breadboard

 1 * Passive buzzer

 2 * M-M Jumper Wires

Principle

Passive Buzzer

a passive buzzer does not have such a source, so it will not beep if DC signals
are used; instead, you need to use square waves whose frequency is between
2K and 5K to drive it. The active buzzer is often more expensive than the
passive one because of multiple built-in oscillating circuits.

Code interpretation

//The purpose of the experiment is to generate eight different


sounds, each sound lasting 1 seconds: from Alto Do (262Hz),
Re (294Hz), Mi (330Hz), Fa (349Hz), So (392Hz), La (440Hz),
Si (494Hz) to Treble Do (524Hz)//
int Do = 262, Re = 294 , Mi = 330 , Fa = 349 , Sol = 392 ,

La = 440 , Si = 494, Do2 = 524;

int buzz = 12; //Not necessarily a PWM pin, any digital pin will
work!!!

int wait = 0;

void setup()

pinMode(buzz, OUTPUT);//initialize the buzzer pin as an output

void loop()

wait = 500;

tone(buzz, Do, wait);

delay(1000);//wait for 1s

tone(buzz, Re, wait);

delay(1000);//wait for 1s

tone(buzz, Mi, wait);

delay(1000);//wait for 1s

tone(buzz, Fa, wait);

delay(1000);//wait for 1s

tone(buzz, Sol, wait);


delay(1000);//wait for 1s

tone(buzz, La, wait);

delay(1000);//wait for 1s

tone(buzz, Si, wait);

delay(1000);//wait for 1s

tone(buzz, Do2, wait);

delay(1000);//wait for 1s

noTone(buzz);

Experimental Procedures

Step 1:Build the circuit

Schematic Diagram
Step 2: Open the code:Passive_buzzer_Code
Step 3: Attach Arduino UNO R3 board to your computer via
USB cable and check that the 'Board Type' and 'Serial Port' are
set correctly.

Step 4: Upload the code to the RexQualis UNO R3 board.

Now, Listen carefully, You can hear the passive buzzer


sounding Alto Do, Re, Mi, Fa, So, La, Si, Treble Do.
If it isn’t working, make sure you have assembled the circuit
correctly, verified and uploaded the code to your board. For
how to upload the code and install the library, check Lesson 0
Preface.

You might also like