This array of IR LED/phototransistor pairs is great for precisely identifying changes in reflectance (like line detection). It operates from 2.9 V to 5.5 V and offers dimmable brightness control independent of the supply voltage.
In general, the closer the object, the higher the contrast between light and dark readings, but high-reflectance objects are generally detectable out to around 30-40 mm. This version features high-performance, low-current QTRX sensors with lenses.
- Operating voltage: 2.9 V to 5.5 V
- Sensor type: QTRX
- Sensor pitch: 4 mm
- Full-brightness LED current: 3.5 mA (independent of supply voltage)
- Optimal sensing distance: 10 mm
- Peak wavelength: 940 nm
2.9 V to 5.5 V; 3.5 mA max LED current(1); 10 mm optimal range
|Board width||Configuration||Max board current(2)||Max range||Output type||Name|
|5.0 mm||1 sensor (HD)||5 mA||30 mm||analog||QTRX-HD-01A|
|17.0 mm||4 mm × 4||9 mA||40 mm||analog||QTRX-HD-04A|
|29.0 mm||4 mm × 7||17 mA||40 mm||analog||QTRX-HD-07A|
1 Can be dynamically reduced to any of 32 available dimming levels.
2 With all LEDs on at max brightness setting.
QTR family overview
These reflectance sensors feature a linear array of infrared emitter/phototransistor pair modules in a high-density (4 mm pitch) arrangement, which makes them well suited for applications that require detection of changes in reflectivity. This change in reflectivity can be due to a color change at a fixed distance, such as when sensing a black line on a white background, as well as due to a change in the distance to or presence of an object in front of the sensor. A variety of sensor counts are available so you can pick the ideal arrangement for your application. Since the outputs are all independent, you can connect just some of the channels to attain an irregular or non-standard sensor spacing.
These units have integrated LED drivers that provide brightness control independent of the supply voltage, which can be anywhere from 2.9 V to 5.5 V, while enabling optional dimming to any of 32 possible brightness settings. For high-density (HD) modules with five or more sensors there are separate controls for the odd-numbered and even-numbered LEDs, which gives you extra options for detecting light reflected at various angles. See the “Emitter control” section below for more information on using this feature.
Each sensor option is available in two output types: an “A” version with analog voltage outputs between 0 V and VCC, and an “RC” version with outputs that can be read with a digital I/O line on a microcontroller by first setting the lines high and then releasing them and timing how long it takes them to read as low (typically anywhere from a few microseconds to a few milliseconds). The lower the output voltage or shorter the voltage decay time, the higher the reflectance. The following simplified schematic diagrams show the circuits for the individual channels:
Schematic diagrams of individual QTR sensor channels for A version (left) and RC version (right). This applies only to the newer QTRs with dimmable emitters.
This Arduino library makes it easy to use these sensor modules with an Arduino or compatible controller by providing methods for controlling the emitters, calibrating the module, and reading the individual sensor values from either the A or RC versions. It also has a method specifically for line-following applications to compute the location of the line under the array.
Note: Unlike most Pololu products, these sensor arrays do not ship with any headers or connectors included, so you will need to supply your own or solder wires directly to the board to use it.
Interfacing with the outputs of the A versions
Each sensor on the A versions outputs its reflectance measurement as an analog voltage that can range from 0 V when the reflectance is very strong to VCC when the reflectance is very weak. There are several ways you can interface with the analog output:
- Use a microcontroller’s analog-to-digital converter (ADC) to measure the voltages.
- Use a comparator with an adjustable threshold to convert each analog voltage into a digital (i.e. black/white) signal that can be read by the digital I/O line of a microcontroller.
- Connect each output directly to a digital I/O line of a microcontroller and rely upon its logic threshold.
This last method will work if you are able to get high reflectance from your white surface, but will probably fail if you have a lower-reflectance signal profile.
Interfacing with the outputs of the RC versions
Each sensor on the RC versions requires a digital I/O line capable of driving the output line high and then measuring the time for the output voltage to decay. The typical sequence for reading a sensor is:
Turn on IR LEDs (optional).
- Set the I/O line to an output and drive it high.
- Allow at least 10 μs for the sensor output to rise.
- Make the I/O line an input (high impedance).
- Measure the time for the voltage to decay by waiting for the I/O line to go low.
- Turn off IR LEDs (optional).
These steps can typically be executed in parallel on multiple I/O lines.
With a strong reflectance, the decay time can be as low as a few microseconds; with no reflectance, the decay time can be up to a few milliseconds. The exact time of the decay depends on your microcontroller’s I/O line characteristics. Meaningful results can be available within 1 ms in typical cases (i.e. when not trying to measure subtle differences in low-reflectance scenarios), allowing up to 1 kHz sampling of all sensors. If lower-frequency sampling is sufficient, you can achieve substantial power savings by turning off the LEDs. For example, if a 100 Hz sampling rate is acceptable, the LEDs can be off 90% of the time, lowering average current consumption from 125 mA to 13 mA.
These reflectance sensor arrays maintain a constant current through their IR emitters, keeping the emitters’ brightness constant, independent of the supply voltage (2.9 V to 5.5 V). The emitters can be controlled with the board’s CTRL pins, and the details of the control depends on the array size and density:
- HD units with 5 or more sensors have two emitter control pins: CTRL ODD and CTRL EVEN. By default, these are connected together with a 1 kΩ resistor and pulled up, turning on all the emitters by default and allowing them to be controlled with a signal on either pin, but the CTRL ODD and CTRL EVEN pins can be driven separately for independent control of the odd-numbered and even-numbered emitters.
- HD units with 4 or fewer sensors have a single CTRL pin that controls all of the emitters.
Driving a CTRL pin low for at least 1 ms turns off the associated emitter LEDs, while driving it high (or allowing the board to pull it high) turns on the emitters with the board’s default (full) current, which is 3.5 mA for “QTRX” versions. For more advanced use, the CTRL pin can be pulsed low to cycle the associated emitters through 32 dimming levels.
To send a pulse, drive the CTRL pin low for at least 0.5 μs (but no more than 300 μs), then high for at least 0.5 μs; (it should remain high after the last pulse). Each pulse causes the driver to advance to the next dimming level, wrapping around to 100% after the lowest-current level. Each dimming level corresponds to a 3.33% reduction in current, except for the last three levels, which represent a 1.67% reduction, as shown in the table below. Note that turning the LEDs off with a >1 ms pulse and then back on resets them to full current.
|Dimming level (pulses)||Emitter current (%)||Dimming level (pulses)||Emitter current (%)|
For example, to reduce the emitter current to 50%, apply 15 low pulses to the CTRL pin and then keep it high after the last pulse.
- Pololu QTR Reflectance Sensor Application Note
- Schematic diagrams of the QTR/QTRX-HD Reflectance Sensor Arrays
- Dimension diagrams of the QTR/QTRX Reflectance Sensor Arrays
- 3D models (STEP) of the QTR/QTRX Reflectance Sensor Arrays (50MB zip)
- Drill guides (DXF) for the QTR/QTRX Reflectance Sensor Arrays
- Arduino library for the Pololu QTR Reflectance Sensors