Laser Diode Tripwire Alarm with Launchpad

By Ryan Jones

This Launchpad-Based Laser Tripwire Alarm will turn your next security system into a secret agent’s dream that can be expanded for other home automation projects. The Laser Tripwire Alarm utilizes basic components to create an alarm that sounds off anytime something crosses through the laser. Guard your precious valuables or learn how to make it control just about anything!

 

 

Required Materials

Hardware

Software

 

Schematic

 

Launchpad Laser Trip-wire Schematic

 

Why?

I was fed up with my laboratory’s lack of security so I created a Laser tripwire alarm that would alert me anytime somebody was trying to break in and steal my super secret scientific plans. To compliment my high-tech security system, I also created the Confetti-Cannon so my intruder would be covered in confetti and caught red-handed! If these systems don’t fit your security needs, have fun and get creative with it!

(Disclaimer: Does not work well as a legitimate home security system.)

 

How Does it Work?

If you’d like to learn more about laser tripwire systems, see the original article: Laser Tripwire Alarm.

The design is focused on the analog input reading, which will fluctuate because it is dependent on the resistance of the LDR (light-dependent resistor). An LDR changes its resistance based on light intensity. The beam emitted from the laser diode is directed onto our LDR. Anytime something crosses between the two components, the laser is blocked and will not illuminate the LDR; this causes the LDR’s resistance to increase, which results in a lower voltage at the ADC input pin.

 

LDR Characteristic Curve

 

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

You can use a relay for other tripwire activated control tasks.

 

The Code

Essentially, your code will do the following:

  • Calculates the analog input voltage
  • Compares the analog input voltage with 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. You can control your lighting like I did, automate the rest of your home, or get creative and invent the next best security robot! Happy Making!

Related Projects

Using an LDR Sensor with Arduino

DIY Music Keyboard   (We’d love to see somebody replace the keys with LDRs!)

Recommended Posts

Leave a Comment

34 − 28 =

Start typing and press Enter to search