Hello everyone,
In this instructable, we will be building a laser guided tripwire alarm system using a development board.
Step 1: Parts
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.
Step 2: Assemble
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.
Step 3: Wiring
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.
Step 4: Code
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),
Read more: Arduino – Laser Tripwire Alarm System