Gravity: Digital Shake Sensor
SKU: SEN0289
Introduction
Do you want to switch lights by just shaking your hand? However, you may don't want to use a
complicated and costly triple axis accelerometer. This digital shake sensor is sure to meet your
needs.
The digital shake sensor is to detect hand shaking which only sensitive to unidirectional hand
movements. The spring-type vibration switch is used to output a low-level pulse when the user
shakes once in the specified direction and the on-board indicator flashes at the same time. Thanks
to the unidirectional sensitivity of the vibration switch and the corresponding filter circuit, it has strong
anti-shock interference capability to prevent false triggering. Simple and easy, switch controls are all
in just a single shake.
Features
Unidirection sensitive, strong anti-shock interference, preventing false triggering
Compatible with 3.3V/5V controller
Compact design, easy to install
Applications
Shaking Light Stick
Shake Switch
Specifications
Input Voltage (VCC): 3.3V~5.0V
Switch Life Span: Over 200,000 times
Interface: Gravity 3P Digital
Dimension: 30.0mm*22.0mm
Board Overview
Digital Shake
Sensor
Label
Name
Description
+
VCC
Power positive(3.3~5.0V)
‐
GND
Power ground
D
Digital
Digital output (high‐level when stationary, low‐level pulse when
shaken)
PWR
Power
Power indicator (red), turned on when power up
ON
ON
Shake triggered indicator (blue)
How to Shake the Sensor
The vibration switch used by the sensor is unidirectional sensitivity. As shown in the above figure,
the user can hold the module just like the logo on the module, and shake it in the direction of the
arrow indicated on-board (from +Y to Y-). This will generate an effective low-level interrupt pulse on
the “D” pin and a bright flash on the indicator ON. Shakes or vibrations in other directions like the X
or Z do not produce an effective interrupt pulse.
Arduino Tutorial
Requirements
Hardware
DFRduino UNO R3 (or similar) x 1
DFRobot Gravity: Digital Shake Sensor x 1
Gravity 3P digital wire (or Dupont wires) x 1
Software
Arduino IDE (V1.0.x or V1.8.x), Click to Download Arduino IDE from Arduino®
Connection Diagram
Example Codes
#define LED_PIN
13
#define DIGITAL_INPUT_PIN
Pin 3 which is Interrupts 1.
3
unsigned char stateFlag = 0;
unsigned long timepoint = 0;
void setup()
//Connect the sensor to digital
{
pinMode(LED_PIN, OUTPUT);
// Set to input mode with internal pull-up.
// Otherwise, it will fail to generate intterupts under 3.3V power supply.
pinMode(DIGITAL_INPUT_PIN, INPUT_PULLUP);
attachInterrupt(1, toggleLED, FALLING);
when the falling edge is detected
// Trigger LED toggle function
timepoint = millis();
}
void loop()
{
// toggle onboard LED
if (stateFlag != 0){
digitalWrite(LED_PIN, HIGH);
}
else {
digitalWrite(LED_PIN, LOW);
}
}
//Interrupt serivce routinue
void toggleLED()
{
// The hardware has done some filter.
// To further improve stability, here add a 50ms for debouncing.
// This will not block the main function.
if (millis() - timepoint > 50U){
timepoint = millis();
stateFlag = (stateFlag + 1) % 2;
}
}
Results
In the direction indicated by the arrow on-board, every time the module is shaken, the ON indicator
on the sensor will flash once. The indicator L on the Arduino UNO will be toggled once.
Micro:bit Tutorial
Requirements
Hardware
Micro:bit x 1
Micro:mate x 1
DFRobot Gravity: Digital Shake Sensor x 1
Gravity 3P digital wire (or Dupont wires) x 1
Software
Microsoft Makecode
Connection Diagram
Example Codes
Results
Shake the module in the direction indicated on-board several times with force. The dot matrix LED
displays the heartbeat pattern.
https://www.dfrobot.com/wiki/index.php/Gravity:_Digital_Shake_Sensor_SKU:_SEN0289#More_Documents 11-12-18
很抱歉,暂时无法提供与“SEN0289”相匹配的价格&库存,您可以联系我们找货
免费人工找货- 国内价格 香港价格
- 1+31.862141+3.80810
- 3+28.174833+3.36740
- 国内价格
- 1+29.62159
- 3+26.19589
- 11+25.89644