Arduino Laser System-Tripwire Tutorial

Introduction: Arduino Laser System-Tripwire Tutorial

I made it using an Arduino, a laser diode, a photocell (light dependent resistor) and a piezo buzzer.

Code :

const int PHOTOCELL_PIN = A0;
const int BUZZER_PIN = 3;
// voltage readings are in 0-1023 range
const int THRESHOLD = 500;

void setup() {

long alarmEndTime = 0;

void loop() {
  int level = analogRead(PHOTOCELL_PIN);
  long time = millis();
  if (time < alarmEndTime) {
    long timeLeft = alarmEndTime - time;
    if (timeLeft % 1000 > 300) {
      tone(BUZZER_PIN, 4000);
    } else {
  } else {
    if (level < THRESHOLD) {
      alarmEndTime = time + 3000;




    • Water Contest

      Water Contest
    • Fix It! Contest

      Fix It! Contest
    • Metalworking Contest

      Metalworking Contest

    2 Discussions

    Isn't this more of a "light alarm," rather than a "laser trip wire?"

    1 reply

    It looks fine to me. When the beam is interrupted, an alert sounds. Laser trip wire. I think I'll be adding one of these to my laser work area. With the compressor and exhaust fan noise, I never hear people approach. A few mirrors should suffice for a single laser to cover 3 sides of a 12' perimeter. An LED at eye level, to supplement the audible alert, and I should be all set.