Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A simple Arduino laser tripwire detects when an object blocks a beam and then activates a buzzer or LED. An LDR (photoresistor) aimed at the laser feeds light measurements to an Arduino analog input; the sketch compares those readings with a threshold you calibrate for your setup.

How the Arduino laser alarm works

With the laser aimed at the LDR, the sensor’s resistance—and therefore the voltage read at the Arduino input—reflects the light reaching it. The Arduino repeatedly samples that input with analogRead(). When blocking the beam moves the reading across a chosen threshold, the sketch can sound a buzzer with tone() or switch on an LED. When the beam is restored, the sketch can stop the sound with noTone().

The trigger direction depends on the circuit and sensor readings: blocking the beam might make the analog value rise or fall. Use measured values to determine which comparison to use rather than assuming the blocked state always has a lower number.

Parts you need

  • An Arduino-compatible board
  • A photoresistor (LDR) and a 10 kΩ resistor, or an LDR module with an analog output
  • A low-power laser pointer or laser module
  • A piezo buzzer
  • A breadboard and jumper wires
  • An LED, optional, for a visual alarm
  • A pushbutton, optional, if you want a resettable or latched alarm

Choose an LDR wiring option

Approach Wiring Divider resistor Analog reading
Bare LDR Build a voltage divider and connect its junction to A0. One documented example places a 10 kΩ resistor between the sensor input junction and ground. Required as a separate component in the divider. Read the junction with analogRead(A0).
LDR module Connect the module’s analog output to an Arduino analog input and make the required power and ground connections for that module. May be included on the module; check its wiring or documentation. Use the module’s analog output for the reading.

These are documented wiring approaches, not a controlled performance comparison. The bare sensor needs the divider circuit; a module can simplify the interface, but its exact pinout and included components depend on the module.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Acxico 2Sets Laser Sensor Module For Arduino AVR(KY-008 Laser Transmitter +Laser Receiver Sensor Module Non-modulator Tube)
  • Operating voltage: 5V
  • Source wavelength: 650 nm
  • Apply to: for Arduino AVR
  • Model: 1*Laser Receiver Sensor Module+ 1* KY-008 Laser Transmitter Module
  • Laser Receiver Sensor Module uses the non modulated laser receiver, please use in the room where without the light, the sunlight or other lamps and lanterns will interfere, suggested in the dark environment use.

Build and calibrate the alarm

  1. Wire the sensor. For a bare LDR, make a voltage divider and connect the junction to A0. For an LDR module, connect its analog output to A0 and follow the module’s power and ground requirements. Connect the buzzer and optional LED to Arduino output pins, observing the components’ connection requirements.
  2. Align the beam. Place the laser so its spot falls on the LDR. Keep the sensor and laser steady while you take readings.
  3. Read both states. Upload a small sketch that prints analogRead(A0) to the Serial Monitor. Note the readings with the beam reaching the sensor and with the beam blocked.
  4. Set a threshold between the states. Choose a value that separates the two observed ranges. If the readings overlap or vary, improve alignment or reduce changing ambient light before relying on a single threshold.
  5. Trigger the output. In the main loop, read A0 and compare it with the calibrated threshold. When the reading indicates a blocked beam, activate the buzzer with tone() and/or turn on the LED; when the beam is intact, stop the buzzer with noTone() and return the indicator to its normal state.
  6. Test the complete setup. Block and restore the beam repeatedly, then check that the alarm changes state as intended under the lighting conditions where you plan to use it.

Why example thresholds are not interchangeable

Arduino hobby projects show different settings: one uses a threshold of 800, while another gives 400 as a sensitivity setting. These are example code values, not performance specifications or universal defaults. LDR characteristics, divider orientation, laser output, alignment, and surrounding light all affect the Arduino reading. Calibrate your own circuit using the Serial Monitor rather than copying either number.

Optional: make the alarm latch until reset

A basic sketch can sound only while the beam is blocked. To keep the alarm active after the beam returns, add a latched state and a pushbutton to clear it. That behavior is a design choice, not a requirement of the basic tripwire. Decide whether you want automatic recovery or manual reset before adding the button and changing the sketch.

Rank #2
Ferwooh 5PCS Laser Sensor Module Non-Modulator Tube Receiver Output High Level + 5PCS KY-008 650nm Laser Sensor Module
  • 【Laser Sensor Module】Size: 1.52CM * 2.22CM; Power supply voltage: 5V;Output:When the laser output it's High level; when no laser light output it's low level;
  • 【Laser Sensor Module】This sensor uses a non-modulated laser receiver, please use on the room which is dark.the sun or other lighting will interfere the using of the product.suggest use in a dark environment.
  • 【Laser Head】Operating voltage: 5V; Power: 5MW; wavelength: 650 nm; OD: 6mm
  • 【Laser Head】This 5V laser head is very easy to use, you can use for Arduino control, controllable laser pointer, theft detection, etc. interesting application devices.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What this project can—and cannot—show

