Interfacing of IR sensor with Arduino

Hello, friends,
       I am cyberautics Today we will learn about the Interfacing of IR sensor and it is use for motion detection system, tachometer, line follower robot and many more. so if you still not visit my previous blog, Please visit Here

BASIC

  • An infrared sensor is an electronic device, that emits in order to sense some aspects of the surroundings. An IR sensor can measure the heat of an object as well as detects the motion. These types of sensors measures only infrared radiation.


  • There are two types of infrared sensors: active and passive.
  1.  Active infrared sensors both emit and detect infrared radiation. Active IR sensors have two parts: a light emitting diode (LED) and a receiver. When an object comes close to the sensor, the infrared light from the LED reflects off of the object and is detected by the receiver. Active IR sensors act as proximity sensors, and they are commonly used in obstacle detection systems (such as in robots).
  2. The Passive Infrared (PIR) sensor is used to detect the presence of human.... The Grid-EYE sensor detects the human using the infrared radiation radiated by the human body. Every human radiates the infrared energy of specific wavelength range. The absorbed incident radiation changes the temperature of a material.IR sensors? 2.8V at 15cm to 0.4V at 150cm with a supply voltage between 4.5 and 5.5 VDC.



  • LED Stands for "Light-Emitting Diode." An LED is an electronic device that emits light when an electrical current is passed through it. Early LEDs produced only red light, but modern LEDs can produce several different colors, including red, green, and blue (RGB) light.

COMPONENTS

1.Arduino Uno
2.IR sensor
3.LED
4.Arduio cable
5.Jumper wire


DIAGRAM



Make a connection as per the shown in diagram.

  • There are three pins in IR sesnor : 
  1. Vcc : connect with 5v (Red wire)
  2. GDN : connect with ground ( Black wire)
  3. OUT : connect with digital pin(Green wire)
  • Connect LED with Arduino repectively +ve:digital pin and -ve : ground pin.

CODE

int IRSensor = 2; // connect ir sensor to arduino pin 2
int LED = 13; // conect Led to arduino pin 13

void setup() 
{
  pinMode (IRSensor, INPUT); // sensor pin INPUT
  pinMode (LED, OUTPUT); // Led pin OUTPUT
}

void loop()
{
  int statusSensor = digitalRead (IRSensor);
  
  if (statusSensor == 1)
  {
    digitalWrite(LED, LOW); // LED LOW
  }
  else
  {
    digitalWrite(LED, HIGH); // LED High
  }
  
}

Explanation
  • Make a connection as per diagram and paste the code in your Arduino IDE and run it.

  • we know that IR sensor is a digital sensor so it will take input by object , When object closed to the IR sesnor than it will detect it and its signals become high(1), and the signal send to the LED and LED will glow .

  • When any object passed near from the IR sensor it will detect and send signal to the next peripheral. 


So My friends I hope this information is useful for you and if you have any doubt or any questions you can contact me.



Comments

Post a Comment