[otw_is sidebar=otw-sidebar-1]vibration sensor working ,principle ,arduino circuit, proteus ,codeIn this lesson, we will discuss about Vibration Sensor. Sometimes it is also called as Tap Sensor. In the topic, we will see what are components of a Vibration Sensor, how a Vibration Sensor works and in the end how to Interface a Vibration Sensor with Arduino.

Vibration Sensor using Arduino

A Vibration Sensor or a Tap Sensor is a simple device that traces vibrations or shocks from knocking or tapping it. It is essentially electronic switches which normally open. When it traces any shock or vibrations, it closes (for that moment and returns back to its set position).

Multiple Vibration Sensors are available in the market and the cheaper ones are known as KY-031 Vibration Sensors.

Arduino Vibration Sensor Interface:

Now we have seen the components of a Vibration sensor and how an ordinary vibration sensor works, let us begin with interfacing a vibration sensor with Arduino.

I have plot a simple circuit using Arduino, Vibration Sensor and an LED where the LED is turned on by Arduino when the vibration sensor detects any vibrations. Also the detail of the vibrations sensor is displayed on the Arduino serial monitor.

vibration sensor working principle arduino circuit proteus codeComponents Required


Vibration Sensor

Virtual Terminal

Explain Circuit:

The design of the circuit for Arduino Vibration Sensor is very easy. Attach the Main pin and GND pins of the Vibration Sensor to 5V of Arduino.

Then join the out (S) pin of the sensor to Digital Input and Output pin 8 of Arduino. Ultimately, a Virtual terminal is attached to Pin 7 of Arduino between a 1k ohms current with limiting resistors.


Make the attachment as per the circuit diagram show above. Fix the vibration sensor to a door and knock on the door.

If the vibrations are plenty enough for the sensor to trace, the OUT of the sensor becomes low for that moment. This is traced by Arduino and it turns ON the LED for a second. When you make Test pin low, the sensor would not allow any output to show and when you make Test pin high then sensor will allow output to show which means vibration detected. The results are also showed on the serial monitor.

Arduino Code

// include the library code:
int b1 = 2;

int d1 = 9;

int cnt=0,cnt2;
int timer=0;
                // a maximum of eight servo objects can be created 
int pos = 0;    // variable to store the servo position 
void setup() {
  Serial.begin(9600);    	//initialize serial
pinMode(b1, INPUT_PULLUP);
pinMode(d1, OUTPUT);     

digitalWrite(d1, HIGH);
  delay(500);               // wait for a second

void loop() {

  if(digitalRead(b1) == LOW){  
Serial.println("VIBRATION ALERT"); 

  digitalWrite(d1, HIGH);
  delay(500);               // wait for a second
  digitalWrite(d1, LOW);
  delay(500);               // wait for a second
  digitalWrite(d1, HIGH);
  delay(500);               // wait for a second
  digitalWrite(d1, LOW);
  delay(500);               // wait for a second
  digitalWrite(d1, HIGH);
  delay(500);               // wait for a second
  digitalWrite(d1, LOW);
  delay(500);               // wait for a second




  • For instance, this sensor is utilized in industries like wind power and mining for slow going rotation of turbines with 1 Hz.
  • In dissimilarity, the industries like gas and oil required high frequency varies from 10 Hz to 10 kHz utilizing these sensors to handle with the quick rotation of gears and turbines.
  • The industries which apply the vibration sensor mainly added food, mining, metalworking, gas & oil, wind power and power generation.

So this is it. I hope you consider this guide useful. Let me know if you required any help with its projects. Will meets you guys next time. Till then take care, have more fun.

mpx4115a pressure sensor circuit arduino specification pinout




Piezo sensor Working Specification circuit Proteus Library