Skip to content

QTR Reflectance Sensor Array (Line sensor)

dariojimenezp edited this page Aug 3, 2021 · 10 revisions

QTR Reflectance Sensor Array:

What does it look like?

QTR-8A Sensor

QTR-3A Sensor

What is it?

the QTR Reflectance sensor array is an array (board with a line of sensors equally spread out) of sensors that output an analog voltage based on the reflectance of the object directly in front of it. There is the QTR-8A reflectance sensor, which contains 8 analog reflectance sensors and there is the QTR-3A reflectance sensor which contains 3 analog reflectance sensors.

Specifications

How does it work?

The sensor will have either 8 or 3 infrared LED/phototransistor pairs (black chips mounted on sensor board shown in picture below) that are capable of turning the reflectance of an object to an analog voltage from 0V to 3.3V. A white object (which reflects a high amount of light) will be detected by the sensor as high reflectance and hence output an analog voltage close to 0V. On the other hand, a black object (which reflects a small amount of light) will be detected by the sensor as low reflectance and output an analog voltage close to +3.3V. Any other color between black and white will have a voltage of anywhere between 0V and +3.3V.

What can it be used for?

The sensor is mainly designed to be used as a line sensor, but it can be used as a general proximity or reflectance sensor.

It can be used as a line sensor by placing the sensor in such a way that you can detect changes in color along a path. i.e, if robot has to go through a path marked by black tape where the floor is white, the QTR reflectance sensor can be placed across the width of the robot (could be placed some other way as well) such that some of the sensors detect when the left/right side of the robot is on top of the black tape; this way, you know your robot has to turn left or right depending on which side the black tape was detected. The way you could make this work, is by constantly checking the values of your leftmost/rightmost sensors until they detect a low reflectance color (black) and have the software trigger a function (which you would have to write/code) that turns the robot left or right (something along the lines of "robot_TurnLeft" or "Robot_TurnRight").

It can be used as a general proximity sensor using the fact that the sensors only detect the reflectance of objects at a very short distance (distance). You have to find out what value it outputs whenever there is no object near it and when there's an object near it. of course, the value the sensor will output when an object is near will depend on the color of the object, so keep in mind that it will only work with objects of certain colors. you can make it do something especific whenever the sensor's value changes to a value that is not the value when there is no object near it. this can be useful to avoid having the robot crash into a wall.

It can be used as a simple reflectance sensor by figuring out what value the sensor outputs for each colored object. For example, a red object might make the sensor output a value of 3000 while blue might make it output a value of 1000, so you can use that fact to distinguish between different color objects. This might be helpful if the robot has pick up or avoid a certain color object.

How to Interface with Sensor

Example Codes

Clone this wiki locally