Electronics 101 - Laser Emitter

July 16, 2018
electronics laser

Parts

  • 1x Raspberry PI
  • 1x laser emitting diode
  • 3x jumper cables

Schematics

Fritzing schematics

IC in the schematics represents the following sensor.

https://www.fasttech.com/product/1219301-keyes-ky-008-arduino-compatible-650nm-laser

Starting from left to right, connect first pin to GPIO23, second to 5V and third to GND.


Python Code

from gpiozero import LED
from time import sleep

laser_pin = 23 # BCM
timeout = 1  # seconds

laser = LED(laser_pin)

try:
    while True:
        laser.on()
        sleep(timeout)
        laser.off()
        sleep(timeout)
except KeyboardInterrupt:
    laser.off()