Easy Basics: Project 043a Vibration sensor module, LEDs

of Acoptex.com in UNO

Basics: Project 043a

Project name: Vibration sensor module, LED

Tags: Arduino, SW-420, Vibration sensor module, Piezoelectric, Piezo, Shake switch, Vibration switch, LED, KY-002, Vibration Shock sensor, Vibration knock sensor, 801S

Attachments: sketch

In this project, you needed these parts :

1.Aruduino Uno R3 (you can also use the other version of Arduino)

2.Arduino IDE ( you can download it from here  )

3.Jumper cables F-M, M-M

4. Vibration sensor (Vibration switch) module (there are a lot of variations) 1 pc

5. Breadboard any size 1pc

6. Resistor 200 Ohm-470 Ohm 2 pcs

7. LED (green and red) 2 pcs


We will learn how to connect vibration sensor module to Arduino board and use it.

Many Applications can created by measuring Vibration level, but sensing vibration accurately is a difficult job.  The vibration sensor module is based on vibration switch component which can detect the weak vibration signals. The sensor can work for vibration-related modules.

A vibration switch is a device that recognizes the amplitude of the vibration to which it is exposed and provides some sort of response when this amplitude exceeds a predetermined threshold value. The switch response is typically an electrical contact closure or contact opening. The electrical contact may be either an electromechanical relay or solid-state triac.

The main principle of vibration switch is that, conductive vibration spring and trigger pin are precisely placed in switch ontology and bond to curing position through adhesive. Normally, the spring and the trigger pin do not contact. Once shook, the spring will shake and contact with trigger pin to conduct and generate trigger signals.

Let's check different types (analog and digital) vibration sensor modules. It can be also a modules with both signals (analog and digital).

Understanding the digital vibration sensor module

The vibration sensor SW-420 Comes with breakout board that includes comparator LM 393 and Adjustable on board potentiometer  for sensitivity threshold selection, and signal indication LED. This sensor module produce logic states depends on vibration and external force applied on it. When there is no vibration this module gives logic LOW output. When it feels vibration then output of this module goes to logic HIGH. The working bias of this circuit is between 3.3V to 5V DC. Its omnidirectional in nature meaning any angle can trigger the sensor.

Understanding the analog piezoelectric vibration sensor module

The Piezo Vibration Sensor is based on piezoelectric transducer. It is well known that  piezoelectric materials responds to strain (deflection) changes or applied force by generating a measurable output voltage.  This output voltage is proportional to the strength of shock or vibration.  So you can measure and characterize the vibration.


  • Working Voltage: 3.3V or 5V
  • Working Current: <1mA
  • Operating Temperature Range: -10 ℃ ~ + 70 ℃
  • Interface Type: Analog Output

Signals and connections of any vibration sensor module

VCC (5V or +)  - connect to 5V pin of Arduino board. 

GND (or G or -) - ground pin of Arduino board

S - can be digital signal output or analog signal output (depends on vibration sensor module - if digital module will be digital signal output, in other cases analog signal output

D0 (or Dout) - Digital output to Arduino board. Connect to digital Arduino pin

A0 (or Aout) - Analog output to Arduino board. Connect to analog Arduino pin.

The "A0", is a serial signal 0-5 volts that when no vibration it outputs 0 volts, when level of vibration very high, 5 volts. The "D0", is configured with the trim pot and is brought high when the vibration level reaches a desired point.

Connect the long leg of the LED (the positive leg, called the anode) to the other end of the resistor. Connect the short leg of the LED (the negative leg, called the cathode) to the GND. Resistor connected for long leg.

Build the circuit

The following picture shows the needed connections with the Arduino Uno 

1. If you have digital vibration sensor module

2. If you have analog vibration sensor module

3. If you have digital and analog vibration sensor module


The output can be a digital signal (D0) LOW or HIGH, depending on the amount of water on the surface. If the amount of water exceeds a certain predefined threshold value, the modules outputs LOW, otherwise it outputs HIGH. The threshold value for the digital signal can be adjusted using the potentiometer.

The output can be a analog signal and so you’ll get a value between 0 and 1023. Please note that the analog value returned will vary depending on what voltage is provided for the sensor.

Step by Step instruction

  1. Open Arduino IDE.
  2. Plug your Adruino Uno board into your PC and select the correct board and com port
  3. Open up serial monitor and set your baud to 9600 baud
  4. Verify and upload the the sketch to your Adruino Uno board.
  5. 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.
  6. When the vibration level will be more then 100 (set threshold), it will turn on Red LED and turn off green LED.


We have learnt how to connect vibration sensor module  to Arduino board and use it.


  • No libraries required for this project


  • See attachments on the begining of this project description. 

Other projects of Acoptex.com
Easy Merry Xmas to everyone of Acoptex.com, Not selected 24-12-2019

Published at 11-11-2017
Viewed: 1153 times