YwRobot Vibration Sensor Features
Tilt sensors detect vibrations by having small metal spheres inside. You can use the generated signal to make an alarm if there is vibration. The output of this sensor is a digital signal. This Vibration Sensor is easy to interface with Arduino and you can use it to detect vibration.
YwRobot Vibration Sensor Pinout
This sensor has 4 pins:
- 5V: Module power supply –2.4 V to 5 V
- GND: Ground
- OUT: Output
You can see pinout of this module in the image below.
Required Materials
Hardware Components
Software Apps
Interfacing YwRobot Vibration Sensor with Arduino
Step 1: Circuit
The following circuit shows how you should connect Arduino to this sensor. Connect wires accordingly.
Step 2: Code
Upload the following code to your Arduino.
/*
modified on Sep 8, 2020
Modified by MohammedDamirchi from Arduino Examples
Home
*/
// the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}
// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin 0:
int sensorValue = analogRead(A0);
// print out the value you read:
Serial.println(sensorValue);
delay(100);
}
After running the code, you will see the following image: