Laser transmitter and receiver module with Arduino | KY-008 laser module

Laser transmitter and receiver module with arduino

Hello, welcome back to another tutorial from the SriTu Hobby. In this tutorial, we will learn how the laser module works with the Arduino. Also, today we are going to talk about a laser module called KY-008. We can buy this module in the market at a low cost. Also, this module can be used primarily to build security systems, remote signal detection systems, and interesting designs. Remember to take care of your eyes when doing these laser light-related projects. So, keep these away from small children. Okay, keep reading.

This module consists of two main parts. That is,

1. Laser module

It has a visible red light and is rated at 100 mW. Also, this can be activated by giving us a 5v potential.

Laser transmitter and receiver module with arduino

2. Receiver module

This module includes an LDR sensor (Photoresistor). Also, we can get a digital output by focusing the laser light on it.

Laser transmitter and receiver module with arduino

The PIN structure of this module

Okay, let’s learn step by step how this module works with Arduino. The required components are as follows.

Disclosure: These Amazon links are Affiliate links. As an Amazon Associate, I earn from qualifying purchases.

Step 1

Firstly, identify these components.

Step 2

Secondly, connect these components. To do this, use the circuit diagram below.

Laser transmitter and receiver module with arduino

Step 3

Thirdly, let’s create the program for this project. It is as follows. Also, we can use this code for security systems.

  • The complete program of this project – Download
/*Laser module with Arduino.
 * https://srituhobby.com
 */
 
#define laser 2
#define sensor 3
#define LED 4
#define buzzer 5

void setup() {
  Serial.begin(9600);
  pinMode(laser, OUTPUT);
  pinMode(sensor, INPUT);
  pinMode(LED, OUTPUT);
  pinMode(buzzer, OUTPUT);

  digitalWrite(laser, HIGH);
}

void loop() {
  bool value = digitalRead(sensor);

  if (value == 0) {
    digitalWrite(LED, HIGH);
    digitalWrite(buzzer, HIGH);
  } else {
    digitalWrite(LED, LOW);
    digitalWrite(buzzer, LOW);
  }
}

Code explanation

Firstly, the laser module, receiver module, LED, and buzzer pins are defined.

#define laser 2
#define sensor 3
#define LED 4
#define buzzer 5

In the setup function, those pins are set as input and output. Also, the laser module is activated.

void setup() {
  Serial.begin(9600);
  pinMode(laser, OUTPUT);
  pinMode(sensor, INPUT);
  pinMode(LED, OUTPUT);
  pinMode(buzzer, OUTPUT);

  digitalWrite(laser, HIGH);
}

In the loop function, the receiver values are taken and put into the Boolean variable. Also, these values are checked using the IF condition. If the value is 0, the turns ON the LED and buzzer. If the value is 1, the turns OFF the LED and buzzer.

void loop() {
  bool value = digitalRead(sensor);

  if (value == 0) {
    digitalWrite(LED, HIGH);
    digitalWrite(buzzer, HIGH);
  } else {
    digitalWrite(LED, LOW);
    digitalWrite(buzzer, LOW);
  }
}

Step 4

Lastly, select the board and port. After, upload this code to the Arduino board.

OK, enjoy this tutorial. The full video guide is given below. So, we will meet in the next tutorial.

Laser transmitter and receiver module with Arduino | KY-008 laser module

Similar Posts

4 Comments

  1. I am really enjoying the theme/design of your web site.

    Do you ever run into any web browser compatibility problems?
    A small number of my blog readers have complained
    about my site not working correctly in Explorer but looks great in Opera.

    Do you have any solutions to help fix this problem?

    My blog; Good Times @ Gatwick

Leave a Reply

Your email address will not be published. Required fields are marked *