Arduino - Laser Tripwire Alarm System
by Simple-Circuits in Circuits > Arduino
57314 Views, 528 Favorites, 0 Comments
Arduino - Laser Tripwire Alarm System
![IMG_2615 copy.jpg](/proxy/?url=https://content.instructables.com/FJZ/4YZB/IL15MEE4/FJZ4YZBIL15MEE4.jpg&filename=IMG_2615 copy.jpg)
Hello everyone,
In this instructable, we will be building a laser guided tripwire alarm system using a development board.
Parts
![IMG_2587.jpg](/proxy/?url=https://content.instructables.com/FQ6/1UDB/IOCE8YL3/FQ61UDBIOCE8YL3.jpg&filename=IMG_2587.jpg)
![02711126_00_eca1f399-7195-4948-bae9-e7212907833d.jpg](/proxy/?url=https://content.instructables.com/F2F/WOGA/IOUBWNP4/F2FWOGAIOUBWNP4.jpg&filename=02711126_00_eca1f399-7195-4948-bae9-e7212907833d.jpg)
![IMG_2580.jpg](/proxy/?url=https://content.instructables.com/FUW/9R02/IOUBWNZ2/FUW9R02IOUBWNZ2.jpg&filename=IMG_2580.jpg)
Components used in this project:
Development board - SainSmart Leonardo R3
Enclosure - Junction Box
Trip wire - Red Dot Laser Diode
Alarm - Buzzer
Sensor - Photoresistor
Power supply - 9v battery
Wire - Male to Female Breadboard Jumper cable
Resistor - 10k
I used an improvised laser diode that was placed on a breadboard that was powered by a 9V battery. Alternatively, a laser pointer will also work well for this project.
Assemble
![IMG_2593 copy.jpg](/proxy/?url=https://content.instructables.com/FQG/CIQJ/IOUBWC9W/FQGCIQJIOUBWC9W.jpg&filename=IMG_2593 copy.jpg)
![IMG_2596.jpg](/proxy/?url=https://content.instructables.com/FZI/7WUP/IOUBWQM1/FZI7WUPIOUBWQM1.jpg&filename=IMG_2596.jpg)
![IMG_2599.jpg](/proxy/?url=https://content.instructables.com/F6H/0EHP/IOUBWGLR/F6H0EHPIOUBWGLR.jpg&filename=IMG_2599.jpg)
Using a soldering iron, I made two horizontal holes on the junction box to house the photoresistor.
After threading the photoresistor through the junction box, I glued a piece of plastic around it.
This makes it easier to calibrate the sensor in various lighting conditions.
The positive pin from the loudspeaker connects to pin 13 on the development board.
The negative pin from the loudspeaker connects to pin 11 on the development board.
Wiring
![IMG_2607 copy.jpg](/proxy/?url=https://content.instructables.com/FU2/JNJE/IOUBWKGD/FU2JNJEIOUBWKGD.jpg&filename=IMG_2607 copy.jpg)
![IMG_2613.jpg](/proxy/?url=https://content.instructables.com/F3C/T86N/IOUBWLLZ/F3CT86NIOUBWLLZ.jpg&filename=IMG_2613.jpg)
![IMG_2565.jpg](/proxy/?url=https://content.instructables.com/FT2/TI4Z/IOUBWN32/FT2TI4ZIOUBWN32.jpg&filename=IMG_2565.jpg)
The photoresistor connects to the 5v pin on the development board.
The remaining pin connects to the analog 0 pin.
A connection between the analog 0 pin and the ground (GND) pin is also established using a 10k resistor.
Before placing the 9V battery inside the enclosure, I used double sided tape to separate it from the development board.
Code
![Screen Shot 2016-05-31 at 3.36.48 AM.png](/proxy/?url=https://content.instructables.com/F2H/NFJ5/IOUBWWR3/F2HNFJ5IOUBWWR3.png&filename=Screen Shot 2016-05-31 at 3.36.48 AM.png)
int PR = 0; //Analog 0 to Photoresistor
int Loud = 13; //Pin 13 to Loudspeaker
void setup() {
pinMode(PR, INPUT); //Photoresistor is set as an input
pinMode(13, OUTPUT);
pinMode(11, OUTPUT);
Serial.begin(9600);//set serial monitor at 9600 baud
}
void loop() {
int Read = analogRead(PR);// "Read" reads analog0 data
Serial.println(Read);// Print that data
if (Read < 120) //if the value is less than 120 (this can be modified based on your lighting condition),
{
digitalWrite(Loud, HIGH); //speaker turns on
digitalWrite(11, LOW);
}
else //if the value is greater than 120
{
digitalWrite(Loud, LOW);// speaker will turn it off
digitalWrite(11, LOW);
}
delay(1000);//run every second }
Done
![IMG_2554.jpg](/proxy/?url=https://content.instructables.com/F8A/GPPE/IOUBWWGO/F8AGPPEIOUBWWGO.jpg&filename=IMG_2554.jpg)
Once the sensor is calibrated to your prefered setting, you can upload the code and close the junction box.
This version is is calibrated to work in low light conditions.
Although I used 9V batteries for this project, you can also use 5V wall adapters as a permanent solution.
If you want to see this project in action, please click on the link.