Shock Sensor Module with Arduino - Step by Step Guide - Circuit Magic (2024)

  • Publish
  • Register
  • Login

Home » Shock Sensor Module with Arduino – Step by Step Guide

admin, August 7, 2023August 7, 2023, Arduino, 37 in 1 Sensor Kit, arduino, 0

Shock Sensor Module with Arduino - Step by Step Guide - Circuit Magic (2)

The Shock Sensor Module, also known as a vibration sensor or shake sensor, is designed to detect sudden movements or shocks. It is commonly used in security systems, impact detection projects, and interactive installations. In this step-by-step guide, we’ll show you how to set up the Shock Sensor Module with an Arduino and create projects that respond to sudden impacts.

Materials Needed:

  1. Arduino board (e.g., Arduino Uno, Arduino Nano)
  2. Shock Sensor Module (e.g., SW-420)
  3. Buzzer or LED (optional, for alert indication)
  4. Resistor (220 ohms, if using an LED)
  5. Breadboard and jumper wires
  6. USB cable for Arduino
  7. Computer with the Arduino IDE installed (https://www.arduino.cc/en/software)

Step 1: Wiring

Connect the Shock Sensor Module to the Arduino board as follows:

  • Connect the module’s VCC (Voltage) pin to the 5V pin on the Arduino.
  • Connect the module’s GND (Ground) pin to the GND pin on the Arduino.
  • Connect the module’s OUT (Digital Output) pin to a digital pin on the Arduino (e.g., D2).

Step 2: Optional Alert Indication

If you want to add an alert indication, you can use either a buzzer or an LED.

  • For a buzzer:
    • Connect the positive (longer) leg of the buzzer to a digital pin on the Arduino (e.g., D3).
    • Connect the negative (shorter) leg of the buzzer to the GND pin on the Arduino.
  • For an LED:
    • Connect the anode (longer leg) of the LED to a digital pin on the Arduino (e.g., D3).
    • Connect the cathode (shorter leg) of the LED to a 220 ohm resistor, and then connect the other end of the resistor to the GND pin on the Arduino.

Step 3: Coding Open the Arduino IDE and create a new sketch. Then, enter the following code:

const int shockSensorPin = 2; // Digital pin connected to the Shock Sensor moduleconst int alertPin = 3; // Digital pin connected to the Buzzer or LED (optional)void setup() { pinMode(shockSensorPin, INPUT); // Set the Shock Sensor pin as INPUT pinMode(alertPin, OUTPUT); // Set the Buzzer or LED pin as OUTPUT (optional) digitalWrite(alertPin, LOW); // Turn off the Buzzer or LED initially (optional) Serial.begin(9600); // Initialize serial communication for debugging (optional)}void loop() { int shockValue = digitalRead(shockSensorPin); // Read the digital value from the Shock Sensor if (shockValue == HIGH) { Serial.println("Shock detected!"); // Display a message when a shock is detected // Your custom actions or functions can be added here. // For example, you can activate the Buzzer or LED to indicate the shock. digitalWrite(alertPin, HIGH); // Turn on the Buzzer or LED (optional) } else { // No shock detected, turn off the Buzzer or LED (optional) digitalWrite(alertPin, LOW); // Turn off the Buzzer or LED (optional) } delay(100); // Add a small delay to avoid rapid repeated detections}

Step 4: Uploading the code

Connect your Arduino board to the computer using the USB cable and select the appropriate board and port from the Arduino IDE. Then, click the “Upload” button to upload the code to the Arduino.

Step 5: Shock Detection

Once the code is uploaded successfully, the Shock Sensor Module will be monitoring for sudden movements or shocks. If a shock is detected, the Buzzer will sound or the LED will light up (if you added an alert indication).

Step 6: Experiment and Observe

Now that the Shock Sensor Module is set up and detecting shocks, you can experiment with different levels of impact and observe the sensor’s responsiveness. Adjust the code to trigger specific actions or events based on shock detections.

Congratulations! You’ve successfully set up and used the Shock Sensor Module with Arduino. This valuable sensor allows you to detect sudden movements and impacts, making it ideal for security and impact detection projects. Have fun experimenting and incorporating the Shock Sensor Module into your Arduino projects to stay alert to sudden changes in your environment!

Related Articles

  • Getting Started with Arduino IoT Cloud

    admin, April 4, 2023April 4, 2023, Arduino, 0

    Introduction: Arduino IoT Cloud is a cloud-based platform that allows you to build IoT applications with ease. In this...

  • +

    Reed Switch Module with Arduino – Step-by-Step Guide

    admin, August 5, 2023August 5, 2023, Arduino, 37 in 1 Sensor Kit, arduino, 0

    Introduction: The Reed Switch module is a simple but powerful sensor that can detect the presence of a magnetic...

  • +

    Using the IR Receiver Sensor Module with Arduino – Step by Step Guide

    admin, August 7, 2023August 7, 2023, Arduino, 37 in 1 Sensor Kit, arduino, 0

    The IR Receiver Sensor Module is a versatile component that allows your Arduino projects to receive and decode infrared...

  • +

    Arduino Bluetooth LED controller

    Team, April 2, 2017November 19, 2023, Arduino, android, arduino, bluetooth, control, led, 4

    Hi Guys! Today I talk about “Arduino Bluetooth” application which is provided by CircuitMagic. Recently application has been updated...

  • Getting Started with Arduino: A Beginner’s Guide to Programming and Using Arduino Boards

    admin, March 30, 2023March 31, 2023, Arduino, 1

    Arduino is an open-source electronics platform that has become popular among hobbyists and professionals alike. It is a versatile...

  • +

    PIR Motion Sensor with Arduino

    admin, December 17, 2015November 19, 2023, Arduino, 26

    Hi folks I am back once again to share with you my simple but useful project and step-by-step descriptive...

  • +

    Hall Effect Magnetic Sensor Module with Arduino – Step by Step Buide

    admin, August 5, 2023August 5, 2023, Arduino, 37 in 1 Sensor Kit, arduino, 0

    The Hall Effect Magnetic Sensor module is a versatile component used to detect the presence and strength of magnetic...

  • List of Arduino Robot Kits for Beginners

    admin, July 26, 2018April 14, 2019, Arduino, 0

    If you are a beginner and want to enter the world of Robotics and want to build your own...

0 Comments

Leave a reply

SALE STILL NOT OVER

Shock Sensor Module with Arduino - Step by Step Guide - Circuit Magic (8)

Recent Posts

  • Troubleshooting Common 3D Printing Issues
  • Disco RGB LED Light with Arduino code
  • Motion Detection with Raspberry Pi and PIR Sensors

Recent Comments

  • pichincho on
  • Russel on Light Cup Module with Arduino – Step by Step Guide
  • talha on PIR Motion Sensor with Arduino
  • Halverto on Buzzer Module with Arduino – Step by Step Guide
  • Radhe banik on Control DC Motor CW/CCW with MPU-6050 Gyro/Accelerometer + Arduino

Categories

  • 3d Printer
  • Arduino
  • Circuits
  • Cool Projects
  • Electric Car
  • Microcontrollers
  • Robotics
  • technology

Shock Sensor Module with Arduino - Step by Step Guide - Circuit Magic (9)

Spread your Magic!

CircuitMagic is a platform where you can share your creations and DIY projects with the world. You can share the photo, video or step by step guide tutorial for the project.

Why publish here

Your ideas, your creativity... why only to yourself or to your friends. Share it with the whole world and spread your magic!Thousand's of users visit every day at CircuitMagic to post here their DIY projects. You can share with thousand's of people and make your follower.

Search

Categories

  • 3d Printer (9)
  • Arduino (61)
  • Circuits (1)
  • Cool Projects (2)
  • Electric Car (1)
  • Microcontrollers (1)
  • Robotics (1)
  • technology (2)

Tag Cloud

3d PrinterArduinoCircuitsCool ProjectsElectric CarMicrocontrollersRoboticstechnology

45 Sensor Kit for DIY project

Shock Sensor Module with Arduino - Step by Step Guide - Circuit Magic (10)

Shock Sensor Module with Arduino - Step by Step Guide - Circuit Magic (2024)
Top Articles
Latest Posts
Article information

Author: Ray Christiansen

Last Updated:

Views: 6367

Rating: 4.9 / 5 (49 voted)

Reviews: 88% of readers found this page helpful

Author information

Name: Ray Christiansen

Birthday: 1998-05-04

Address: Apt. 814 34339 Sauer Islands, Hirtheville, GA 02446-8771

Phone: +337636892828

Job: Lead Hospitality Designer

Hobby: Urban exploration, Tai chi, Lockpicking, Fashion, Gunsmithing, Pottery, Geocaching

Introduction: My name is Ray Christiansen, I am a fair, good, cute, gentle, vast, glamorous, excited person who loves writing and wants to share my knowledge and understanding with you.