Interfacing Shock Sensor Module with Arduino
Shock Sensor Module
A Shock Sensor Module detects vibrations or sudden impacts. It is commonly used in security systems, impact detection, and interactive electronics where motion or shock needs to be monitored.
Working Principle of Shock Sensor Module
The Shock Sensor Module works by using a spring-based or piezoelectric mechanism that responds to vibrations. When the sensor detects a sudden movement or jolt, it sends a signal that can be interpreted by the Arduino.
Types of Shock Sensors
Spring-Based Shock Sensor
- A spring is suspended inside the module.
- When a shock or vibration occurs, the spring touches a conductive surface.
- This closes the circuit and sends a digital signal to the Arduino.
Piezoelectric Shock Sensor
- Mechanical vibration stresses the piezoelectric element.
- This generates a voltage proportional to the vibration.
- The signal is processed by the Arduino to detect shock intensity.
Requirements
1. Arduino
2. Shock Sensor Module
3. 100 ohm resistor
4. Jumper wires
Pin Configuration of Shock Sensor Module
Shock Sensor Module
- VCC: Connect to +5V on Arduino.
- GND: Connect to GND on Arduino.
- DO: Digital output pin that sends HIGH/LOW signal based on shock detection.
Wiring the Shock Sensor Module to Arduino
To connect the Shock Sensor Module to Arduino, wire the VCC to +5V and GND to ground. The DO (Digital Output) pin connects to any digital input pin on Arduino for reading shock events.
Algorithm
Initialize Components
- Connect the VCC and GND pins of the Shock Sensor to +5V and GND on the Arduino.
- Connect the DO pin to a digital input on Arduino.
Write the Code
- Set the sensor pin as INPUT in the setup() function.
- Read the digital signal in the loop() function to detect shock events.
- Use conditions to respond to HIGH/LOW states.
Display Values or Control Devices
- Print shock detection status to the serial monitor.
- Trigger LEDs, buzzers, or send notifications based on shock input.
Test the Project
- Upload the code to the Arduino.
- Tap or shake the sensor lightly to simulate shock and observe the response.
Arduino Code
1const int shockPin = 2; // Shock sensor output connected to digital pin D2
2const int ledPin = 13; // Onboard LED for impact indication
3
4void setup() {
5 pinMode(shockPin, INPUT); // Set shock sensor pin as input
6 pinMode(ledPin, OUTPUT); // Set LED pin as output
7 Serial.begin(9600); // Initialize serial communication
8 Serial.println("Shock Sensor Initialized...");
9}
10
11void loop() {
12 int shockStatus = digitalRead(shockPin); // Read sensor value (HIGH or LOW)
13
14 if (shockStatus == HIGH) {
15 // Vibration/Impact Detected
16 digitalWrite(ledPin, HIGH); // Turn ON LED
17 Serial.println("Shock Detected!");
18 } else {
19 digitalWrite(ledPin, LOW); // Turn OFF LED
20 }
21
22 delay(100); // Small delay to reduce flickering
23}
24
Applications of Shock Sensor Modules
- Vibration-triggered alarms
- Anti-theft systems
- Impact detection in robotics
- Interactive gaming hardware
- Earthquake sensing systems
- Sensitive touch-based inputs
Conclusion
Interfacing a Shock Sensor Module with Arduino enables simple yet effective motion or impact detection. Whether you're building an alarm system or experimenting with interaction, this module offers a hands-on way to integrate physical feedback into your projects.