IR SENSOR
IR SENSOR
An Infrared sensor is an electronic device that emits and detects IR
radiation in order to sense objects. IR sensor consists of IR LED and IR
Photodiode. When the IR transmitter emits radiation, it reaches the object
and some of the radiation reflects back to the IR receiver. Based on
intensity of reception by IR receiver, the output of the sensor is defined.
The best example of IR sensor which we use in our homes is Television and
Television remote.We can interface IR sensor with Arduino to detect the
presence of objects.
![]() |
Applications:
- It can be used as a Security system
-
It is used for Lighting appliances
- It can be used as Remote control based applications
- It can be used to indicate Water level
Sample Project Using Arduino:
In this project we are going to turn ON the LED whenever the IR sensor
senses objects or any other things.
Materials Required:
- ARDUINO UNO Board
- IR sensor module
- LED
Circuit Diagram:
![]() |
Code:
int LED = 13; // initialize LED in pin 13int SENSOR = 7; // initialize SENSOR in pin 7
int Obstacle = LOW; // initial declaration that there is no obstacle
void setup() {
pinMode(LED, OUTPUT); // Declaring LED as a output pin
pinMode(SENSOR, INPUT); // Declaring SENSOR as a input pin
Serial.begin(9600); // Enabling serail monitor
}
void loop() {
Obstacle = digitalRead(SENSOR); // Reads sensor value and store it in variable Obstacle
if (Obstacle == LOW) // Checking condition of the SENSOR pin whether it is HIGH/LOW
{
Serial.println("OBSTACLE!!");
digitalWrite(LED, HIGH);
}
else
{
Serial.println("clear");
digitalWrite(LED, LOW);
}
delay(200);
}
Serial Monitor Output:
Comments
Post a Comment