Functional Description:
- Each sensor uses a capacitor discharge circuit for reading reflectance values.
- Shorter discharge time indicates higher reflectivity (white surface).
- LEDs can be turned off using a MOSFET gate pin to save power or adjust brightness.
- Pairs of emitters are grouped to reduce current draw.
- Can also operate at 3.3V by bypassing one of the two current-limiting stages.
Specifications:
Parameter |
Value |
Operating Voltage |
3.3V – 5.0V |
Supply Current |
Approx. 100 mA |
Output Format |
Digital I/O Compatible (via timing) |
Optimal Sensing Distance |
0.125" (3 mm) |
Max Recommended Distance |
0.375" (9.5 mm) |
Module Dimensions |
2.95" x 0.5" x 0.125" |
Weight |
3.09 g (without headers) |
Pin Functions:
- Sensor Outputs: Each channel has an individual signal output to a digital input on your MCU.
- CTRL / LEDON: Connect to a digital output to enable or disable emitters (optional).
Typical Applications:
- Line Following Robots
- Edge Detection
- Surface Reflectance Sensing
Arduino Wiring Example:
The following code uses digital pins 3 to 10 for the 8 sensor inputs, and pin 2 to control the LED emitters. The QTRSensors library is used to manage the reflectance readings and line position estimation.
Sample Code:
#include
QTRSensors qtr;
const uint8_t SensorCount = 8;
uint16_t sensorValues[SensorCount];
void setup() {
qtr.setTypeRC();
qtr.setSensorPins((const uint8_t[]){3, 4, 5, 6, 7, 8, 9, 10}, SensorCount);
qtr.setEmitterPin(2);
delay(500);
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, HIGH); // LED ON: Calibration mode
// Calibrate over 10 seconds
for (uint16_t i = 0; i < 400; i++) {
qtr.calibrate();
}
digitalWrite(LED_BUILTIN, LOW); // LED OFF: Calibration complete
Serial.begin(9600);
// Print min and max calibration values
for (uint8_t i = 0; i < SensorCount; i++) {
Serial.print(qtr.calibrationOn.minimum[i]);
Serial.print(' ');
}
Serial.println();
for (uint8_t i = 0; i < SensorCount; i++) {
Serial.print(qtr.calibrationOn.maximum[i]);
Serial.print(' ');
}
Serial.println();
delay(1000);
}
void loop() {
// Read reflectance sensor values and calculate line position
uint16_t position = qtr.readLineBlack(sensorValues);
for (uint8_t i = 0; i < SensorCount; i++) {
Serial.print(sensorValues[i]);
Serial.print('\t');
}
Serial.println(position);
delay(250);
}
How It Works:
- Each sensor pair emits IR light and measures the reflected light intensity from the surface.
- White surfaces reflect more IR and result in a faster capacitor discharge (lower time = higher reading).
- Black surfaces absorb IR, producing slower discharge times (lower readings).
Resources:
Functional Description:
- Each sensor uses a capacitor discharge circuit for reading reflectance values.
- Shorter discharge time indicates higher reflectivity (white surface).
- LEDs can be turned off using a MOSFET gate pin to save power or adjust brightness.
- Pairs of emitters are grouped to reduce current draw.
- Can also operate at 3.3V by bypassing one of the two current-limiting stages.
Specifications:
Parameter |
Value |
Operating Voltage |
3.3V – 5.0V |
Supply Current |
Approx. 100 mA |
Output Format |
Digital I/O Compatible (via timing) |
Optimal Sensing Distance |
0.125" (3 mm) |
Max Recommended Distance |
0.375" (9.5 mm) |
Module Dimensions |
2.95" x 0.5" x 0.125" |
Weight |
3.09 g (without headers) |
Pin Functions:
- Sensor Outputs: Each channel has an individual signal output to a digital input on your MCU.
- CTRL / LEDON: Connect to a digital output to enable or disable emitters (optional).
Typical Applications:
- Line Following Robots
- Edge Detection
- Surface Reflectance Sensing
Arduino Wiring Example:
The following code uses digital pins 3 to 10 for the 8 sensor inputs, and pin 2 to control the LED emitters. The QTRSensors library is used to manage the reflectance readings and line position estimation.
Sample Code:
#include
QTRSensors qtr;
const uint8_t SensorCount = 8;
uint16_t sensorValues[SensorCount];
void setup() {
qtr.setTypeRC();
qtr.setSensorPins((const uint8_t[]){3, 4, 5, 6, 7, 8, 9, 10}, SensorCount);
qtr.setEmitterPin(2);
delay(500);
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, HIGH); // LED ON: Calibration mode
// Calibrate over 10 seconds
for (uint16_t i = 0; i < 400; i++) {
qtr.calibrate();
}
digitalWrite(LED_BUILTIN, LOW); // LED OFF: Calibration complete
Serial.begin(9600);
// Print min and max calibration values
for (uint8_t i = 0; i < SensorCount; i++) {
Serial.print(qtr.calibrationOn.minimum[i]);
Serial.print(' ');
}
Serial.println();
for (uint8_t i = 0; i < SensorCount; i++) {
Serial.print(qtr.calibrationOn.maximum[i]);
Serial.print(' ');
}
Serial.println();
delay(1000);
}
void loop() {
// Read reflectance sensor values and calculate line position
uint16_t position = qtr.readLineBlack(sensorValues);
for (uint8_t i = 0; i < SensorCount; i++) {
Serial.print(sensorValues[i]);
Serial.print('\t');
}
Serial.println(position);
delay(250);
}
How It Works:
- Each sensor pair emits IR light and measures the reflected light intensity from the surface.
- White surfaces reflect more IR and result in a faster capacitor discharge (lower time = higher reading).
- Black surfaces absorb IR, producing slower discharge times (lower readings).
Resources: