Laser Diode Tripwire Alarm… A Launchpad Security System - LEKULE

Breaking

29 Aug 2016

Laser Diode Tripwire Alarm… A Launchpad Security System

The Launchpad-Based Laser Tripwire Alarm turns your next security system into a secret agent's dream.

The Laser Tripwire Alarm utilizes basic components to create a sounding alarm anytime something crosses through the laser. Guard your precious valuables or learn how to make it control just about anything!



Diagram from original project page

Why?

I was fed up with my lack of laboratory security so I created a Laser Tripwire Alarm to alert me anytime somebody was trying to break in and steal my scientific plans. To compliment my high-tech security, I also created the Confetti-Cannon so my intruder would be left covered in confetti and caught red-handed! If these don't fit your security needs, have fun and get creative with it!
(Disclaimer: Not for use as a legitimate home security system.)

How?

For further information see the original article: Laser Tripwire Alarm.
The design focuses on the analog input reading, which fluctuates because it is dependent on the resistance of the light-dependent resistor (LDR). An LDR changes its resistance based on light intensity. The emitted beam from the laser diode is directed onto our LDR. Anytime something crosses between the two components, the laser is blocked and does not illuminate the LDR; this causes the LDR's resistance to increase, resulting in a lower voltage at the ADC input pin.


Diagram from original project page

A threshold of 3V is used. Whenever the analog input is below the threshold, the Launchpad sends pulses of 3.6V out to our buzzer, creating an audible alarm. The buzzer module does not require a typical AC audio signal or even an audio-frequency square wave; you just apply a steady voltage for as long as you want it to make sound. The buzzer used here is described as a 5V device, but it worked fine for me at 3.6V.

For other tripwire-activated control tasks, you can use a relay.

Breakdown:

Essentially, your code will do the following:
  • Calculate the analog input voltage
  • Compare the analog input voltage to the threshold value
  • If under the threshold, send a pulsing signal out to buzzer (i.e., on for 150 ms, off for 100 ms)

                    // the setup routine runs once when you press reset:
void setup() {
 analogRefrence(DEFAULT); // Set VR+ = VCC:3.6B, VR- = GND:0V as the upper and the lower limits
 pinMode(3,OUTPUT); // set the buzzer pin mode
}

// the loop routine runs over and over again forever:
void loop() {

  // read the analog voltage at A0
  int sensorValue = analogRead(A0); 
  // convert the ADC reading to voltage
  float voltage = sensorValue * (3.6 / 1023);  


  if (voltage < 3.0) {
  
    // tripwire is cut: activate the buzzer with oscillation
    digitalWrite(3,HIGH); 
    delay(150);
    digitalWrite(3,LOW); 
    delay(100);
  }
    
    
  else {
    // tripwire is not cut: de-activate the buzzer 
    digitalWrite(3,LOW);
  } 
   
}
                  

 

Remember, home security is not the only use for the Laser Tripwire. Control your lighting just as I did, automate the rest of your home, or get creative and invent the next best security robot! Happy Making!



Want more MIT-i? Check out the CAT-apult, a revolutionary new launchpad-based pet-feeding system!

No comments: