KY-008 Laser Transmitter Module

View on Amazon
Overview
About KY-008 Laser Transmitter Module
The KY-008 Laser Transmitter Module emits a red laser beam with a wavelength of 650 nm and an output power of 5 mW. It operates at a voltage of 5V and consumes less than 40 mA of current. The module features a 650 nm red laser diode, a resistor, and three male header pins. It is commonly used in laser pointer applications and is compatible with microcontrollers like Arduino, Raspberry Pi, and ESP32.
Get Your KY-008
Prices are subject to change. We earn from qualifying purchases as an Amazon Associate.
KY-008 Specifications
Complete technical specification details for KY-008 Laser Transmitter Module
📊 Technical Parameters
KY-008 Pinout
The **KY-008** is a 3-pin red laser transmitter module (650nm, 5mW):
Visual Pinout Diagram

Pin Types
Quick Tips
**Interface**: Digital output for laser control,🔴 **Laser**: 650nm red laser diode, 5mW output power
**Power**: 5V operation, <40mA current draw,⚠️ **Safety**: Class 2 laser - avoid direct eye exposure
**Control**: Simple digital HIGH/LOW for on/off,🎯 **Applications**: Laser pointers, alignment tools, distance measurement, optical communication
Pin Descriptions
| Pin Name | Type | Description | Notes |
|---|---|---|---|
1 Pin (S) | Communication | Signal/control pin | Digital control for laser on/off |
2 Pin (middle) | Control | Not connected | Leave unconnected (NC) |
3 Pin (-) | Power | Ground connection |
Wiring KY-008 to ESP32
To interface the **KY-008** with an **ESP32** for laser control:
Visual Wiring Diagram

Connection Status
Protocol
Pin Connections
| KY-008 Pin | Connection | ESP32 Pin | Description |
|---|---|---|---|
1 Pin (S) Required | GPIO5 | Laser control signal (any GPIO) | |
2 Pin (-) Required | GND | Ground | |
3 Pin (middle) Optional | N/C | Not connected |
**Control**: Set GPIO HIGH to turn laser on, LOW to turn off
**GPIO Selection**: Any digital GPIO pin works, GPIO5 is just an example
**Power**: Module typically powered from 5V source (separate from signal)
**Eye Safety**: Never point laser at eyes - permanent damage possible
**Duty Cycle**: Avoid continuous operation to prevent overheating
KY-008 Troubleshooting
Common issues and solutions to help you get your sensor working
Common Issues
Issue: The laser module does not emit a beam when expected.
Solutions:
- Ensure that the signal pin is connected to the correct GPIO pin on the microcontroller and is configured as an output.
- Verify that the microcontroller is supplying a HIGH signal to the laser module to activate it.
- Check all wiring connections for continuity and correctness.
- Confirm that the supply voltage is 5V as required by the module.
Issue: The laser beam is dim or flickers during operation.
Solutions:
- Ensure a stable 5V power supply to the module.
- Check for loose connections or intermittent contacts in the wiring.
- Verify that the current supplied to the module does not exceed 40 mA to prevent overheating.
Debugging Tips
Use the Serial Monitor to check for error messages and verify the sensor's output. Add debug prints in your code to track the sensor's state.
Use a multimeter to verify voltage levels and check for continuity in your connections. Ensure the power supply is stable and within the sensor's requirements.
Additional Resources
KY-008 Programming Examples
Ready-to-use code examples for different platforms and frameworks
int laserPin = 13;
void setup() {
pinMode(laserPin, OUTPUT);
}
void loop() {
digitalWrite(laserPin, HIGH); // Turn on the laser
delay(1000); // Wait for one second
digitalWrite(laserPin, LOW); // Turn off the laser
delay(1000); // Wait for one second
}This Arduino code controls the KY-008 laser module connected to digital pin 13. It turns the laser on for one second and then off for one second, creating a blinking effect.
#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "driver/gpio.h"
#define LASER_PIN GPIO_NUM_5
void app_main(void) {
gpio_pad_select_gpio(LASER_PIN);
gpio_set_direction(LASER_PIN, GPIO_MODE_OUTPUT);
while (1) {
gpio_set_level(LASER_PIN, 1); // Turn on the laser
vTaskDelay(1000 / portTICK_PERIOD_MS); // Wait for one second
gpio_set_level(LASER_PIN, 0); // Turn off the laser
vTaskDelay(1000 / portTICK_PERIOD_MS); // Wait for one second
}
}This ESP-IDF code configures GPIO5 as an output to control the KY-008 laser module. It turns the laser on for one second and off for one second in a loop, creating a blinking effect.
switch:
- platform: gpio
pin: GPIO5
name: "KY-008 Laser"
id: laser_switchThis ESPHome configuration sets up a switch to control the KY-008 laser module connected to GPIO5. The laser can be turned on and off via the defined switch entity.
platformio.ini
[env:esp32]
platform = espressif32
board = esp32dev
framework = arduinomain.cpp
#include <Arduino.h>
#define LASER_PIN 5
void setup() {
pinMode(LASER_PIN, OUTPUT);
}
void loop() {
digitalWrite(LASER_PIN, HIGH); // Turn on the laser
delay(1000); // Wait for one second
digitalWrite(LASER_PIN, LOW); // Turn off the laser
delay(1000); // Wait for one second
}This PlatformIO code initializes GPIO5 as an output to control the KY-008 laser module. It toggles the laser on and off every second, creating a blinking effect.
import machine
import time
LASER_PIN = machine.Pin(5, machine.Pin.OUT)
while True:
LASER_PIN.value(1) # Turn on the laser
time.sleep(1) # Wait for one second
LASER_PIN.value(0) # Turn off the laser
time.sleep(1) # Wait for one secondThis MicroPython script sets up the KY-008 laser module on GPIO5 and toggles it on and off every second, producing a blinking effect.
Wrapping Up KY-008
The ESP32 KY-008 Laser Transmitter Module is a powerful KY-0xx module sensor that offers excellent performance and reliability. With support for multiple development platforms including Arduino, ESP-IDF, ESPHome, PlatformIO, and MicroPython, it's a versatile choice for your IoT projects.
Best Practices
For optimal performance, ensure proper wiring and follow the recommended configuration for your chosen development platform.
Safety First
Always verify power supply requirements and pin connections before powering up your project to avoid potential damage.
Ready to Start Building?
Now that you have all the information you need, it's time to integrate the KY-008 into your ESP32 project and bring your ideas to life!








