IR SENSOR INTERFACING WITH ARDUINO UNO

IR sensor is an electronic component that is used to sense certain characteristics of its surroundings. It does this by either emitting or detecting infrared radiation. Infrared sensors are also capable of measuring the heat being emitted by an object and motion detection. IR sensor interfacing with arduino UNO

Wavelength regions of Infrared Spectrum

  • Near IR – 0.75micrometers to 3micrometers.
  • Mid IR – 3micrometers to 6micrometers.
  • Far IR – > 6micrometers.

How Infrared Sensor Works

An Infrared Sensor works in the following sequence:
  • IR source (transmitter) is used to emit radiation of the required wavelength.
  • This radiation reaches the object and is reflected.
  • The reflected radiation is detected by the IR receiver.
  • The IR radiation detected by the receiver is then further processed based on its intensity. Generally, the IR receiver output is small and amplifiers are used to amplify the detected signal.
IR SENSOR INTERFACING WITH ARDUINO UNO

IR sensor FC-51

IR SENSOR INTERFACING WITH ARDUINO UNO
The sensor used in our demo is model is FC-51. It is easily available on the internet for less than $2.
Pin, Control IndicatorDescription
Vcc3.3 to 5 Vdc Supply Input
GNDGround Input
OutThe output that goes low when an obstacle is in range
Power LEDIlluminates when power is applied
Obstacle LEDIlluminates when an obstacle is detected
Distance AdjustAdjust the detection distance. CCW decreases distance.CW increases distance.
IR EmitterInfrared emitter LED
IR ReceiverAn infrared receiver that receives a signal transmitted by Infrared emitter.

Connecting the IR sensor with Arduino

Connecting Arduino with IR Sensor is explained in the following steps:
  • Connect the -ve wire on the IR Sensor to GND on the Arduino.
  • Connect the middle of the IR Sensor which is the VCC to 5V on the Arduino.
  • Connect the signal pin on the IR sensor to pin 8 on the Arduino.

Source code for Interfacing IR sensor with Arduino.


// IR Obstacle Collision Detection Module
int LED = 13; // Use the onboard Uno LED
int isObstaclePin = 7; // This is our input pin
int isObstacle = HIGH; // HIGH MEANS NO OBSTACLE
void setup() {
pinMode(LED, OUTPUT);
pinMode(isObstaclePin, INPUT);
Serial.begin(9600);
}
void loop() {
isObstacle = digitalRead(isObstaclePin);
if (isObstacle == LOW) {
Serial.println("OBSTACLE!!, OBSTACLE!!");
digitalWrite(LED, HIGH);
} else {
Serial.println("clear");
digitalWrite(LED, LOW);
}
delay(200);
}

Conclusion:

The above-discussed information about the IR Sensor is all about the interfacing and functioning of the Sensor with the ARDUINO Development Board. In this way, the IR sensor component can be connected to the ARDUINO and can be used for a wide range of applications in the Autonomous Robotic Projects.

Read related topics:

Introduction to arduino board
Interfacing of arduino with joystick module
arduino official website tutorials

Spread knowledge