Lesson 9: Piezo Buzzer

Hello folks. We continue to our Arduino basics, and today on this lesson we will learn about Piezo Buzzer. This is a kind of a speaker but much simple. It has membrane with "tone()" command and "noTone()" commands. We can control its tone.
As you see on the picture Buzzer has + side and it means another side is for GND (-) ground. + side is connected to any analog outputs like ~3, ~5, ~6, ~9, ~10, ~11. Tone range for this Piezo Buzzer is between 31 and 4900. Let's make a scheme.




Here is basic connection. But I've also seen a connection with 100 Ohm resistor on + side.

Code:

void setup() {
  pinMode(3, OUTPUT);
}

void loop() {
  tone(3,500); //put tone to 500 Hz
  delay(500); //wait 1 second
  noTone(3); //stop tone
  delay(200);
}

By the way, there will be difference in tone sound for different Piezo Buzzers, even in your kit.

And at the last you may see on different melody examples on Piezo Buzzer in Internet. Here is some of them:

Super Mario music with Piezo element:
https://www.princetronics.com/supermariothemesong/

Fur Elise by Beethoven:
https://www.youtube.com/watch?v=L9eDYHjUk1k

Give students time to create their music tone. Give time to Rock it!

Comments

Popular posts from this blog

Lesson 10: Piezo Buzzer controlled with Potentiometer

Lesson 3: Working with Buttons