This tutorial of Robo India explain the working concept of Infrared(IR) sensor for color detection and proximity. The constructed circuit is performed on Arduino platform.
1. Introduction:
A step by step illustrated tutorial to use IR Sensor on Arduino. This tutorial explains the concept and construction of IR Sensor for color detection and proximity measurement. This sensor comprises following two main parts (IR-LED and Photo Diode).
1.1 IR LED (Infrared Transmitter): It is as same as other LED we generally see, but it emits light of Infrared range 700 nanometers (nm) to 1 mm. This light is not visible through naked eyes but can be seen by camera (that is why these are also used in night vision camera).
1.2 Photo Diode: It gives response in term of change in resistance when light falls on it. That change we measure in terms of voltage.
1.3 IR Sensor as a proximity sensor:
IR LED (Transmitter) emits IR light, that light get reflected at the object, the reflected light is received by IR receiver (Photo Diode). Amount of reflection and reception as the distance varies. This difference causes to change in input voltage through IR input. We observe these values and use it out projects. This is our Proximity sensor. Following diagram explains this concept.
Application of this sensor can be an obstacle avoiding robot.
1.4 IR sensor as color detector.
Lets see above mentioned concept from a different angle. The amount of reflection light will also depend upon the color of surface from which it is being reflected. Black is said to be perfect absorber and white is to be said perfect reflector. The reflection will be different for different colors. Thus make it a color detector.
Application of this sensor can be a line follower, a micro mouse or a grid solver.
Following diagram will help you to understand the concept of IR sensor as a color detector.
2. Required Hardware
Following Hardware will be required to perform this sketch of IR Proximity and Color Detection.
S.No. | Item | Quantity |
1 | Arduino UNO | 1 |
2 | Breadboard | 1 |
3 | IR LED | 1 |
4 | Photo Diode | 1 |
5 | Resistor 10k | 1 |
6 | Resistor 1k | 1 |
7 | Jumper | 7 |
3. Building Circuit
Make following circuit with the help of above mentioned components.
Here is the schematic of this circuit-
4. Programming:
Once we are done with circuit part, here is our programme to this circuit. Every command of the following programme is explained in the comment section.
Programming is simple Analog input programming. Input is coming from Photo Diode to Pin A0. Upload the programme to Arduino board and observe change in value at serial port. These values are useful while making an application using this IR sensor.
You may download this code (Arduino Sketch) from here.
/* Tutorial of Analog IR Sensor. Prepared by Robo India. www.roboindia.com */ int analog_ip = A0; // select the input pin Photo Diode. int inputVal = 0; // to store photo diode input void setup() { Serial.begin(9600); // Setup Serial Communication. Serial.print("ROBO INDIA\nroboindia.com\nTutorial on Analog IR Sensor.\n"); } void loop(){ inputVal = analogRead(analog_ip); // Reading and storing analog input value. Serial.print("Input Value:"); Serial.print(inputVal); // Printing Analog input value of Photo Diode. Serial.print("\n"); // moving to new line delay(500); // Waiting for a while. }
5. output:
Here is the output of this tutorial-
6. Following Product of Robo India can be useful for this circuit:
This sensor of Robo India gives both Analog and digital output.
If you have any query please write us at support@roboindia.com
Thanks and Regards
Content Development Team
Robo India
https://roboindia.com