How to use a Vibration Sensor with Arduino

How to use a Vibration Sensor with Arduino

Vibration Sensor Arduino

INTRODUCTION

A vibration sensor is a transducer that detects vibrations  and small movements (to and fro motion).

APPLICATIONS

The vibration sensor can be used to detect abnormal vibration in a mechanical system, automation working robots and driverless vehicles.

WIRING DIAGRAM

GND – GND

VCC - 5V

OUT – Digital Pin 10

Vibration Sensor arduino connection

CODE

 

 

int Led = 13 ;// define LED Interface
int Shock = 10; // define the vibration sensor interface
int val; // define numeric variables val
void setup ()
{
  pinMode (Led, OUTPUT) ; // define LED as output interface
  pinMode (Shock, INPUT) ; // output interface defines vibration sensor
}
void loop ()
{
  val = digitalRead (Shock) ; // read digital interface is assigned a value of 3 val
  if (val == HIGH) // When the shock sensor detects a signal, LED flashes
  {
    digitalWrite (Led, LOW);
  }
  else
  {
    digitalWrite (Led, HIGH);
  }
}

END RESULT

Try to touch/vibrate the sensor with your figure and the built-in LED (at Pin 13 on the Arduino-compatible board) will glow when a vibration is detected.

ADDITIONAL RESOURCES

https://circuitdigest.com/microcontroller-projects/arduino-sw-420-vibration-sensor-module-interfacing

https://www.instructables.com/id/How-to-use-a-vibration-sensor-shake-switch-Arduino/

https://www.seeedstudio.com/blog/2020/01/07/vibration-sensors-types-how-to-use-with-arduino-and-raspberry-pi/