Project tutorial
GSM Alarm

GSM Alarm © GPL3+

Sending SMS every time the door was opened.

  • 143 views
  • 0 comments
  • 4 respects

Components and supplies

About this project

A simple system that is designed to send SMS every time when the garage door was open. Uses reed switch to monitor door state (open/closed).

Code

GSM Alert SketchArduino
// Sending an SMS every time when the garage door was opened.
// Use reed switch to monitor door state (open/closed).
#include <GSM.h>
#define REED_SWITCH_PIN 6
#define PINNUMBER "" // SIM card PIN
#define RECIPIENT_NUMBER "+380987654321" // Replace with your telephone number.

GSM gsmAccess; 
GSM_SMS sms;
bool notConnected = true;
bool opened = false;

void setup() {
  pinMode(REED_SWITCH_PIN, INPUT);

  // Start GSM shield.
  // If your SIM has PIN, pass it as a parameter of begin() in quote.
  while(notConnected) {
    if (gsmAccess.begin(PINNUMBER) == GSM_READY) {
      notConnected = false;
    } else {
      delay(1000);
    }
  }
}

void loop() {
  // There are two types of reed switches: NO (normally open) and NC (normally closed).
  // Normal state means the state when the switch is not under the influence of a magnet.
  // Closed - conducts current. Open - does not conduct current.
  // So for NO switch HIGH means the door is closed (switch is near the magnet).
  // For NC switch HIGH means the door is opened (switch is far from the magnet).
  // You can use both types of reed switches, but update the check accordingly.
  // NO reed switch consumes more energy in this circuit,
  // but when someone maliciously cuts the wires, an SMS will be sent.

  // This check is for NO (normally open) reed switch.
  if (digitalRead(REED_SWITCH_PIN) == HIGH) { // the door is closed
    opened = false;
  } else if (!opened) { // the door was just opened (the door is open and previously it was closed)
    opened = true;
    // send SMS
    sms.beginSMS(RECIPIENT_NUMBER);
    sms.print("Garage door was open.");
    sms.endSMS();
    // 15 minutes break
    delay(900000);
  }
}

Schematics

GSM Alarm Prototype
Gsm alarm proto m0mz2qexxj
Prototype on actual board.
Gps alarm proto ewwpntlhsu

Comments

Similar projects you might like

GSM Home Alarm V1.0

Project tutorial by Hugo Gomes

  • 29,232 views
  • 13 comments
  • 44 respects

Alarm System Security Put to the Test

Project tutorial by danionescu

  • 13,396 views
  • 4 comments
  • 23 respects

Soda Can Alarm

Project tutorial by Steven Jonathan

  • 1,454 views
  • 2 comments
  • 6 respects

Buzzer Alarm System With Help Of Arduino

by Team ONYX

  • 40,887 views
  • 6 comments
  • 24 respects

Security System | SW-420 | Arduino | GSM

by AbuTaj

  • 5,683 views
  • 3 comments
  • 9 respects

Making Capacitance Alarm with Arduino

Project tutorial by muhammed shameel k.v

  • 983 views
  • 0 comments
  • 1 respect
Add projectSign up / Login