Blue PCB Electronics
2D12 Normally open vibration sensor module; vibration switch; alarm module
2D12 Normally open vibration sensor module; vibration switch; alarm module
Share
Description
The SW-18010P sensor is used to detect vibration. The sensor has a small spring inside a metal tube. When the sensor vibrates, the spring hits the metal tube and the sensor will be activated.
This sensor has two digital and analog outputs. When the sensor vibrates, the digital output changes from HIGH to LOW and the analog output changes from 1023 to 0.
Features:
- Operating voltage: 3.3V to 5V
- Including a fixed hole on board for easy installation
- Potentiometer included to adjust sensitivity
- Switch indicating LED
Pinout
This Module has 4 pins:
- VCC: Module power supply – 3.3V to 5V
- GND: Ground
- D0: Digital Output
- A0:Â Analog Output
You can see the pinout of this module in the image below.
Required Material
Hardware components
- Arduino UNO R3
- SW-18010P Vibration Sensor Module
- Male to Female jumper wireÂ
Step 1: Circuit
The following circuit show how you should connect Arduino to SW-18010P sensor. Connect wires accordingly.
Step 2: Code
Upload the following code to your Arduino.
#define Dig_pin 7
int Dig_out = LOW;
int Ana_out = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
Dig_out = digitalRead(Dig_pin);
Ana_out = analogRead(A0);
Serial.print("Anaolog : ");
Serial.print(Ana_out);
Serial.print(" Digital :");
Serial.println(Dig_out);
delay(500);
In this code, you can see the sensor analog and digital output values after vibration. First, we set two digital and analog pins as input. Then the values of two inputs appear on Serial Monitor.
The output is as follows. As you can see, when the sensor vibrates the digital and analog output will be zero.
Â