Interface an SW-420 Vibration sensor with Arduino

What is an SW-420 Vibration Sensor module?

The SW-420 Vibration Sensor module is a type of sensor module that is used to detect vibrations. It is also known as the vibration switch. It consists of an SW-420 vibration sensor that outputs voltage depending upon the intensity of the vibration. That output voltage is further used by a comparator IC LM393 present on the module for comparison. If the voltage from the sensor is equal to the voltage set by us using the potentiometer present on the module then the sensor will output Logic 1. Otherwise, it will output Logic 0. So, by using the potentiometer you can easily set the sensitivity of the sensor for a particular intensity of the vibration. Two LEDs are also present on the module, one for indicating power and another for indicating whether the sensor has detected vibration or not. This type of sensor is very useful in designing shocks triggering circuits like theft alarm, earthquake alarm, etc.

Pin configuration of the SW-420 Vibration sensor

SW-420 Vibration sensor pin diagram

Pin uses

  • Pin 1 is the VCC pin used for connecting 5V.
  • Pin 2 is the GND pin used for connecting the GND.
  • Pin 3 is the Data pin used to get digital data from the sensor.

Features of the SW-420 Vibration Sensor module

  • The operating of the module is 3.3-5V.
  • The current consumption of the module is <15mA.
  • It is small, cheap and easily available.

Components needed 

  • Arduino UNO
  • SW-420 Vibration Sensor module
  • Breadboard
  • Jumper wires

Pin connections of the SW-420 Vibration Sensor module with Arduino UNO

  • Connect the VCC pin of the module to the 5V pin of the Arduino UNO.
  • Connect the GND pin of the module to the GND pin of the Arduino UNO.
  • Connect the D0 pin of the module to the D2 pin of the Arduino UNO.

Circuit diagram of the SW-420 Vibration sensor with Arduino

SW-420 Vibration sensor circuit diagram

Arduino code for the SW-420 Vibration sensor

int sensorPin=2;//Define sensor pin
void setup()
{
Serial.begin(9600);//Set baud rate for serial communication
pinMode(sensorPin,INPUT);//Set sensor pin as input
}
void loop()
{
int sensorData=digitalRead(sensorPin);//Get data from the sensor
Serial.print("Sensor Data:");//print sensor data on the serial monitor
Serial.println(sensorData);
}

Leave a Reply