Vibration Sensor Module(SW-18010P)
The SW-18010P is a vibration sensor module that can detect shocks and vibrations. It outputs digitally and does not provide an analog output.
Specifications
- Operating Voltage [V]: 3.3 ~ 5
- Output: Digital (No analog)
Example Required Hardware
- Arduino board
- Vibration Sensor Module
- Jumper cables
- LED
Connection
LED | Vibration Sensor | Arduino | |||
VCC | 5V | ||||
- | GND | GND | |||
+ | D7 | ||||
DO | D8 |
Example Code
The code turns on an LED when a vibration is detected.
int led = 7;
int sensor = 8;
void setup() {
pinMode(led, OUTPUT);
pinMode(sensor, INPUT);
digitalWrite(led, LOW);
}
void loop() {
int a = digitalRead(sensor);
if(a == LOW) digitalWrite(led, HIGH);
else digitalWrite(led, LOW);
}