KY-031 Knock Sensor Module COM54 ,R18

Fr2,000

The KY-031 Knock Sensor module is a vibration sensor that sends a signal when a knock/tap is detected. Compatible with Arduino, ESP8266, ESP32, Teensy, Raspberry Pi, and other popular platforms.

In stock

SKU: SEN17658 Category:

Description

As the name suggests the Knock Sensor Module produces the Digital output on the detection of Knock i.e. vibration stroke. Further, the change in voltage level can be manipulated to produce the desired output and can be used in a variety of applications.

SPECIFICATION

  1. Detect shocks with the spring and send a signal to Controller Board
  2. Operating voltage: 3.3V-5V
  3. Digital output
  4. Bolt holes for easy installation.

Getting started with the KY-031 Knock Sensor Module

This project uses a Knock Impact sensor (KY-031) that is connected to the Arduino Uno board. The KY-031 knock sensor is set to be the input device and detect shock in the area while the LED will be the output device to indicate the status of the sensor. Once shock has been identified it will then send a HIGH signal to the Arduino Uno board then turns the LED on.

Hardware required

  • Arduino Uno
  • KY-031 Knock Sensor Module
  • Led
  • Jumper wires

Connecting the Hardware

CODE

int ledPin = 2 ;//declares the LED @pin 2
int knockPin = 3; //declares the Knock sensor @pin 3
int value; //defines the variable value

void setup ()
{
pinMode (knockPin, INPUT) ; //sets the sensor as INPUT
pinMode (ledPin, OUTPUT) ; //sets the LED as the OUTPUT
}
void loop ()
{
value = digitalRead (knockPin) ; //value will read the status of the knock sensor
if (value == HIGH) //if it reads a HIGH value
{
digitalWrite (ledPin, HIGH); //the LED will turn on
delay(5000); //duration of 5 seconds
}
else //otherwise
{
digitalWrite (ledPin, LOW); //the LED is turned off
}
}

 

RESULTS

  • Now, knock/shock the area around the sensor, this should make the LED turn on for 5 seconds because the sensor will detect the vibration in the surrounding and the LED is indicating the sensors status.
  • Now stop knocking the area, the LED should be turned off to indicate that the sensor is not detecting any vibration in the surrounding.