Close Menu
  • Articles
    • Learn Electronics
    • Product Review
    • Tech Articles
  • Electronics Circuits
    • 555 Timer Projects
    • Op-Amp Circuits
    • Power Electronics
  • Microcontrollers
    • Arduino Projects
    • STM32 Projects
    • AMB82-Mini IoT AI Camera
    • BLE Projects
  • IoT Projects
    • ESP8266 Projects
    • ESP32 Projects
    • ESP32 MicroPython
    • ESP32-CAM Projects
    • LoRa/LoRaWAN Projects
  • Raspberry Pi
    • Raspberry Pi Projects
    • Raspberry Pi Pico Projects
    • Raspberry Pi Pico W Projects
  • Electronics Calculator
Facebook X (Twitter) Instagram
  • About Us
  • Disclaimer
  • Privacy Policy
  • Contact Us
  • Advertise With Us
Facebook X (Twitter) Instagram Pinterest YouTube LinkedIn
How To Electronics
  • Articles
    • Learn Electronics
    • Product Review
    • Tech Articles
  • Electronics Circuits
    • 555 Timer Projects
    • Op-Amp Circuits
    • Power Electronics
  • Microcontrollers
    • Arduino Projects
    • STM32 Projects
    • AMB82-Mini IoT AI Camera
    • BLE Projects
  • IoT Projects
    • ESP8266 Projects
    • ESP32 Projects
    • ESP32 MicroPython
    • ESP32-CAM Projects
    • LoRa/LoRaWAN Projects
  • Raspberry Pi
    • Raspberry Pi Projects
    • Raspberry Pi Pico Projects
    • Raspberry Pi Pico W Projects
  • Electronics Calculator
How To Electronics
Home » Laser Light Security System with Raspberry Pi Pico & LDR
Raspberry Pi Raspberry Pi Pico Projects

Laser Light Security System with Raspberry Pi Pico & LDR

Mamtaz AlamBy Mamtaz AlamUpdated:September 30, 20221 Comment3 Mins Read
Share Facebook Twitter LinkedIn Telegram Reddit WhatsApp
Laser Light Security System with Raspberry Pi Pico
Share
Facebook Twitter LinkedIn Pinterest Email Reddit Telegram WhatsApp

Overview

In this project, we have designed Laser Light Security System Using Raspberry Pi Pico Board & LDR module. The project idea revolves around creating a security system. Whenever any object will obstruct the LASER ray the RGB LED will start blinking.

When you start the program, RGB LED initially displays green. We use the red laser emitter to aim at the LDR Light sensor and start timing. When it locks on the target (Light sensor), the RGB flashes red and blue, and stops timing.

This project can be implemented anywhere, not only in buildings or premises but many precious things like jewelry, diamonds, precious antique items in the museum, etc many other things are also secured using such an invisible LASER beam. Many people secure their homes, office, shops, warehouses, etc with the LASER beam security system. You can also make Anti-Theft Alarm project using Raspberry Pi Pico.


Components Required

In this guide, I used Elecrow Raspberry Pi Pico Starter Kit to test different Modules. You can buy the kit and perform some other operations as well. From this kit, you can use the following components.

1. Raspberry Pi Pico Board -1
2. Laser Light Module – 1
3. LDR Sensor Module – 1
4. RGB LED Module – 1
5. Breadboard -1
6. Jumper Wires – 10
7. Micro-USB Cable




Laser Light Module

The laser Transmitter module emits a dot-shaped, red laser beam. The Laser transmitter module consists of a 650nm red laser diode head and a resistor. Handle with caution, do not look directly into the laser head.

The specification of Laser Transmitter Module KY-008 is as follows:

  • Operating Voltage – 5V
  • Output Power – 5mW
  • Wavelength – 650nm
  • Operating Current – less than 40mA
  • Working Temperature – -10°C ~ 40°C [14°F to 104°F]
  • Dimensions – 18.5mm x 15mm

Circuit Diagram & Hardware Setup

Here is a simple connection diagram for Laser Light Security System with Raspberry Pi Pico & LDR.

Laser Light Security Raspberry Pi Pico

