IR Sensor
IR Sensor
IR (Infrared) technology finds broad applications in daily life and industry, including line follower robots, obstacle avoidance systems, automated cars, line counting, and tracking black-and-white lines. Key advantages of IR sensors include low power consumption, straightforward design, and ease of use.
Arduino uno
IR sensor
LED light
Resistor 220 ohm
What is IR?
An IR sensor is an electronic device that emits infrared light to detect objects and their surroundings. It consists of infrared emitting and receiving components. The emitting tubes emit infrared light, which reflects off objects and is detected by the receiving tube. This reflection triggers a signal processing circuit, resulting in a digital output signal when an obstacle (reflective surface) is detected. The sensor has an adjustable detection range of 2 to 30 centimeters using a potentiometer and is used for proximity sensing and obstacle detection in various applications.
Circuit:
Code:
int IR = 2;
int led = 13;
void setup() {
pinMode(led, OUTPUT);
pinMode(IR, INPUT);
Serial.begin(9600);
}
void loop() {
int SensorValue = digitalRead(IR);
Serial.print("IR Value: ");
Serial.println(SensorValue);
delay(1000);
if (SensorValue==LOW){ // low means object detected
digitalWrite(led, HIGH);
}
else
{
digitalWrite(led, LOW);
}
}
If you have completed this successfully, move on to the next step.