Objective
This experiment shows how to measure vibration using a vibration sensor, which detects changes in the environment caused by vibrations.
Required Components
- Vibration Sensor
- Arduino Board (e.g., Arduino Uno)
- Jumper wires
- Breadboard
- Arduino IDE (for programming)
Working Principle
The vibration sensor consists of a piezoelectric element that generates an electrical signal when it detects vibration. The signal can be read and processed by the Arduino.
Circuit Diagram

Follow these steps to wire the vibration sensor:
- Connect the VCC pin of the sensor to the 5V pin on the Arduino.
- Connect the GND pin of the sensor to the GND pin on the Arduino.
- Connect the signal pin of the sensor to digital pin 2 on the Arduino.
Arduino Code
/*
* Vibration Measurement with Vibration Sensor
* This code reads the vibration sensor output and displays it on the serial monitor
*/
const int vibrationPin = 2; // Vibration sensor connected to digital pin 2
int vibrationState = 0;
void setup() {
Serial.begin(9600); // Initialize serial communication
pinMode(vibrationPin, INPUT); // Set the vibration sensor pin as input
}
void loop() {
// Read the vibration state (HIGH or LOW)
vibrationState = digitalRead(vibrationPin);
// Print the vibration state to the serial monitor
if (vibrationState == HIGH) {
Serial.println("Vibration Detected!");
} else {
Serial.println("No Vibration.");
}
delay(500); // Wait for 0.5 seconds
}
Results
Once the code is uploaded, the serial monitor will display "Vibration Detected!" when the sensor detects any vibrations, or "No Vibration" when the sensor is idle.
Applications
- Earthquake detection systems
- Alarm systems for detecting unauthorized access
- Condition monitoring in machinery
Conclusion
The vibration sensor is an effective tool for detecting vibrations, with applications in earthquake detection, security systems, and machinery monitoring.