Arduino IR Sensor Module
Arduino IR Proximity Sensor:
Welcome Back to the Arduino learn by doing projects Tutorial series. Our task for today is IR sensor Module the obstacle detecting module with Arduino. I found this module very helpful in many projects. I extremely recommend this if you are making Line following Robot.It has a quite good response and easy to interface. Instead of making circuits with IR led’s use this module and easily interface with Arduino. I have made a very clean Robot using IR sensor module you can see in this post.
Arduino smart and fast line following Robot
The IR module is more useful because we can also use this module to measure distance. More importantly, it can be used as an encoder, flame sensor, line black and white color detection.
The working phenomenon of IR module is same as the other obstacle avoiding sensors of sending and receiving signals.
so let’s start with the Contents list:
Contents:
- Introduction to IR proximity module
- Working principle of IR module
- Components list
- Circuit Diagram of IR module with Arduino
- Arduino code
Introduction to IR proximity Sensor Module
Working Principle of IR Module
Components List
- 1x Arduino board UNO (any Arduino board)
- 1x Arduino IR sensor Module
- Jumper wires
- Bread board
Circuit Diagram
- Connect positive VCC to Arduino 5v and negative Gnd to Arduino Gnd
- Connect out pin to any Arduino digital pin / for analog output connect to Arduino analog A0-A5
Arduino Code
const int IrSensor=2; void setup() { pinMode(13, OUTPUT); pinMode(IrSensor,INPUT); } void loop() { if(digitalRead(IrSensor)==HIGH) //Check the sensor output { digitalWrite(13, HIGH); // set the LED on } else { digitalWrite(13, LOW); } delay(100); }
This is the simplest code whenever an object comes closer to the sensor the built in Led on Arduino board will blink.we will see some of the cool projects with IR modules in coming posts.
Get connected with us and Subscribe to our YouTube channel for video Tutorials.
Here is the Picture of my Line following Robot using IR modules.
Stay motivated and Happy.