The digital shake sensor is used to detect hand shaking which is 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. Digital shake sensors can be used in applications where we need to switch on lights by just shaking your hand or shaking a Light Stick. Here we will be using Digital shake sensor v1.0 by DFROBOT.
Specifications
- Input Voltage (VCC): 3.3V~5.0V
- Switch Life Span: Over 200,000 times
- Interface: Gravity 3P Digital
- Unidirection sensitive
- Strong anti-shock interference
Overview
The user need to 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 will ON. Shakes or vibrations in other directions like the X or Z do not produce an effective interrupt pulse.
Label | Name | Description |
+ | VCC | Power VCC(3.3~5.5V) |
– | GND | Power GND |
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) |
Components Required
- ARIES v2 Microcontroller
- Digital shake sensor
- Jumper wires
- Resistor -> 10 KOhm
Note: All of the following boards can be used for this project
Circuit Diagram
Digital Shake Sensor | ARIES V2 board |
+ | 3.3V |
– | GND |
D | GPIO-0 |
Now, for powering up the ARIES v2 board via the USB port of a Laptop/Desktop/PC and burning the code into the ARIES v2 board, we have to use a micro USB type B to USB type A cable. The cable should be connected to UART-0 port of the ARIES v2 board, and the Laptop/Desktop/PC should be preinstalled with Arduino IDE and VEGA ARIES boards of latest version.
Procedure
Open Arduino IDE
Go to Tools -> Board -> VEGA Processor ARIES Boards -> Select ARIES v2
Go to Tools -> Programmer -> Select VEGA XMODEM
Connect the ARIES v2 board to PC
Go to Tools -> Port -> Select the appropriate port
Open File -> Examples -> Examples for ARIES v2 -> GPIO -> Open digitalShakeSensor example
After opening the example code Compile and Upload the code
Output
Once you’ve completed the code, upload it to your ARIES v2.0 board using the Arduino IDE. Wait until the program is uploaded. After completing the uploading the program will start to execute. In the direction indicated by the arrow on-board, every time the module is shaken, the built-in LED on ARIES Board will toggle.