Skip to content

LASER Tripwire Alarm with Arduino



Hello, and welcome to another tutorial sponsored by Seeed Studio, the other one was a Speech recognition module, many thanks for them, today we have a Light Sensor module, that you can get here: Buy module here from Seeed Studio.

About Seeed Studio

Seeed is the IoT hardware enabler providing services over 10 years that empower makers to realize their projects and products. Seeed offers a wide array of hardware platforms and sensor modules ready to be integrated with existing IoT platforms and one-stop PCB manufacturing and Prototype PCB Assembly. Seeed Studio provides a wide selection of electronic parts including ArduinoRaspberry Pi and many different development board platforms. Especially the Grove Sytsem help engineers and makers to avoid jumper wires problems. Seeed Studio has developed more than 280 Grove modules covering a wide range of applications that can fulfill a variety of needs. 

Check the module wiki here.

Light_sensor_1
Grove Light Sensor v1.2

Light_sensor_2

 

Hardware and parts

In addition to the light sensor, we’re adding these following parts for our project:



Wiring

The module is very easy to interface with the Arduino board, the module has a 4-pins grove connector, GND, 5V, and an analog output, the other pin is not connected, and as you thought, the output signal changes depending on the light detected.

Wiring 1.png
Grove light sensor wired with Arduino UNO board

Code

This is the easiest code to test the module, we just read the analog value and display it on the Serial Monitor.

Test

Sensor exposed to light:

Test_1_1
When exposed to light, around 760 is the highest value

Sensor covered

Test_1_2
When covered the value is around 10

And the value changes depending on the lighting



Tripwire Alarm v1

This project is based on the module, LASER module, a Buzzer, and a push button, the idea is very simple, the  LASER is constantly projecting light to the module sensor, when a person or something passes through the light beam, the sensor will not detect the light anymore (When the light stops, the LDR will increase resistance, which means less current will pass, and we’ll get a voltage drop).

Example: At indoor light the sensor will give a value of around “750” when using the “analogRead” function while using Arduino it’s around “3.66V” (1023 for 5V), but when you cover the sensor it will show a value around “10-15” that stands for “40mV”. So it’s better to cover or put the sensor in a case where only the LASER beams can reach.

Once the LASER beams are cut, the alarm will go off and will not stop until the push button is pressed even though the module detects the LASER again.

Wiring

 

Wiring 2.png
Buzzer with 3.3v/Gnd and I/O with D13, Laser vcc is wired with D2, and the button with D3

You can power the laser as I do or just wire it with 5v to be constantly powered on.

Code

You can download the code here, or check below:

 

Tripwire Alarm v2

The v2 is pretty much like the v1 just instead of stopping the alarm with a simple push button, now it requires a passcode entered by the keypad to stop it, otherwise it won’t.

if you’re not familiar with keypad, check this tutorial.

The passcode is stored in an array, I chose 4 digits code, you can make it longer or shorter, just modify the array size, and add or remove values.

To turn the alarm off, you should press ‘*’ on the keypad, then enter the numbers 1,3,6,6, the code will fix the buzzer in a single frequency (disturbing) sound until you enter 4 digits, if they are correct the alarm will stop, otherwise it will go off again.

Every time you enter a correct digit “a” value increases, if it’s == 4, the code is considered correct, otherwise the number will never be equal to 4.

 

Wiring

I used a 4×4 keypad matrix, you can use a 4×3 as we’re not using the last column.

Wiring 3.png
adding a keypad for the v2 version of the tripwire



Code

You can download the second code here, or check below:

 

Tests

This short video shows tests for both versions (It’s loud!!)

 

Yassine View All

Automation and Electrical Engineer, Electronics amateur trying to share my little projects.

4 thoughts on “LASER Tripwire Alarm with Arduino Leave a comment

Leave a Reply

Discover more from SURTR TECHNOLOGY

Subscribe now to keep reading and get access to the full archive.

Continue reading