Introduction

Many Applications can created by measuring Vibration level, but sensing vibration accurately is a difficult job. This article describes about vibration sensor SW-420 and Arduino interface then it may help you to design effort less vibration measurement.

Preparations

HARDWARE

SOFTWARE

Arduino IDE (version 1.6.4+)

About Vibration Sensor Module

Vibration Sensor Module comes with SW-420 vibration sensor, integrated with adjustable sensitivity via on board potentiometer. There are also LED indicators for power and the digital output status on board. It has a simple and straight forward 3-pin interface, VCC, GND and the DO (digital output). It supports 3.3V or 5V power. This vibration sensor module is compatible with any microcontroller that has a digital input, so of course any popular microcontroller such and PIC, Arduino and Raspberry Pi are compatible. A direct interface is essential to using this sensor. The DO pin will be LOW when there is no vibration, and indicator LED will lit up. Module Features: Uses: This Vibration Sensor can be used to detect vibration from any angle. There is an on-board potentiometer to adjust the threshold of vibration. It outputs logic HIGH when this module not triggered while logic Low when triggered.

Application Idea

•Automobie alarm. •Movement detection. •Vibration detecting Applications Features

Examples

Connection

Connect Vcc pin of sensor board to 5V pin of Arduino board, connect Gnd pin to Gnd pin of Arduino, Connect DO output signal pin of sensor board to Arduino digital pin D3. Do some calibration and adjust the sensitivity threshold, then upload the following sketch to Arduino board.
Vibration Sensor Module OSOYOO UNO
VCC 5V
GND GND
DO PIN 3

Arduino Code for Logic State Output 

In this project, we will connect Arduino with Vibration sensor and LED. When no vibration is detected, Vibration sensor output is 0 (low voltage),otherwise its output is 1(high voltage)。 If Arduino get 0 (no vibration) from vibration sensor it will turn on green LED and turn off Red LED. If Arduino get 1 from vibration sensor, it will turn on Red LED and turn off green LED.(Please choose the correct board type and correct port com for your Arduino IDE) Arduino Code for Value Reading 

Arduino Code for Value Reading and serial printing Vibration value, this code turns ON the onboard LED when measurement goes greater than 1000, you can adjust this threshold to your need. Finally, you should open the Arduino IDE serial monitor at a 9600 baud rate and you’ll see: