SurtrTech
Published © GPL3+

SIM800L - LASER Tripwire GSM Alarm with Phone Number Dialing

Easy project on how to dial phone numbers using the SIM800L and as a project a GSM Tripwire alarm that will call you whenver someone passes.

BeginnerFull instructions provided1 hour1,248
SIM800L - LASER Tripwire GSM Alarm with Phone Number Dialing

Things used in this project

Hardware components

SIM800L EVB
×1
Arduino UNO & Genuino UNO
Arduino UNO & Genuino UNO
×1
LDR, 5 Mohm
LDR, 5 Mohm
×1
Resistor 1k ohm
Resistor 1k ohm
×1
LASER emitter
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Wiring 1

Basic wiring

Wiring 2

LASER Tripwire alarm project

Code

SIM800L_SerialCom.ino

Arduino
Code 1
/* This code can send data via serial to a module via UART and display on the serial monitor data sent by the module
 * It works with SIM800L and give the ability to send AT commands to test them
 * Refer to www.SurtrTech.com for more information */

#include <SoftwareSerial.h>    

SoftwareSerial sim800l(2, 3); // RX,TX for Arduino and for the module it's TXD RXD, they should be inverted


void setup()
    {
      
      sim800l.begin(9600);   //Module baude rate, this is on max, it depends on the version
      Serial.begin(9600); 
      
    }



void loop() {
  Serialcom();
}


void Serialcom()
    
    {
      delay(500);
      
      while (Serial.available()) 
      {
        sim800l.write(Serial.read());//Forward what Serial received to Software Serial Port
      }
      
      while(sim800l.available()) 
      {
        Serial.write(sim800l.read());//Forward what Software Serial received to Serial Port
      }
    }

SIM800L_GSM_LASER_Alarm.ino

Arduino
Code 2
/* This code works with SIM800L, LASER module and LDR for LASER GSM Tripwire Alarm
 * The LASER constantly lights up the LDR, and if someone passes by the value will drop 
 * and it will trigger a phone call alerting the phone owner
 * Refer to www.SurtrTech.com for more details
 */

#include <SoftwareSerial.h>

#define LDR A0           //Read the LDR value from the point where it meets the Resistor
#define LASER 7          //LASER trigger pin

int LDR_Value;

SoftwareSerial sim800l(2, 3);    // RX,TX for Arduino and for the module it's TXD RXD, they should be inverted

void setup() {
  
  pinMode(LDR, INPUT);          //Define pinModes
  pinMode(LASER, OUTPUT);
  Serial.begin(9600);           //Start the Serial communication with the PC and SIM800L
  sim800l.begin(9600);
  digitalWrite(LASER,HIGH);     //Put the LASER at high state
  delay(5000);

}

void loop() {
  
  LDR_Value=analogRead(LDR);      //Constantly read and display the LDR value
  Serial.println(LDR_Value);
  delay(30);                     //To avoid false reading
  
  if (LDR_Value < 800) {        //If someone passes through the value will drop, 800 is the threshold, you can chose whatever suits you, the serial monitor will help you
    
    sim800l.println("ATD+xxxxxxxxxxxxx;");  //The number to call don't forget to add the country code

 }


}

Credits

SurtrTech

SurtrTech

9 projects • 123 followers
YT Channel bit.ly/35Ai76l, run by Automation and Electrical Engineer, Electronics amateur, no IT background so you may see wreckage in codes

Comments