IDUINO DEBO SEN2 VIBRA Datasheet

Page 1
IDUINO for Maker’s life
www.openplatform.cc
Vibration Shock module(SE053)
1 Introduction
This module is a shock switch module, and if it can detect a jolt ,it output one low level signal. Be similar with our most sensor, It has three pin: Power pin, Ground pin and signal switch pin. That’s an interesting function to your Arduino project.
Specification
Operation voltage: 5V 3Pin Size:25*15mm Weight: 2g
2 Pinout
Pin
Description
S
If the sensor detect a jolt, this pin output low level signal
+(middle pin)
Power
-
Ground
3.Example
This example show you how to use this module, connection as below, and upload the sketch, open the serial monitor session, see how it will go~
Page 2
IDUINO for Maker’s life
www.openplatform.cc
Example code :
******Code begin******
int shockPin = 10; // Use Pin 10 as our Input int shockVal = HIGH; // This is where we record our shock measurement boolean bAlarm = false;
unsigned long lastShockTime; // Record the time that we measured a shock
int shockAlarmTime = 250; // Number of milli seconds to keep the shock alarm high void setup () { Serial.begin(9600); pinMode (shockPin, INPUT) ; // input from the KY-002 } void loop () { shockVal = digitalRead (shockPin) ; // read the value from our sensor
if (shockVal == LOW) // If we're in an alarm state { lastShockTime = millis(); // record the time of the shock
if (!bAlarm){ Serial.println("IDUINO Shock module");
Page 3
IDUINO for Maker’s life
www.openplatform.cc
bAlarm = true; } } else { if( (millis()-lastShockTime) > shockAlarmTime && bAlarm){ Serial.println("no alarm"); bAlarm = false; } } }
******Code End******
Loading...