The KY-002 module is a Vibration Switch that allows you to use a microcontroller like Arduino, ESP32, and Raspberry Pi to detect impacts, shaking and knocking. It has a spring mechanism that senses the vibration and momentarily closes the circuit by the spring which sends a small high signal.
Here, you will get detailed information about this vibration switch module circuit board, like specifications, pinout, circuit & connection diagram, and how to interface with Arduino.
KY-002 Module Specifications
- Type: Capacitive Vibration Sensor
- Operating Voltage: 1.5V to 12V
- Max current: 10mA
- Board Dimantions: 18.5mm x 15mm
KY-002 Module Pinout
The module has 3 male header pins those are -
- Pin (S): Signal
- Pin (Middle): +5V
- Pin (-): GND
KY-002 Module Circuit Diagram
Schematic of the ky-002 vibration switch module circuit is shown below.
KY-002 Module Interfacing with Arduino
Connection diagram of the KY-002 vibration switch module with an Arduino is shown below.
Connect the power pin (middle) and ground pin (-) of the ky-002 module to +5V and GND on the Arduino, respectively. The module signal pin (s) connect to digital pin 3 on the Arduino.
Arduino Source Code
The following Arduino sketch for KY-002 Vibration Switch Module.
Set the LED on Arduino pin 13 as the output and the sensor pin of the module as the input. Using this interface produces a shock flasher. The LED will flash when the ky-001 module is detected knocked or shaked.
int Led = 13; // Define LED on Arduino interface
int vibration = 3; // Define the KY-002 module interface
int val; // Define a numeric (boolean) variable val
void setup ()
{
pinMode (Led, OUTPUT) ; // Define Arduino LED as output interface
pinMode (vibration, INPUT) ; // Input interface defines KY-002 module
}
// Start the main program loop
void loop ()
{
val = digitalRead (vibration) ; // Read the value from KY-002 module
if (val == HIGH) // When the KY-002 vibration switch module detects a signal, LED flashes
{
digitalWrite (Led, LOW);
Serial.print(val);
}
else
{
digitalWrite (Led, HIGH);
Serial.print(val);
}
}
No comments
If you have any doubts or questions, please let me know. Don't add links as it goes to spam. Share your valuable feedback. Thanks