This is a learning project for detecting a change in light at an LDR. The cited examples do not establish a reliable detection distance, response time, false-alarm rate, or suitability as a security product. A threshold-based hobby circuit can be affected by alignment and ambient light, so treat its behavior as setup-dependent rather than guaranteed.

Use a laser cautiously: do not aim it at anyone’s eyes or at reflective surfaces that could redirect the beam. The project examples do not establish a laser classification or compliance with a safety standard.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Quick Recap

Bestseller No. 1
Acxico 2Sets Laser Sensor Module For Arduino AVR(KY-008 Laser Transmitter +Laser Receiver Sensor Module Non-modulator Tube)
Acxico 2Sets Laser Sensor Module For Arduino AVR(KY-008 Laser Transmitter +Laser Receiver Sensor Module Non-modulator Tube)
Operating voltage: 5V; Source wavelength: 650 nm; Apply to: for Arduino AVR; Model: 1*Laser Receiver Sensor Module+ 1* KY-008 Laser Transmitter Module
$7.49
Bestseller No. 2
Ferwooh 5PCS Laser Sensor Module Non-Modulator Tube Receiver Output High Level + 5PCS KY-008 650nm Laser Sensor Module
Ferwooh 5PCS Laser Sensor Module Non-Modulator Tube Receiver Output High Level + 5PCS KY-008 650nm Laser Sensor Module
【Laser Head】Operating voltage: 5V; Power: 5MW; wavelength: 650 nm; OD: 6mm
$8.95
Bestseller No. 3
Bestseller No. 4
Yuuhseel 4 Sets DC 5V 3 Pins 650nm Copper Head Laser Sensor Transmitter Module + Non-Modulator Tube Laser Receiver Detection Module Compatible with Arduino
Yuuhseel 4 Sets DC 5V 3 Pins 650nm Copper Head Laser Sensor Transmitter Module + Non-Modulator Tube Laser Receiver Detection Module Compatible with Arduino
Operating voltage: 5V, Output wavelength 650nm; It output high level when receive laser signal, and low level when not.
$11.99
Bestseller No. 5
DEVMO 5PCS 5V Sensor Module Board Compatible with Ar-duino AVR PIC KY-008 Laser Transmitter Wave Length 650 nm
DEVMO 5PCS 5V Sensor Module Board Compatible with Ar-duino AVR PIC KY-008 Laser Transmitter Wave Length 650 nm
★Operating voltage: 5V; ★Output wavelength 650 nm; ★3 pins module; ★With fixed bolt hole for easy installation
$11.99
Best Value
DEVMO 5PCS 5V Sensor Module Board Compatible with Ar-duino AVR PIC KY-008 Laser Transmitter Wave Length 650 nm
  • ★Operating voltage: 5V
  • ★Output wavelength 650 nm
  • ★3 pins module
  • ★With fixed bolt hole for easy installation
  • ★Package Includes:5PCS Sensor Module Board
Rank #4
Yuuhseel 4 Sets DC 5V 3 Pins 650nm Copper Head Laser Sensor Transmitter Module + Non-Modulator Tube Laser Receiver Detection Module Compatible with Arduino
  • Operating voltage: 5V, Output wavelength 650nm
  • It output high level when receive laser signal, and low level when not.
  • High sensitivity, can be received on the front, side, and back sides.
  • Laser Receiver Sensor Module uses the non modulated laser receiver, please use in the room where without the light, the sunlight or other lamps and lanterns will interfere, suggested in the dark environment use.
  • Can be use for Arduino control, doing controllable laser pointer, theft detection, etc. interesting application devices.
Rank #3
Ximimark 5Pcs Laser Sensor Module Non-Modulator Tube Laser Receiver Detection Module Relay Switch 5V for Arduino
  • Supply voltage: 5V
  • Output: High level when there is laser irradiation, low level when there is no laser irradiation.
  • This sensor uses a non-modulated laser receiver. Please use it in a place where there is no light indoors. Sunlight or other lamps may interfere. It is recommended to use it in a dark environment.
  • Size: 1.52CM*2.22CM (1CM=0.393inch)
  • We highly appreciate all customers opinions to improve the selling, also if anything you unsatisfied, please contact us for probable best solution.

Sources and project examples

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.