Home Top Ad

KY-002 Vibration Switch Module Circuit Working Explanation

Share:

The KY-002 module uses a spring mechanism that senses vibrations and momentarily closes the circuit, sending a digital low signal to a microcontroller such as an Arduino, ESP32, or Raspberry Pi to detect impacts, shaking, and knocking.

KY-002 Vibration Switch Module Specifications

The quick specifications of the KY-002 vibration switch module are given below:

  • Chipset: SW-520D Vibration Switch
  • Operating Voltage: DC +3.3V to +5V
  • Operating Current Max: 10mA
  • Board Dimensions (L x W x H): 18 X 15 x 5 mm
  • PCB Color: Black
  • Weight: 2gm

Pinout of KY-002 Vibration Switch Module

Pinout of KY-002 vibration switch module
The module has 3 male header pins those are -
  1. Pin (S): Digital Signal
  2. Pin (Middle): DC +3.3V to +5V
  3. Pin (-): Ground

Working Explanation of KY-002 Vibration Switch Module Circuit

Schematic of the ky-001 temperature sensor 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