Laser Transmitter And Receiver Module With Arduino - SriTu Hobby

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.

  • Arduino UNO board x 1 –> Our Store / Amazon
  • Laser module x 1 –> Our Store / Amazon
  • LED x 1 –> Our Store / Amazon
  • 180 ohm resistor x 1 –> Our Store / Amazon
  • Buzzer x 1 –> Our Store / Amazon
  • Jumper wires –> Our Store / Amazon
  • Breadboard x 1 –>Our Store / Amazon

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

Step 1

Firstly, identify these components.

Laser transmitter and receiver module with arduino
Laser module
How to make a line follower robot using Arduino and L298N
Arduino UNO board
LED bulb
180 ohm resistor
Buzzer
Jumper wires
Breadboard

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

Tag » Arduino Ky-008 Laser Sensor Module