Laser transmitter and receiver module with Arduino | KY-008 laser module
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.
2. Receiver module
This module includes an LDR sensor (Photoresistor). Also, we can get a digital output by focusing the laser light on it.
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.
Step 2
Secondly, connect these components. To do this, use the circuit diagram below.
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
Hello there, just became alert to your blog through Google,
and found that it’s really informative. I’m going to watch out
for brussels. I will be grateful if you continue this in future.
Numerous people will be benefited from your writing.
Cheers!
Feel free to visit my site: Good Times @ Gatwick
Thank you so much for your comments. I will continue to do so.
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
Thank you so much. I will fix it.
Howdy! I’m at work browsing your blog from my new iphone 4!
Just wanted to say I love reading through your blog and look forward to all your posts!
Carry on the superb work!
Thank you so much
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.
Thank you so much for your comment.
Thank you so much
My brother recommended I might like this website. He was entirely right.
This post actually made my day. You cann’t imagine simply how much time I
had spent for this information! Thanks!
Thank you so much. Stay with us.
Hurrah, that’s what I was exploring for, what a material! existing
here at this weblog, thanks admin of this web site.
you are welcome. Stay with us.
Usually I don’t learn post on blogs, however
I wish to say that this write-up very compelled me to try and do so!
Your writing style has been amazed me. Thanks, very great post.
Thank you so much.
Very descriptive blog, I enjoyed that a lot.
Will there be a part 2?
Thank you so much. No second part.
It’s going to be ending of mine day, but before ending I am reading this
impressive paragraph to increase my experience.
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?
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.
Thank you so much
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.
Superb, what a web site it is! This web site presents helpful information to us, keep
it up.
OK, Thanks for your feedback.
I’m gone to inform my little brother, that he should also pay a quick visit this web site on regular basis to
take updated from newest news.
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!
Thanks for your feedback
For newest news you have to pay a quick visit world wide web and on the web
I found this web site as a most excellent website for latest updates.
Thanks for your feedback
Nice response in return of this difficulty with genuine arguments
and describing everything concerning that.
Thanks for your feedback
Hello.
Hi
Hello.
In it something is. Many thanks for an explanation, now I will know.
_ _ _ _ _ _ _ _ _ _ _ _ _ _
Некулицы Иван github dev
Interesting theme, I will take part.
——
http://rajabets-in-india.com/