Introduction
This experiment shows how to detect vibrations using a piezoelectric sensor with Arduino.
Components Needed
- Piezoelectric Sensor
- Arduino
- Jumper Wires
Circuit Setup
- Connect the piezoelectric sensor to the analog input pin (e.g., A0) on the Arduino.
- Connect VCC and GND to the Arduino's 5V and GND pins.
The piezoelectric sensor generates a voltage signal in response to vibrations.
Code for Vibration Analysis
Upload the following code to your Arduino to detect vibrations:
const int piezoPin = A0;
int vibrationLevel = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
vibrationLevel = analogRead(piezoPin);
Serial.print("Vibration Level: ");
Serial.println(vibrationLevel);
delay(100);
}
Explanation
The piezoelectric sensor produces a voltage proportional to the vibration intensity, which is read by the Arduino and output to the Serial Monitor.
Troubleshooting
- If the readings are fluctuating, check the wiring and ensure the sensor is securely connected.
- If no vibrations are detected, try increasing the sensitivity of the sensor.