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

36 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

  2. Hello there I am so delighted I found your weblog, I really found you by error, while I was searching on Bing for something else,
    Anyhow I am here now and would just like to say
    thank you for a tremendous post and a all round enjoyable blog (I
    also love the theme/design), I don’t have time to look over it all at the
    moment but I have book-marked it and also
    added in your RSS feeds, so when I have time I will be back to read
    a great deal more, Please do keep up the great jo.

  3. I was curious if you ever thought of changing the
    structure of your website? Its very well written; I love what youve got to say.
    But maybe you could a little more in the way of
    content so people could connect with it better.
    Youve got an awful lot of text for only having 1
    or two pictures. Maybe you could space it out better?

  4. Greate article. Keep posting such kind of information on your page.
    Im really impressed by your blog.
    Hey there, You’ve done a great job. I will certainly digg it
    and in my opinion recommend to my friends. I’m confident they’ll be benefited from this
    site.

  5. What’s Going down i’m new to this, I stumbled upon this I have discovered It positively useful and it has helped me out
    loads. I hope to give a contribution & aid different users
    like its aided me. Great job.

  6. Greetings from Ohio! I’m bored to death at work so I decided to browse your site
    on my iphone during lunch break. I really like the
    info you present here and can’t wait to take a look when I
    get home. I’m surprised at how fast your blog loaded on my cell phone
    .. I’m not even using WIFI, just 3G .. Anyways, very good blog!

  7. In it something is. Many thanks for an explanation, now I will know.

    _ _ _ _ _ _ _ _ _ _ _ _ _ _
    Некулицы Иван github dev

Leave a Reply

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