Skip to content

100 units will be available shortly.

Express post shipping available (product is on backorder)
Laser Detector Module
Want to set up your own laser tripwire? These little modules make it super simple. Just hook one up to your Arduino, line it up with a laser pointer, and you’ve got a working laser detection system. Add a buzzer or LED and it’ll trigger the moment someone breaks the beam. Perfect for security projects, spy gadgets, or just a fun electronics experiment.


Here is some quick code to get you up and running.  Shine a laser at the Sensor

Add power to 5V to VCC, Ground to GND and plug your middle pin into D2

Add a Buzzer on D8 and GND



// --- Pins ---
const int RX_DO_PIN   = 2;   // Receiver DO -> D2
const int LED_PIN     = 13;  // On-board LED for feedback
const int BUZZER_PIN  = 8;   // Active buzzer -> D8

// --- Tuning ---
const unsigned long STABLE_MS = 40;  // require this much stable time to accept change
const unsigned long POLL_MS   = 2;   // sampling interval

// Set this to true if your module needs a pull-up (some boards are open-collector)
const bool USE_INPUT_PULLUP = true;

void setup() {
  if (USE_INPUT_PULLUP) {
    pinMode(RX_DO_PIN, INPUT_PULLUP);
  } else {
    pinMode(RX_DO_PIN, INPUT);
  }
  pinMode(LED_PIN, OUTPUT);
  pinMode(BUZZER_PIN, OUTPUT);
  digitalWrite(BUZZER_PIN, LOW);   // buzzer off
  Serial.begin(115200);
}

// Helper to read "laser seen?" abstracting the optional inversion
bool rawLaserSeen() {
  int v = digitalRead(RX_DO_PIN);
  if (USE_INPUT_PULLUP) {
    return (v == LOW);   // LOW means detected when pull-up is used
  } else {
    return (v == HIGH);  // HIGH means detected on actively-driven outputs
  }
}

void loop() {
  static bool stableState = false;     // debounced belief
  static bool lastSample  = false;     // last raw sample
  static unsigned long lastChangeMs = 0;

  bool sample = rawLaserSeen();

  if (sample != lastSample) {
    lastSample = sample;
    lastChangeMs = millis();           // raw level changed; restart stability timer
  }

  if ((millis() - lastChangeMs) >= STABLE_MS && sample != stableState) {
    stableState = sample;

    if (stableState) {
      Serial.println("Laser detected");
      digitalWrite(LED_PIN, HIGH);
      digitalWrite(BUZZER_PIN, LOW);   // <<< turn buzzer on
    } else {
      Serial.println("No laser");
      digitalWrite(LED_PIN, LOW);
      digitalWrite(BUZZER_PIN, HIGH);    // <<< turn buzzer off
    }
  }

  delay(POLL_MS);
}

The Laser Detector module appears in the following collections:

SKU LB-LS1177

Customer Reviews

Be the first to write a review
0%
(0)
0%
(0)
0%
(0)
0%
(0)
0%
(0)