Connect the R, G & B Pin of the RGB LED to Raspberry Pi Pico GP2, GP3 & GP4 Pin respectively. Connect the GND Pin of RGB LED to Pico GND Pin.

Connect the LDR Sensor Module to GP0 of Raspberry Pi Pico. Also, connect the output of the Laser Module to GP5 of Raspberry pi Pico. Connect their VCC & GND Pin to 5V (VBUS) & GND Pin of Pico respectively.


MicroPython Code/Program

Open your Thonny IDE & Copy the following code & paste it to the editor window.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
from machine import Pin,ADC,PWM
from time import sleep
 
photo = 0               # ADC0 multiplexing pin is GP26
LaserPin = 5           #Red laser transmitter
Led_R = PWM(Pin(2))
Led_G = PWM(Pin(3))
Led_B = PWM(Pin(4))
Led_R.freq(2000)  
Led_G.freq(2000)  
Led_B.freq(2000)  
 
def setup():
    global Laser
    global photo_ADC
    photo_ADC = ADC(photo)
    Laser = Pin(LaserPin,machine.Pin.OUT)
    Laser.value(0)
 
def loop():
    aim_time = 0
    while True:  
        Laser.value(1)
        Led_R.duty_u16(0)
        Led_G.duty_u16(65535)
        Led_B.duty_u16(0)
        
        print("time:",aim_time)
        sleep(0.1)
        aim_time += 0.1
        if photo_ADC.read_u16() < 15000:     # Hit by a red laser, the light flashes
            print("Aimed:",aim_time)
            aim_time = 0
            for i in range(10):
                Led_R.duty_u16(65535)       # red light
                Led_G.duty_u16(0)
                Led_B.duty_u16(0)
                sleep(0.1)  
                Led_R.duty_u16(0)          
                Led_G.duty_u16(0)
                Led_B.duty_u16(65535)       # blue light
                sleep(0.1)
            sleep(2)
 
if __name__ == '__main__':
    setup()
    loop()  


Now you can run this code to test the working of the circuit.

Aim the Laser Light at LDR so that red light will always fall on LDR Module. At this moment the green light of the RGB LED will turn on.

When there is any interruption detected or when the laser light is blocked by falling on LDR, the RGB LED will blink red & blue.


Working of Laser Light Security System

The project basically works on the principle of interruption. If by any means the LASER light is interrupted the LED start flashing. The laser is a concentrated light source that puts out a straight beam of light of a single color.

Laser Light Security System Using Arduino wih Alarm

The LDR is sensitive to light and puts out a voltage when the laser light hits it. When the laser beam is interrupted and can’t reach LDR, its voltage output changes, and eventually the LED will flash.

Share. Facebook Twitter Pinterest LinkedIn Tumblr Email Reddit Telegram WhatsApp
Previous ArticleDark Activated Night Lamp using LDR & Raspberry Pi Pico
Next Article Using 7-Segment Display TM1637 with Raspberry Pi Pico

Related Posts

ADXL375 Accelerometer with Raspberry Pi Pico & MicroPython

ADXL375 Accelerometer with Raspberry Pi Pico & MicroPython

Updated:July 24, 2025
Interface BMI160 with Raspberry Pi Pico & MicroPython

Interface BMI160 with Raspberry Pi Pico & MicroPython

Updated:February 2, 20253K
Shift Register 74HC595 with Raspberry Pi Pico & MicroPython

Shift Register 74HC595 with Raspberry Pi Pico & MicroPython

Updated:February 2, 202513K
Interfacing XBee Module with Raspberry Pi Pico & MicroPython

Interfacing XBee Module with Raspberry Pi Pico & MicroPython

Updated:February 2, 20253K
Modbus RTU with Raspberry Pi Pico & Micropython

Modbus RTU with Raspberry Pi Pico & MicroPython

Updated:February 2, 20258K
Fever Detector with MLX90640 & OpenCV Raspberry Pi

Thermal Fever Detector with MLX90640 & OpenCV Raspberry Pi

Updated:February 2, 20256K
View 1 Comment

1 Comment

  1. Tutu on December 21, 2022 10:26 AM

    can you give me the program in a circuit python one?

    Reply

CommentsCancel reply

