IR Sensor :- Infrared sensor is an Electronics devices that works by using a specific light sensors. It detects the specific Wavelength of light in IR spectrum.
Working Principle of IR Sensor.
Working Principle of IR Sensor.
- Infared spectrum
- Transmitter
- Receiver
- Reflection By object
- Voltage level
Whenever the Ray is reflected by an object is receive by an receiver it generates the voltage level across its terminal that voltage level depend on the intensity of the light which is reflected by a object.
When light Emits from the transmitter (i.e LED) on the White surface it reflect the light backwards so receiver get the reflected intensity of light from the surface, but absorbs all the ray when it is strike in the black colored surface.so, Receiver didn't get any message when light emits on black colored surface.
IR Sensor Interface with Arduino:-
Component Required :
- IR Sensor
- LED
- Arduino
- PC
Circuit Diagram
Fig:- Circuit Diagram
Connect VCC of sensor to 3.5V and GND pin To GND of Arduino and VOUT pin to digital 7-Pin of arduino.Connect the LED to 12 pin of Arduino.
CODE
int led = 12;
int sensor = 7;
void setup()
{
pinMode (led,OUTPUT);
pinMode(sensor,INPUT);
Serial.begin(9600);// put your setup code here to run once:
}
void loop()
{
int value = digitalRead(sensor);
Serial.println(value);
{
if (value== HIGH)
{
digitalWrite(led,HIGH);
}
else
{
digitalWrite(led,LOW);
}
}
}
Conclusion:
When the sensor value is HIGH then the LED Will glows and When sensor value is low the led will remain off....