0% found this document useful (0 votes)
35 views5 pages

Iot - Infrared Sensor

The document describes interfacing an infrared sensor with an Arduino Uno board. It includes the sensor description, a connection diagram, the procedure to interface the sensor, and code to detect motion using the sensor and light an LED.

Uploaded by

Amin Shaik
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views5 pages

Iot - Infrared Sensor

The document describes interfacing an infrared sensor with an Arduino Uno board. It includes the sensor description, a connection diagram, the procedure to interface the sensor, and code to detect motion using the sensor and light an LED.

Uploaded by

Amin Shaik
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Anjuman-I-Islam’s

M.H.SABOO SIDDIK COLLEGE OF ENGINEERING


8, Saboo Siddik Poly. Road, Byculla, Mumbai-4000 08.

DEPARTMENT OF AUTOMOBILE ENGINEERING

Date: / /2023

Aim: To interface Arduino Uno with infrared sensor.


Apparatus:
Hardware: Arduino Uno, Infrared Sensor, Jumper Wires.
Software: Arduino IDE
Theory:
Sensor Description:

Infrared Sensor is used to detect proximity or to build obstacle avoidance robots. This sensor has three
pins two of which are power pins leveled VCC and GND and the other one is the sense/data pin which
is shown in the diagram below. It has an onboard power LED and a signal LED. The power LED
turns on when power is applied to the board the signal LED turns on when the circuit is triggered.
This board also has a comparator Op-amp that is responsible for converting the incoming analog
signal from the

Figure 1. Infrared Sensor

photodiode to a digital signal. It also has a sensitivity adjustment potentiometer; with that, one can
adjust the sensitivity of the device. Last and finally, the photodiode and the IR emitting LED pair
which all together make the total IR Proximity Sensor Module.
Connection Diagram:

Procedure:
Step 1. Power the infrared sensor with 5V or 3.3V on Arduino board and connect ground (IR sensor
to the ground of (Arduino board).
Step 2. Connect the output of the infrared sensor to a digital pin D9 of the Arduino board.
Step 3. Power the Arduino board via computer USB connection.
Step 4. Verify the code, and remove the errors if any.
Step 5. After successful compilation of the code, upload the code.
Step 6. Put some obstacle in front of the infrared sensor.
Step 7. Observe the output in the serial monitor.
Code:

// Arduino IR Sensor Code

int IRSensor = 9; // connect ir sensor module to Arduino pin 9

int LED = 13; // conect LED to Arduino pin 13

void setup()

  Serial.begin(115200); // Init Serila at 115200 Baud

  Serial.println("Serial Working"); // Test to check if serial is working or not

  pinMode(IRSensor, INPUT); // IR Sensor pin INPUT

  pinMode(LED, OUTPUT); // LED Pin Output

void loop()

  int sensorStatus = digitalRead(IRSensor); // Set the GPIO as Input

  if (sensorStatus == 1) // Check if the pin high or not

  {

    // if the pin is high turn off the onboard Led

    digitalWrite(LED, LOW); // LED LOW

    Serial.println("Motion Ended!"); // print Motion Detected! on the serial


monitor window

  }

  else

  {

    //else turn on the onboard LED

    digitalWrite(LED, HIGH); // LED High

    Serial.println("Motion Detected!"); // print Motion Ended! on the serial


monitor window
  }

Description of the Command:

Conclusion:

In this practical working of IR sensor and interfacing of it with Arduino Uno was studied
successfully.

You might also like