Make Wonderful IR based Motion Tracking System with this 5 Way IR Array!
An infrared sensor is a sensor that is used to measure infrared light radiating from an object. These sensors are primarily used for motion sensing and are used as alarms. All objects with a temperature above absolute zero emit heat energy in the form of electromagnetic radiation, this radiation is not visible to the human eye however it can be picked up via this electronic sensor. IR sensors detect changes in infrared radiation and give output in the form of voltage which can be read by the Analog pins of the microprocessor or microcontroller based development kits. These work best when the obstacle in view is black in colour. This sensor array consists of 5 TCRT IR sensor modules which are pointing downwards, an IR sensor at the front to detect obstacles and a bump switch, more commonly known as a limit switch which gives a high voltage when pressed, which is then read by our controller.
How to use the module?
The module consists of 9 pins 2 of which are the VCC and GND, 5 pins are the outputs of the TCRT sensors, 1 pin is the output of the IR sensor and the remaining pin is for the limit switch.
• Connect the VCC pin of the module to the 5V pin of the Arduino.
• Connect the GND pin of the Arduino to the GND pin of the module.
• Connect the S1 pin of the module to A0 pin of the Arduino.
• Connect the S2 pin of the module to the A1 pin of the Arduino.
• Connect the S3 pin of the module to the A2 pin of the Arduino.
• Connect the S4 pin of the module to the A3 pin of the Arduino.
• Connect the S5 pin of the module to the A4 pin of the Arduino.
• Connect the CLP pin of the module to the digital pin 12 of the Arduino. The CLP pin of the module is used to find the status of the limit switch or the bump switch.
• Connect the Near pin of the module to the A6 of the Arduino. The near pin displays the status of the IR sensor at the front which is used to detect obstacles.
We can follow the above instructions to easily connect the circuit or use the circuit schematic below to assemble the circuit and use the module as per our requirements. The potentiometer on the module can be used to adjust the sensitivity of the module, so that we can use this module to perform desired actions. This sensor array works best if there is a high contrast between the 2 surfaces which are in question and are being detected by both the TCRT as well as the IR sensor.
Code:int s1=A0; //TCRT1
int s2=A1; //TCRT2
int s3=A2; //TCRT3
int s4=A3; //TCRT4
int s5=A4; //TCRT5
int near=A6; //IR sensor at the front to detect obstacles
int CLP=12; //limit switch int state1;
state1=digitalRead(s1); //TCRT1 status
state2=digitalRead(s2); //TCRT2 status
state3=digitalRead(s3); //TCRT3 status
state4=digitalRead(s4); //TCRT4 status
state5=digitalRead(s5); //TCRT5 status
nearstate=analogRead(near); //IR sensor status
CLPstate=digitalRead(CLP); //Limit switch status
Serial.println(state1); //Print TCRT1 status
Serial.println(state2); //Print TCRT2 status
Serial.println(state3); //Print TCRT3 status
Serial.println(state4); //Print TCRT4 status
Serial.println(state5); //Print TCRT5 status
Serial.println(nearstate); //Print IR sensor status
Serial.println(CLPstate); //Print Limit switch status
After uploading the above code we can successfully view the output on the serial monitor.
Applications:• Line follower robot
• Shaft encoder
• Obstacle avoiding robot
• Warehouse robots