Introduction
The KY-002 Vibration Switch Module detects knocking and shaking. When the module is pushed, then the spring mechanism will close the circuit transmitting a short high signal. Which means activating the circuit
It can be interfacing with a variety of microcontrollers like Arduino, ESP32, Raspberry Pi, and others microcontrollers.
Hardware Required
You will require the following Hardware Components for the Interfacing of the KY-002 Vibration Switch Module.
Components | # | Buy From Amazon |
---|---|---|
Arduino UNO | 1 | Buy Link |
KY-002 Vibration Switch Module | 1 | Buy Link |
LED ( Red ) | 1 | Buy Now |
Jumper Wires | – | Buy Link |
Breadboard | 1 | Buy Link |
Specifications
This module contains a 10k resistor, a conductive spring, and 3 male header pins. Shaking or Knocking the module will result in the spring to shortly close the circuit.
Operating Voltage | 5V |
Board Dimensions | 18.5mm x 15mm [0.728in x 0.591in] |
Pinout
Pin Configuration
Pin Name | Pin Type |
---|---|
S | Signal Pin |
middle pin | Vcc (+5) |
( – ) | Ground |
Circuit Diagram
The following circuit shows you the connection of the KY-002 Vibration Switch Module with Arduino Please make the connection carefully according to the circuit diagram
Circuit Connections
Place the module on the Breadboard and connect the signal pin (S) of the module to pin 3 of the Arduino. then link the power pin (middle) and ground (-) of the module to +5V and GND of the Arduino respectively.
Arduino | KY-002 Module | Red LED |
---|---|---|
+5v | Middle | |
GND | GND | LED -Ve |
Pin 3 | Signal | |
Pin 13 | LED +Ve |
Installing Arduino IDE Software
First, you will require to Download the updated version of Arduino IDE Software and Install it on your PC or laptop. if you Learn How to install the Arduino step-by-step guide then click on how to install Arduino Button given Blow
Code
The following Arduino code creates a shock flasher. The LED on Arduino pin 13 will blink when the KY-002 is shaken or knocked. and Pin 3 obtains the signal from the module.
int Led = 13; // define the LED Pin
int shock = 3 // define the sensor Pin
int val; // define a numeric variable val
void setup () {
pinMode (Led, OUTPUT); // LED pin as output
pinMode (shock, INPUT); // input from KY-002 sensor
}
void loop () {
val = digitalRead (shock); // read the value from KY-002
if (val == HIGH ) {// when sensor detects shock, LED flashes
digitalWrite(Led, LOW);
} else {
digitalWrite (Led, HIGH);
}
}
Downloads Files
- KY-002 Vibration Switch Module Fritzing Part:
- KY-002 Vibration Switch Module Datasheet:
Applications
- Vibration Sensing
- Impact Sensing
- Trigger for Fall state