Example Code for Arduino-Read Vibration Analog Value
Last revision 2026/01/15
Wiring Diagram

Sample Code
void setup()
{
Serial.begin(9600); //
}
void loop()
{
int val;
val=analogRead(0);//Connect the sensor to analog pin 0
Serial.println(val,DEC);//
delay(100);
}
Result
When no pressure is applied to the piezoelectric ceramics, the analog output is 0; when pressure is applied to the piezoelectric ceramics, the analog output will being correlated to the amount of pressure.

Was this article helpful?
