Professional Documents
Culture Documents
Objective
To interface the IR sensor module with Arduino in order to detect distant object.
Apparatus
IR sensor
LCD16x 2
Arduino UNO R3 board
LDR
Breadboard
Jumper wires
Theory:
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 measure only infrared radiation, rather than emitting it that is called
a passive IR sensor. Usually, in the infrared spectrum, all the objects radiate some form of
thermal radiation. When IR light falls on the photodiode, the resistances and the output voltages
will change in proportion to the magnitude of the IR light received. The working principle of an
infrared sensor is similar to the object detection sensor.
Circuit Diagram:
Arduino IDE software is used to write and upload the program in Arduino.
USB -B is used to connect computer& arduino board .
5V pin of IR sensor is connected with 5V pin of Arduino UNO R3 and ground pin of IR
sensor is connected with ground pin of Arduino and out pin of IR sensor is connected
with 13 pin of Arduino UNO R3 and lcd connections with Arduino is described earlier.
Code
int IR=04;
int LED=13;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}
void loop() {
IR=digitalRead(04);
if(IR==1);
{
digitalWrite(LED,HIGH);
Serial.print("object detected");
}
}
Calibration Graph
Reading
20 by Meter Rule
18
16
14
12
10
8
6
4
2
0
0 2 4 6 8 10 12 14 16 18 20
Reading by Sensor
Conclusion:
In conclusion, utilizing an infrared (IR) sensor for distance measurement proves to be an effective and
practical solution. By leveraging the principles of reflection and absorption of infrared light, the IR
sensor, when interfaced with Arduino, can accurately gauge the distance between the sensor and an
object. This distance measurement capability opens up a range of applications, from proximity sensing in
robotics to automated systems that respond to changes in object distances. The Arduino platform
facilitates the integration of IR sensors into diverse projects, offering a user-friendly and versatile solution
for distance measurement. Overall, employing an IR sensor for distance measurement enhances the
capabilities of Arduino-based projects, providing a reliable and accessible method for real-
world applications.