Project in progress
Laser Beam Alarm

Laser Beam Alarm

An alarm that triggers a siren sound an police lights when the beam of light is interrupted.

  • 3,068 views
  • 6 comments
  • 10 respects

Components and supplies

Apps and online services

About this project

We wanted to make something like those cool laser alarms we see in action movies and videogames.

Code

Laser AlarmC/C++
Just adjust the sensivity to match your laser pointer's power.
To reset the alarm just push the button.
/*
A laser pointer is needed to make a light beam that will be detected by the ldr
Make Sure you line up the beam and the ldr properly
*/
const int sensivity = 400;  // 0-1023 a lower value means a more powerful laser

#define ldr A0
#define redLed 7
#define blueLed 8
#define buzzer 9
#define buttonPin A2


int buttonState;
int state = 0;


void setup() {
  alarmOFF();
  Serial.begin(9600);
  pinMode(redLed, OUTPUT);
  pinMode(blueLed, OUTPUT);
  pinMode(buzzer, OUTPUT);
}

void loop() {
  int light = analogRead(ldr);
  int button = analogRead(buttonPin);
  Serial.print("button = ");
  Serial.print(button);
  Serial.print("\n");  
  Serial.print("light = ");
  Serial.print(light);
  Serial.print("\n");  
  Serial.print("state = ");
  Serial.print(state);
  Serial.print("\n"); 
  Serial.print("\n");  
  if (button >= 1020) {
    state = 0;
  }
  if (light > sensivity) {
    state = 1;
  }
  if ((light <= sensivity) && (state == 0)) {
    alarmOFF();
  }
  if (state == 1) {
    alarmON();
  }
}


void alarmON() {
  tone(buzzer, 1760);
  digitalWrite(redLed, HIGH);
  digitalWrite(blueLed, LOW);
  delay(500);
  tone(buzzer, 1319);
  digitalWrite(blueLed, HIGH);
  digitalWrite(redLed, LOW);
  delay(500);
}

void alarmOFF() {
  noTone(buzzer);
  digitalWrite(redLed, LOW);
  digitalWrite(blueLed, LOW);
}

Schematics

Laser Alarm Schematic
laser_beam_alarm_KF0BtsWv6u.fzz
Laser Alarm Schematic
Laser beam alarm bb 1hvkyxruwk

Comments

Similar projects you might like

Buzzer Alarm System With Help Of Arduino

by Team ONYX

  • 43,987 views
  • 6 comments
  • 25 respects

Cheap DIY LASER ALARM - Multi Functional!

Project tutorial by Danny van den Brande

  • 4,092 views
  • 1 comment
  • 3 respects

Complete Digital Clock Including Alarm and Motion Sensor

Project in progress by LAGSILVA

  • 14,589 views
  • 17 comments
  • 53 respects

Making Capacitance Alarm with Arduino

Project tutorial by muhammed shameel k.v

  • 988 views
  • 0 comments
  • 1 respect

Arduino Laser Tripwire

Project tutorial by Ian Cumming

  • 16,300 views
  • 12 comments
  • 50 respects

Motion Sensing Alarm With Keypad & Password

Project showcase by thehack904

  • 11,440 views
  • 34 comments
  • 40 respects
Add projectSign up / Login