The Pololu QTR-1RC reflectance sensor carries a single infrared LED and phototransistor pair. The phototransistor uses a capacitor discharge circuit that allows a digital I/O line on a microcontroller to take an analog reading of reflected IR by measuring the discharge time of the capacitor. Shorter capacitor discharge time is an indication of greater reflection.
The LED current-limiting resistor is set to deliver approximately 17 mA to the LED when VIN is 5 V. The current requirement can be met by some microcontroller I/O lines, allowing the sensor to be powered up and down through an I/O line to conserve power.
This sensor was designed to be used with the board parallel to the surface being sensed. Because of its small size, multiple units can easily be arranged to fit various applications such as line sensing and proximity/edge detection. For a line sensor with eight of these units arranged in a row, please see the QTR-8RC reflectance sensor array. For a similar, smaller sensor with longer range, and intended for use with the board perpendicular to the surface, please see the QTR-L-1RC reflectance sensor.
|QTR-L-1RC reflectance sensor on a quarter next to a QTR-1A reflectance sensor.|
- Dimensions: 0.3" x 0.5" x 0.1" (without optional header pins installed)
- Operating voltage: 5.0 V
- Supply current: 17 mA
- Output format: digital I/O-compatible signal that can be read as a timed high pulse
- Optimal sensing distance: 0.125" (3 mm)
- Maximum recommended sensing distance: 0.375" (9.5 mm)
- Weight without header pins: 0.008 oz (0.2 g)
|QTR-1RC output (yellow) when 1/8" above a black line and microcontroller timing of that output (blue).|
Interfacing the QTR-1RC Output to a Digital I/O Line
Like the Parallax QTI, the QTR-1RC module has sensor outputs that require a digital I/O line capable of first charging the output capacitor (by driving the line high) and then measuring the time for the capacitor to discharge through the phototransistor. This measurement approach has several advantages, especially when multiple units are used:
- No analog-to-digital converter (ADC) is required
- Improved sensitivity over voltage-divider analog output
- Parallel reading of multiple sensors is possible with most microcontrollers
The typical sequence for reading a sensor is:
- Set the I/O line to an output and drive it high
- Allow at least 10 us for the 10 nF capacitor to charge
- Make the I/O line an input (high impedance)
- Measure the time for the capacitor to discharge by waiting for the I/O line to go low
These steps can typically be executed in parallel on multiple I/O lines.
With a strong reflectance, the discharge time can be as low as several dozen microseconds; with no reflectance, the discharge time can be up to a few milliseconds. The exact time of the discharge 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.
Our Pololu AVR library provides functions that make it easy to use these sensors with ourOrangutan robot controllers; please see the QTR Reflectance Sensors section of our library command reference for more information. We also have a Arduino library for these sensors.
This module has a single mounting hole intended for a #2 screw (not included); if this mounting hole is not needed, this portion of the PCB can be ground off to make the unit even smaller. The reflectance sensor ships with a 3-pin 0.1" header strip, which can be soldered in the conventional perpendicular orientation or parallel to the PCB, as shown below. You can also solder wires, such as ribbon cable, directly to the pads for the smallest installation.
|An example of soldering header pins parallel to QTR-1A PCB for compact installation.|