Vibration Sensor Arduino Alarm

Vibration sensor circuit uses a Piezoelectric sensor or PZT transducer. A piezoelectric sensor works with the piezoelectric effect, which is the ability of certain materials to generate an electric charge in response to the applied physical stress. The piezoelectric crystal converts physical parameters such as pressure, strain or force to a corresponding electrical charge.

In the circuit, the piezo sensor is connected across the Analog read pin A0 and the GND. If any vibration occurs, proportional rate of electrical potential induces across the piezo terminals.

Vibration sensor, knock vibration activated alarmThe analog read pin compares the induced voltage with a reference value. If the voltage induced is greater than the reference threshold value the Alarm will ON.  The alarm remains ON for 10 seconds after the triggering. Change the value of delay function to adjust the ON time of the alarm.

The speaker is connected to pin 9 on the arduino board. The tone function of the arduino is used to generate the alarm (arduino tone generator). An LED for the visual indication is added to the pin10. vibration activated alarm circuit

The sensitivity of the device can be varied by adjusting the threshold value. The threshold should be set to an optimum value, which can ignore minute vibrations and at the same time it doesn’t need any heavy vibrations for triggering.

Vibration sensor arduino alarm Code

const int threshold = 50;

void setup() {
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);

void loop() {
  if (analogRead(A0) >= threshold) {
    digitalWrite(10, HIGH);
    tone(9, 600, 3000);
    digitalWrite(10, LOW);

GSM Based Home Security Alarm System

A GSM home security system alerts you by a phone call when any theft attempt or similar triggering action is sensed by the device. Here a theft attempt or burglar entry is detected by sensing the vibration produced during the action, which is sensed by the piezoelectric sensor. This theft alert system can be used for multiple purposes. It can use wherever a theft attempt can be detected by means of vibration.

motion detector that calls cell phone

Refer: GSM module Hardware interface with Arduino

The analog input value will be in proportional to the intensity of the vibration over the piezo sensor. The electrical signal from the piezoelectric sensor compares with a preset reference (threshold) value. And when the input value is above the threshold, the Arduino executes the AT command sketch to call the given number.

The sensitivity of the device can be adjusted by changing the value of the variable ‘threshold’. In the program, the threshold value has already set to 50. The threshold value should be adjusted, so as to trigger the device based on the level of vibration that may be occurred during the theft attempts. A smaller threshold value makes the device to respond even for minute vibrations. So a threshold value should be set to avoid unwanted triggers and to detect wanted triggers.

The piezo sensor should be placed, where the chance of vibration is high or where enough vibration will be produced. For easy and better placing, the sensor can be placed apart from the GSM and Arduino circuit. The wires should not be too long as it may drop the induced voltage. So always try to reduce the wire length as much as possible.

Arduino gsm alarm code

//GSM call based security system
#include <SoftwareSerial.h>
SoftwareSerial serial(2, 3);// RX, TX
//Set required threshold value.
int threshold = 50;

void setup() {
 //Set Exact Baud rate of the GSM/GPRS Module.

void loop() {
  if (analogRead(A0) >= threshold) {
    /*Replace XXXXXXXXXX to 10 digit mobile number & ZZ to 2 digit country code*/

After dialing, there is a delay of 30 seconds before the termination of the call. So, even the call has terminated at the receiver end the next call will be dialed only for a triggering after 30 seconds. That is the device always makes the call alert if any triggering vibration occurs after 30 seconds from the last triggering. To stop the alert completely, the user has to power off the device.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *