QTR 4mm Pitch Relectance Sensors

The “QTR” versions feature lower-cost sensor modules without lenses, our QTRX version with lenses are also available.

This version of the QTR sensor is the high density type with a 4mm pitch between sensors, a medium density type with an 8mm pitch is also available. Optimum range 5mm, maximum range 30mm.

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.

An 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.

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 0V when the reflectance is very strong to VCC when the reflectance is very weak. The typical sequence for reading a sensor is:

  • 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 as depicted in the left image, but will probably fail if you have a lower-reflectance signal profile like the one on the right.

QTR-1A output 1/8" away from a spinning white disk with a black line on itQTR-1A output 3/8" away from a spinning white disk with a black line on it

QTR-1A output 1/8" away from a spinning white disk with a black line on it   QTR-1A output 3/8" away from a spinning white disk with a black line on it

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:

  1. Turn on IR LEDs (optional).
  2. Set the I/O line to an output and drive it high.
  3. Allow at least 10μs for the sensor output to rise.
  4. Make the I/O line an input (high impedance).
  5. Measure the time for the voltage to decay by waiting for the I/O line to go low.
  6. Turn off IR LEDs (optional).

These steps can typically be executed in parallel on multiple I/O lines.

QTR-1RC output (yellow) when 1/8" above a black line and microcontroller timing of that output (blue)QTR-1RC output (yellow) when 1/8" above a white surface and microcontroller timing of that output (blue)

QTR-1RC output (yellow) when 1/8" above a black line and microcontroller timing of that output (blue)   QTR-1RC output (yellow) when 1/8" above a white surface and microcontroller timing of that output (blue)

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 1ms in typical cases (i.e. when not trying to measure subtle differences in low-reflectance scenarios), allowing up to 1kHz 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 125mA to 13mA.

Emitter control

These reflectance sensor arrays maintain a constant current through their IR emitters, keeping the emitters’ brightness constant, independent of the supply voltage (2.9V to 5.5V). The emitters can be controlled with the board’s CTRL pins, and the details of the control depends on the array size and density:

  • Units with five or more sensors in a high-density (HD) arrangement have two emitter control pins: CTRL ODD and CTRL EVEN. By default, these are connected together with a 1kΩ 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.
  • Units with three or more sensors in a medium-density (MD) arrangement also have two emitter control pins since these are made by only populating every other sensor on an HD board, but only the CTRL ODD pin will have an effect on these versions (it is not possible to independently control alternate emitters).
  • Units with four or fewer sensors have a single CTRL pin that controls all of the emitters.

Driving a CTRL pin low for at least 1ms 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 30mA for “QTR” versions and 3.5mA for “QTRX” versions. For more advanced use, the CTRL pin can be pulsed low to cycle the associated emitters through 32 dimming levels.

Demo of IR LED dimming and independent even/odd control on the QTR-HD-07x (as seen through an old digital camera that can see IR)Demo of IR LED dimming and independent even/odd control on the QTRX-HD-07x (as seen through an old digital camera that can see IR)

Demo of IR LED dimming and independent even/odd control on the QTR-HD-07x (as seen through an old digital camera that can see IR)   Demo of IR LED dimming and independent even/odd control on the QTRX-HD-07x (as seen through an old digital camera that can see IR)

To send a pulse, you should 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 >1ms pulse and then back on resets them to full current.

Dimming
level
(pulses)

Emitter
current
(%)

 

Dimming
level
(pulses)

Emitter
current
(%)

0

100.00%

 

16

46.67%

1

96.67%

 

17

43.33%

2

93.33%

 

18

40.00%

3

90.00%

 

19

36.67%

4

86.67%

 

20

33.33%

5

83.33%

 

21

30.00%

6

80.00%

 

22

26.67%

7

76.67%

 

23

23.33%

8

73.33%

 

24

20.00%

9

70.00%

 

25

16.67%

10

66.67%

 

26

13.33%

11

63.33%

 

27

10.00%

12

60.00%

 

28

6.67%

13

56.67%

 

29

5.00%

14

53.33%

 

30

3.33%

15

50.00%

 

31

1.67%

For example, to reduce the emitter current to 50%, you would apply 15 low pulses to the CTRL pin and then keep it high after the last pulse.

 

£2.08 £1.49 (£1.79 UK, incl VAT)
3801-620
This IR LED/phototransistor pair is great for precisely identifying changes in reflectance (like line detection). It operates from 2.9 V to 5.5 V...
1 item(s)
End of Line
+
Add to wish list

£2.57 £1.83 (£2.20 UK, incl VAT)
3801-640
This IR LED/phototransistor pair is great for precisely identifying changes in reflectance (like line detection). It operates from 2.9 V to 5.5 V...
5 item(s)
End of Line
+
Add to wish list

£2.47 £0.74 (£0.89 UK, incl VAT)
3801-621
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...
2 item(s)
End of Line
+
Add to wish list

£2.47 £0.74 (£0.89 UK, incl VAT)
3801-641
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...
2 item(s)
End of Line
+
Add to wish list

£3.13 £0.93 (£1.12 UK, incl VAT)
3801-622
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...
2 item(s)
End of Line
+
Add to wish list

£3.13 £0.93 (£1.12 UK, incl VAT)
3801-642
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...
2 item(s)
End of Line
+
Add to wish list

£3.79 £2.71 (£3.25 UK, incl VAT)
3801-623
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...
1 item(s)
End of Line
+
Add to wish list

£3.79 £2.71 (£3.25 UK, incl VAT)
3801-643
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...
1 item(s)
End of Line
+
Add to wish list

£4.94 £1.47 (£1.76 UK, incl VAT)
3801-624
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...
2 item(s)
End of Line
+
Add to wish list

£4.94 £1.47 (£1.76 UK, incl VAT)
3801-644
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...
2 item(s)
End of Line
+
Add to wish list

£5.62 £1.67 (£2.00 UK, incl VAT)
3801-625
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...
2 item(s)
End of Line
+
Add to wish list

£5.62 £1.67 (£2.00 UK, incl VAT)
3801-645
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...
2 item(s)
End of Line
+
Add to wish list

£6.28 £1.87 (£2.24 UK, incl VAT)
3801-626
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...
2 item(s)
End of Line
+
Add to wish list

£6.28 £1.87 (£2.24 UK, incl VAT)
3801-646
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...
2 item(s)
End of Line
+
Add to wish list

£8.09 £2.41 (£2.89 UK, incl VAT)
3801-627
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...
2 item(s)
End of Line
+
Add to wish list

£8.09 £2.41 (£2.89 UK, incl VAT)
3801-647
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...
2 item(s)
End of Line
+
Add to wish list

£9.91 £2.95 (£3.54 UK, incl VAT)
3801-628
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...
2 item(s)
End of Line
+
Add to wish list

£9.91 £2.95 (£3.54 UK, incl VAT)
3801-648
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...
2 item(s)
End of Line
+
Add to wish list

£12.56 £3.74 (£4.49 UK, incl VAT)
3801-629
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...
1 item(s)
End of Line
+
Add to wish list

£12.56 £3.74 (£4.49 UK, incl VAT)
3801-649
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...
1 item(s)
End of Line
+
Add to wish list

£25.16 £7.49 (£8.99 UK, incl VAT)
3801-630
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...
1 item(s)
End of Line
+
Add to wish list

£25.16 £17.97 (£21.56 UK, incl VAT)
3801-650
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...
1 item(s)
End of Line
+
Add to wish list