Interface IR sensor module with Arduino

About IR Sensor:

It consists of an Infra-Red transmitter and receiver and an Opamp circuit. The IR transmitter consists of an IR LED that emits IR rays. When IR rays hit an object they get reflected back and detected by the IR receiver which is a Photo Diode. The photodiode then converts the captured light into an electrical signal which is further amplified by the operational amplifier and we get logic 1 and 0. The area for the detection of the object can be set by using a potentiometer that is present on the module. 

Pinout of IR Sensor

Features of  the IR Sensor

  • Operating voltage: 5 volts
  • Current consumption: 20mA
  • Range: 0-20cm

Components Needed for This Project

  • IR sensor
  • Arduino UNO
  • Jumper Wires

Pin Connection of IR Sensor with Arduino UNO

  • VCC-5v
  • GND-GND
  • OUT-PIN 2

Circuit Diagram of IR Sensor with Arduino UNO

Arduino Code for IR Sensor


const int irSensor=2;
 
void setup() {
  Serial.begin(9600);
pinMode(irSensor,INPUT);
}
 
void loop() {
  
int irData=digitalRead(irSensor);
Serial.print("IR SENSOR DATA:");
Serial.println(irData);
}

Leave a Reply

Your email address will not be published. Required fields are marked *