Piezo Disc

From ElectroDragon Wiki



The buzzer works based on the principle of piezoelectric effect. When an alternating voltage is applied to it, it will produce mechanical vibration;
Conversely, it generates a voltage signal when a mechanical force is applied to it.
Therefore, the piezoelectric ceramic buzzer can be used as a vibration sensor.
The voltage signal generated by the piezoelectric ceramic buzzer when it is mechanically applied is very weak. Generally, it should be connected to a voltage amplifier as a vibration sensor.

Use as input by vibration

Demo Code

void setup()
Serial.begin(9600); //Open the serial to set the baud rate for 9600bps
void loop()
int val;
val=analogRead(0); //Connect the analog piezoelectric ceramic vibration sensor to analog interface 0
Serial.print("Vibration is ");
Serial.println(val,DEC);//Print the analog value read via serial port

Use as a buzzer