Project tutorial
USE a BUZZER MODULE (PIEZO SPEAKER) USING ARDUINO UNO

USE a BUZZER MODULE (PIEZO SPEAKER) USING ARDUINO UNO © Apache-2.0

THIS PROJECT IS BASED on THE ALARMS AND BEEPS USING BUZZERS FOR SECURITY

  • 71,799 views
  • 0 comments
  • 8 respects

Components and supplies

Apps and online services

About this project

In this tutorial you will learn how to use a buzzer or piezo speaker with Arduino. Buzzers can be found in alarm devices, computers, timers and confirmation of user input such as a mouse click or keystroke.

You will also learn how to use tone() and noTone() function.

So, let's get started!

Step 1: What You Will Need

For this tutorial you will need:

  • Arduino uno
  • Breadboard
  • Buzzer / piezo speaker
  • 100 Ohm resistor (optional)

Step 2: The Circuit

The connections are pretty easy, see the image above with breadboard circuit schematic.

Step 3: The Code

Here's the "Tone" code, embedded using codebender!

How it works? It's simple, tone(buzzer, 1000) sends a 1KHz sound signal to pin 9, delay(1000) pause the program for one second and noTone(buzzer) stops the signal sound. The loop() routine will make this run again and again making a short beeping sound.

(you can also use tone(pin, frequency, duration) function)

Play with the project now by changing the code. For example, try to change sound signal "1000" (1KHz) to "500" (500Hz) or delay time and see how it changes the program.

Step 4: Well Done!

You have successfully completed one more Arduino tutorial and you learned how to use:

  • buzzer / piezo speaker
  • tone(), noTone() functions

I hope you liked this, let me know in the comments.

There will be more of them, so make sure to click Follow button!

Code

BUZZER AND ITS USESArduino
const int buzzer = 9; //buzzer to arduino pin 9


void setup(){
 
  pinMode(buzzer, OUTPUT); // Set buzzer - pin 9 as an output

}

void loop(){
 
  tone(buzzer, 1000); // Send 1KHz sound signal...
  delay(1000);        // ...for 1 sec
  noTone(buzzer);     // Stop sound...
  delay(1000);        // ...for 1sec
  
}

Custom parts and enclosures

CONNECTIONS
11 mkc8ndtchb

Schematics

CONNECTIONS
11 6wspfz8r6q

Comments

Similar projects you might like

Control Arduino Uno Using ESP8266 WiFi Module and Blynk App

Project tutorial by Adithya TG

  • 43,749 views
  • 13 comments
  • 44 respects

Android App-Based Home Automation System Using IOT

Project tutorial by Team Autoshack

  • 46,120 views
  • 22 comments
  • 132 respects

Ultrasonic Security System

Project tutorial by Ivan

  • 38,794 views
  • 27 comments
  • 86 respects

Buzzer Alarm System With Help Of Arduino

by Team ONYX

  • 59,416 views
  • 10 comments
  • 38 respects

Using the RAK811 LoRa module with Arduino

Project tutorial by Naresh krish

  • 13,591 views
  • 5 comments
  • 13 respects

Morse Code Communication Using Laser Module (Both)

Project tutorial by SURYATEJA

  • 2,452 views
  • 1 comment
  • 13 respects
Add projectSign up / Login