Break the Silence - Piezo Speaker!

About: I'm a highschool sophomore who is very interested in coding, robotics, drawing, dancing, video making, and photography.

Hey guys! Want to take control of a speaker? Well here you've got the perfect tutorial on how to do so! In this instructable, I will guide you through the simple steps needed to turn a buzzer on when a button is clicked an turn it back off when it is clicked again.

Step 1: Step 1: Downloading the Arduino IDE

Download and Install the Arduino IDE (Interactive Development Environment) using the link below:

https://www.arduino.cc/en/Main/Software

Choose and save the version that best suits your operating system and configuration.

Step 2: ​Step 2: Hardware Materials

  1. Arduino board
  2. 1 breadboard
  3. 2 male-male jumper wires
  4. 1 Piezo speaker

Step 3: Step 3: Building the Hardware

Add the piezo speaker to the breadboard. Connect the short leg of the piezo speaker to Ground, long leg to pin 9 with jumper wires and resistors shown in the diagram.

Step 4: Step 4: Downloading and Running the Program

Download the attached arduino program to your laptop. Connect the arduino to your laptop, and run the program. You should have a buzzing sound that goes on and off with 1 second intervals.

Step 5: Step 5: Understanding the Program

Piezo has two methods:

  • tone(piezoPinNumber, delay) which makes piezo to buzz
  • noTone(piezoPinNumber) which makes piezo to switch off

In setup method, pin 9 is declared as output.

In loop method, the tone method is called causing the piezo speaker to buzz, for 1 second. Then the noTone method is called causing the piezo speaker to turn off, for 1 second. Delay of 1 second is used to ensure the buzz doesn't turn ona nd off too quickly.

Step 6:

Share

    Recommendations

    • Beauty Tips Contest

      Beauty Tips Contest
    • Backyard Contest

      Backyard Contest
    • Sew Tough Challenge

      Sew Tough Challenge

    Discussions