top of page

Lesson-06 : Interfacing of IR sensor with Arduino Uno

Pankaj Maurya

Let us start with introduction of IR sensor and then will see interfacing of IR sensor with Arduino Uno.


IR sensor:


An infrared (IR) sensor is an electronic device that measures and detects infrared radiation in its surrounding environment.

There are two types of infrared sensors:


  1. Active IR sensor

  2. Passive IR sensor


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).


Interfacing IR sensor with Arduino


Interfacing IR sensor with Arduino
Interfacing IR sensor with Arduino

Components Required:

  1. Arduino Uno with usb cable

  2. IR sensor

  3. Jumper wires (Male to Male (3))

  4. Breadboard (optional)

  5. LCD (optional)

Connections of IR sensor with Arduino is explained in steps

  1. Connect the VCC of the IR sensor to the +5v of Arduino

  2. Connect the GND of the IR sensor to the GND of Arduino

  3. Connect the OUT/Signal pin to the digital pin 2 of Arduino

Pre-coding Steps: -

  1. Define the Pin Mode in the void Setup

  2. Define the logic in the void Loop

Functions used in this example:

  1. pinMode(Pin_Number, IN/OUT); to set the mode i.e. input or output for example pinMode(3,OUTPUT);

  2. digitalWrite(Pin_Number,LOW/HIGH); to set the pin as High or low for example digitalWrite(3,LOW);

  3. digitalRead(2); to read the status

  4. delay(microseconds) to put a time delay between two instructions. For example delay(1000) i.e. 1 sec delay

  5. Serial.println() or Serial.print() to display the value on the serial monitor.


Check out our Latest Training & Internship, Courses, and NI Jobs Alert.


Check out our DIY Kits & Sensors, Electronics Projects & Assistance Plan.


50 views0 comments

Comments

Rated 0 out of 5 stars.
No ratings yet

Add a rating