A line tracker to detect and follow a white line
This sensor module is composed of 8 pairs of Infrared LEDs and phototransistor mounted with a spacing of 9.5mm. This makes this module an excellent line tracker for robots. The pairs of LEDs are placed in series so as to reduce current consumption by half and a MOSFET transistor makes it possible to deactivate the LEDs to either save energy or obtain an infrared sensor. Each sensor produces a measurable output on a digital input/output.
All of the QTR-8RC's sensors (reflection detection) are intended to be used as line detectors but can also be used as general purpose proximity sensors or reflective surface sensors. The module supports 8 infrared emitters and 8 infrared sensors (phototransistor) mounted in pairs and spaced 9.525 mm.
To use the sensor, you must first activate the reading pin of your microcontroller as output to charge the capacity of the node by applying a voltage to the OUT pin. You can then read the reflectance (Wikipedia.fr) by re-reading the voltage on this pin by reconfiguring the pin of your microcontroller as input. Once the pin of the microcontroller reconfigured as an input, the capacity will discharge through the photo-transistor ... this discharge doing this more or less quickly depending on the reflecting surface exciting the phototransistor.
The voltage on the OUT pin will drop more or less quickly. It is therefore sufficient to measure the time necessary for the voltage to drop enough to bring the OUT pin back to the low state. This time is a good indicator of the infrared light returned to the infrared sensor (photo-transistor) and therefore of the type of reflecting surface under the sensor.
A short decay time means greater reflection of the surface.
This approach to carrying out measurements has several advantages, more particularly with this module capable of deactivating its infrared LEDs:
- No need for a digital/analog converter (ADC).
- Improves sensitivity compared to an analog output with voltage divider bridge.
- It is possible to read several sensors at the same time (on most microcontrollers).
- Reading in parallel optimizes the activation of the LEDs and optimizes consumption.
All the outputs are independent but the LEDs are connected in series in pairs (to divide consumption by two). The LEDs are controlled by a MOSFET with the gate maintained at VCC using a pull-up resistor. This deactivates the LEDs by reducing the potential of the MOSFET gate to 0 volts (low level). Being able to deactivate the LEDs can be advantageous to limit the power consumed by the project when the sensor isn't used. It's also possible to control the brightness of these using a PWM signal.
This sensor is designed so that the board is placed parallel to the surface to be monitored.
The current limiting resistors of the LEDs are designed for operation at 5 V. These resistors are organized in two stages; which allows to bypass a stage to authorize the operation at 3.3 V. The current of an LED is approximately 20–25 mA, which represents a total operating current of 80-100mA for the whole module.
- Dimensions: 74.93mm x 12.7mm x 3.175mm (without pinHeader)
- Operating voltage: 3.3-5.0 V
- Operating current: 100 mA
- Outputs: 8 outputs compatible with digital I/O wich can be read as pulses (timed high pulse)
- Optimal reading distance: 3 mm
- Maximum reading distance: 9.5 mm
- Weight: 3.09 g (without pinHeader)
Interface the outputs of the QTR-8RC to digital inputs
The output of the QTR-1RC (yellow) when the sensor passes over a black line (at 3.1mm) and correspondence of the pulse time of this output on a microcontroller (blue).
The output of the QTR-1RC (yellow) when the sensor passes over a white surface (at 3.1mm) and correspondence of the pulse time of this output on a microcontroller (blue).
The QTR-8RC module has 8 identical outputs (only one output for the QTR-1RC) and requires digital outputs capable of controlling an output to produce a HIGH signal and then passing this pin as input to measure the time required for the voltage to fall.
The sequence to use to read a sensor is as follows:
- Turn on the infrared LEDs (optional).
- Place the digital line as output (OUTPUT mode) and place the line at the HIGH level.
- Wait at least 10 μs to allow the node to charge.
- Place the digital line as input (high impedance).
- Measure the time that was needed for this line drops back to the low level.
- Turn off the infrared LEDs (optional).
In general, these steps are performed in parallel on the multiple input/output lines of the module.
With a high reflectance, the voltage decay time can be a few tens of micro-seconds;
Without any reflectance, the voltage decay time can be several milliseconds.
The exact decay time depends on the characteristics of the lines of your microcontroller (the impedance of the line when it's configured as input).
Significant results are obtained within 1 ms for typical cases (except when trying to measure a subtle difference in low reflectance scenarios), which allows sampling of the 8 sensors at a frequency of up to 1 kHz. If low frequency sampling is sufficient, substantial power can be saved by deactivating the Infrared LEDs. For example, for a sampling at 100 Hz, the LEDs can be deactivated for 90% of the time, which reduces the average consumption by 10mA (instead of 100mA).
Split the module in half
If you don't need 8 sensors (or if you don't have enough space to mount them), you can split the module into two sections (one of 6 sensors and the other of 2 sensors) as shown below. The board can be incised on both sides (along the perforations) and then be bent until it's split. Each of the two resulting pieces can be used as an independent sensor.
The module is delivered with a pinHeader section (connector) and a resistor of 100 Ohm.
You can split the pinHeader section into smaller pieces for the welders, at your convenience, on the sensor module. You can also get an angled pinHeader (at right angles) to change the arrangement of your connections or opt for a more compact assembly.
Resistor is necessary to make the sub-sensor functional (with 2 phototransistors) once it's separated from the original module. This resistor is only necessary if you split your module in half.