Introduction: Simple Laser Tripwire

This is a tutorial for a small laser trip wire to keep things safe.

Things you will need

Wires

Photo-sensor

10k ohm resistor

pk buzzer

laser pointer

soldering iron and soldering

an arduino and a bread board

Use the fritzing diagram above for assisstance

Step 1: Step 1

Solder together the 10k ohm resister and the photo-sensor so they can fit in the same hole in the bread board.

Add them to the bread board

Step 2: Step 2

connect more wires and you can calibrate the photo-sensor with the following code

void setup() {
pinMode(4, OUTPUT);

Serial.begin(9600);

}

void loop(){

digitalWrite(4, HIGH);

Serial.println(analogRead(0));

}

more details here:

http://arduino.cc/en/Tutorial/Calibration

Step 3: Step 3

The final bit of code to activate the alarm

int buzzPin = 11;

// buzzer connected to digital pin 11
void setup() {

pinMode(buzzPin, OUTPUT); // sets the digital pin as output }

void loop(){

if(analogRead(0) < 850){ // this number depends on calibration of the photocell

digitalWrite(buzzPin, HIGH); // turns buzzer on

delay(1000); // waits for 1 second

digitalWrite(buzzPin, LOW); // turns buzzer off

} else{

digitalWrite(buzzPin, LOW);

}

}