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
For this project we will need:
- An Arduino UNO
- A 5V Piezo Buzzer
- 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
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.
- The positive lead of the Piezo has Red wire.
- 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
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 }
Leave a Reply
You must be logged in to post a comment.