• Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
  • Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
HomeArduinoHow To Use A Piezo To Produce Tone : Basics
Previous Next

How To Use A Piezo To Produce Tone : Basics

Posted by: Olva , September 6, 2016

Picture of How To Use A Piezo To Produce Tone : Basics

Hello everyone, In this instructable, We will be using a Piezo buzzer to produce tone.

What is a Piezo buzzer?

  • A Piezo is a electronic device that can be used both to produce as well as detect sound.

Applications:

  • You can use the same circuit to play a musical note by switching the Piezo on and off several times.
  • The experience can be further improved by changing the loudness of the Buzzer using Arduino PWM pins.

We will be starting from basics and will produce a simple Beeping tone using Piezo.

Step 1: Gather the parts

Picture of Gather the parts

For this project we will need:

  1. An Arduino UNO
  2. A 5V Piezo Buzzer
  3. Jumper wires

Don’t we need a resistor to limit the current through the buzzer?

No, if you are using a small 5V Piezo.

As it derives or uses very small amount of current so can be used without a resistor in series.

Step 2: Wiring

Picture of Wiring
Wiring 02.JPG
Wiring 03.png
Wiring 04.png

Hookup all the components according to the circuit shown above.

Polarity of the buzzer:

Before connecting the Piezo to Arduino, note that a Piezo buzzer has polarity.

  1. The positive lead of the Piezo has Red wire.
  2. But, If you have got a Breadboard mountable Piezo then the Positive terminal of the Piezo has a longer lead than negative terminal.

Step 3: Arduino sketch

Picture of Arduino sketch
Once you have wired up everything, Upload the following to Arduino:
void setup()  { 

  pinMode(9, OUTPUT);        // declare pin 9 to be an output:
}

void loop(){

analogWrite(9, 20);       // Any value can be used except 0 and 255

delay(300);                   // wait for 3 ms

analogWrite(9, 0);         // turns it off

delay(300);                   // wait for 3 ms

}

 

Share!
Tweet

Olva

About the author

Leave a Reply Cancel reply

You must be logged in to post a comment.

Category

  • Home
  • pcDuino
  • WiKi
  • Store
  • Distributors