Introduction
In this tutorial we will show you how to use the Piezo Vibration Sensor with the Arduino UNO board. This vibration sensor loaded by a mass to offer high sensitivity at low frequencies. Useful for detecting vibration and ‘tap’ inputs from a user. Can also be used for impact sensing or a flexible switch.
So let's see how it works! |
What you will need - HardwareFor this tutorial you will need:
|
|
The Circuit
The connections are easy, see the image above with breadboard circuit schematic.
- + pin to Arduino A0 Pin
- - pin to Arduino GND
- 1MΩ resistor between them
The code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | const int PIEZO_PIN = A0; // Piezo output void setup() { Serial.begin(9600); } void loop() { // Read Piezo ADC value in, and convert it to a voltage int piezoADC = analogRead(PIEZO_PIN); float piezoV = piezoADC / 1023.0 * 5.0; Serial.println(piezoV); // Print the voltage. delay(250); } |
Download the code from here and open it with Arduino IDE.
|
|
Serial Monitor
Well done!
You have successfully completed one more Arduino "How to use the Piezo Vibration Sensor "
I hope you liked this, let me know in the comments.
I hope you liked this, let me know in the comments.