A Piezo Speaker is an electronic device that produces sound by converting electrical signals into mechanical vibrations using a piezoelectric material. These speakers are widely used in various applications due to their small size, low power consumption, and ability to produce a wide range of frequencies. Common applications include:
Parameter | Value |
---|---|
Operating Voltage | 3V to 12V |
Current Consumption | 5mA to 30mA |
Sound Output | 70dB to 100dB at 10cm |
Resonant Frequency | 2kHz to 4kHz |
Dimensions | Varies (commonly 20mm x 10mm) |
Pin Number | Pin Name | Description |
---|---|---|
1 | VCC | Positive voltage supply (3V to 12V) |
2 | GND | Ground |
// Define the pin connected to the Piezo Speaker
const int piezoPin = 8;
void setup() {
// Initialize the piezo pin as an output
pinMode(piezoPin, OUTPUT);
}
void loop() {
// Generate a 1kHz tone for 500 milliseconds
tone(piezoPin, 1000, 500);
delay(1000); // Wait for 1 second
// Generate a 2kHz tone for 500 milliseconds
tone(piezoPin, 2000, 500);
delay(1000); // Wait for 1 second
}
No Sound Output:
Distorted Sound:
Low Volume:
Q1: Can I use a Piezo Speaker with a microcontroller other than Arduino?
Q2: How can I change the pitch of the sound produced by the Piezo Speaker?
Q3: Can I use a Piezo Speaker for playing music?
This documentation provides a comprehensive guide to understanding, using, and troubleshooting a Piezo Speaker. Whether you are a beginner or an experienced user, this information will help you effectively integrate a Piezo Speaker into your electronic projects.