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, you can get the module 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.

Grove Light Sensor v1.2




Interfacing the module

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 tought, the output signal changes depending on the light detected.


Wiring 1.png
5V/GND and Sign with A0


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


When exposed to light, around 760 is the highest value
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 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.


You can download the code here.


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 chosed 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 considred correct, otherwise the number will never be equal to 4.



Wiring 3.png
I used a 4*4 keypad matrix you can use 3*4


You can download the second code here.


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.

Leave a Reply

%d bloggers like this: