Introduction
This experiment demonstrates how to detect the interruption of a laser beam using a photodiode and an Arduino.

Components Needed
- Laser Pointer
- Photodiode or Phototransistor
- Arduino
- Jumper Wires
Circuit Setup
- Connect the photodiode or phototransistor to an analog pin on the Arduino (e.g., A0).
- Place the laser pointer and sensor so that the laser beam hits the sensor.
The sensor detects changes in light intensity when the laser beam is interrupted.

Code for Laser Beam Interruption Detection
Upload the following code to your Arduino to detect the interruption of the laser beam:
const int sensorPin = A0;
int sensorValue;
void setup() {
Serial.begin(9600);
}
void loop() {
sensorValue = analogRead(sensorPin);
if (sensorValue < 100) {
Serial.println("Laser Beam Interrupted!");
} else {
Serial.println("Laser Beam Intact");
}
delay(500);
}
Explanation
The photodiode detects the laser light, and the Arduino reads the intensity. When the laser beam is interrupted, the intensity drops, and the Arduino triggers a detection message.
Troubleshooting
- If the sensor is not detecting the interruption, check the alignment of the laser and sensor.
- Ensure that the photodiode is connected correctly to the Arduino.