Latest Posts
ESP32 Fingerprint Attendance System with Live Web Dashboard

ESP32 Fingerprint Attendance System with Live Web Dashboard

June 21, 2026
IoT Based PM & Air Quality Monitoring System using ESP32

IoT Based PM & Air Quality Monitoring System using ESP32

June 14, 2026
DIY ESP32 MLX90640 IR Thermal Camera with Live Web Display

DIY ESP32 MLX90640 IR Thermal Camera with Live Web Display

May 10, 2026
IoT Activity Tracker with ESP32 & Accelerometer Gyroscope

IoT Activity Tracker with ESP32 & Accelerometer/Gyroscope

May 2, 2026
A Guide to Sourcing Obsolete ICs for Vintage Projects

Beyond AliExpress: A Guide to Sourcing Obsolete ICs for Vintage Projects

April 21, 2026

ESP32 IoT Vehicle Motion Analyzer with MPU6050 & LIS3MDL

April 27, 2026
Building a Smart Sensor Node with a BLE Microcontroller

Building a Smart Sensor Node with a BLE Microcontroller

February 26, 2026
High-Accuracy Pitch, Roll, Yaw with ESP32 & BNO08x IMU

High-Accuracy Pitch, Roll, Yaw with ESP32 & BNO08x IMU

April 27, 2026
Top Posts & Pages
  • ESP32 Fingerprint Attendance System with Live Web Dashboard
    ESP32 Fingerprint Attendance System with Live Web Dashboard
  • IoT AC Energy Meter with PZEM-004T & ESP32 WebServer
    IoT AC Energy Meter with PZEM-004T & ESP32 WebServer
  • 12V DC to 220V AC Inverter Circuit & PCB
    12V DC to 220V AC Inverter Circuit & PCB
  • How to use Modbus RTU with ESP32 to read Sensor Data
    How to use Modbus RTU with ESP32 to read Sensor Data
  • ESP32 CAN Bus Tutorial | Interfacing MCP2515 CAN Module with ESP32
    ESP32 CAN Bus Tutorial | Interfacing MCP2515 CAN Module with ESP32
  • How to use INA226 DC Current Sensor with Arduino
    How to use INA226 DC Current Sensor with Arduino
  • Buck Converter: Basics, Working, Design & Application
    Buck Converter: Basics, Working, Design & Application
  • IoT Based ECG Monitoring with AD8232 ECG Sensor & ESP32
    IoT Based ECG Monitoring with AD8232 ECG Sensor & ESP32
Categories
  • Arduino Projects (197)
  • Articles (60)
    • Learn Electronics (19)
    • Product Review (15)
    • Tech Articles (28)
  • Electronics Circuits (46)
    • 555 Timer Projects (21)
    • Op-Amp Circuits (7)
    • Power Electronics (13)
  • IoT Projects (205)
    • ESP32 MicroPython (7)
    • ESP32 Projects (82)
    • ESP32-CAM Projects (15)
    • ESP8266 Projects (76)
    • LoRa/LoRaWAN Projects (22)
  • Microcontrollers (38)
    • AMB82-Mini IoT AI Camera (4)
    • BLE Projects (18)
    • STM32 Projects (19)
  • Raspberry Pi (93)
    • Raspberry Pi Pico Projects (57)
    • Raspberry Pi Pico W Projects (12)
    • Raspberry Pi Projects (24)
Follow Us
  • Facebook
  • Twitter
  • Pinterest
  • Instagram
  • YouTube
About Us

“‘How to Electronics’ is a vibrant community for electronics enthusiasts and professionals. We deliver latest insights in areas such as Embedded Systems, Power Electronics, AI, IoT, and Robotics. Our goal is to stimulate innovation and provide practical solutions for students, organizations, and industries. Join us to transform learning into a joyful journey of discovery and innovation.

Copyright © How To Electronics. All rights reserved.
  • About Us
  • Disclaimer
  • Privacy Policy
  • Contact Us
  • Advertise With Us

Type above and press Enter to search. Press Esc to cancel.

Ad Blocker Enabled!
Ad Blocker Enabled!
Looks like you're using an ad blocker. Please allow ads on our site. We rely on advertising to help fund our site.