/ Saturday 8 July 2017 / No comments / , ,

How to Use IR module with Arduino How Arduino IR obstacle detector module works

how to use ir sensor module with arduino. arduino tutorial with complete code


Welcome Back to the Arduino learn by doing projects  Tutorial series. Our task for today is IR 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 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 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:

  1. Introduction to IR  proximity module
  2. Working principle of IR module
  3. Components list
  4. Circuit Diagram of IR module with arduino
  5. Arduino code 

1-Introduction to IR proximity Sensor Module

The Infrared ( IR )  Sensor has infrared Transmitter and Receiver.It can be used in many ways.There are many applications of IR module. It has quite good response as it gives 0 to 5v the range of 0 to 1024 so we can adjust our threshold in between this range.
The great and cool thing about this IR module is that it has built in comparator and a potentiometer for adjusting distance range.We can easily adjust our threshold range by varying potentiometer.
An indication Led is also placed over this module for obstacle indication.

2-Working Principle of IR Module

The working principle of IR module is same as in other modules the one transmitter and receiver. The Transmitter sends the infrared signal and receiver catches the bounce back signal.whenever an object come near to the sensor the signals reflected back to the receiver. The signal will not reflect on black surface so it gives 0 instead of 1 this is very helpful in the case of line following robot.
The Module has only one pin as output. 

how to use ir sensor with arduino


3-Components List

  1. 1x Arduino board UNO  (any arduino board)
  2. 1x Arduino IR sensor Module
  3. Jumper wires
  4. Bread board

4-Circuit Diagram

The interfacing of IR module is quite easy.It has one output pin connect this pin to any arduino digital pin.

  • 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
The coding for IR module is just defining pinout configuration. Test your circuit and code then move towards implementing more circuits.
Here is the circuit diagram:

how to use ir sensor module with arduino circuit diagram and code



5-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 come closer to the sensor the built in Led on arduino board will blink.we will see some of the cool project 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...!!!

arduino tutorials complete with source codes

Share This Post :
Tags : , ,
Related Posts

No comments:

Post a Comment

Social Media

Popular Posts