Index

Introduction
The KY-008 laser module emits a focused red laser beam. The LDR (Light Dependent Resistor) detects light intensity. When the laser beam falls directly on the LDR, the resistance of the LDR is low. If something interrupts the beam, the LDR’s resistance increases — which can be used to trigger alarms or actions.
Required Components
- Arduino UNO
- Laser Module
- LDR Sensor Module
- Jumper wires
- Breadboard
Pinout
Laser Module

Circuit Diagram / Wiring
- Laser Module with Arduino
- Laser VCC → 5V (Arduino)
- Laser GND → GND (Arduino)
- Laser Signal → D7 (Arduino)
- LDR Module with Arduino
- LDR VCC → 5V (Arduino)
- LDR GND → GND (Arduino)
- LDR A0 → A0 (Arduino)

Arduino Code / Programming
int laserPin = 7; // Laser KY-008
int ldrPin = A0; // LDR sensor module
void setup() {
pinMode(laserPin, OUTPUT);
Serial.begin(9600);
}
void loop() {
digitalWrite(laserPin, HIGH); // Turn on laser
int ldrValue = analogRead(ldrPin);
Serial.print("LDR Value: ");
Serial.println(ldrValue);
// Example: If laser is blocked
if (ldrValue < 500) {
Serial.println("Laser beam interrupted!");
}
delay(200);
}
Explanation
- The KY-008 Laser Module emits a focused laser beam that can be aligned directly onto an LDR sensor.
- The LDR sensor detects light intensity; when the laser is blocked, its resistance increases and the analog value drops.
- The Arduino Uno reads the LDR value to detect if the laser beam is interrupted, triggering actions like alarms.
Troubleshooting
- Ensure the laser beam is perfectly aligned with the LDR sensor for consistent detection.
- Check that the KY-008 is connected properly (signal to digital pin, middle to 5V, and GND to GND).
- If LDR readings don’t change, verify the analog readings in Serial Monitor and adjust the threshold value in the code.