1. Introduction

<p class="note_warning">This guide is for an older version of the QTRSensors Arduino library (3.1.0). The current version of the library can be found <a href="https://github.com/pololu/qtr-sensors-arduino">on GitHub</a>, and its documentation is <a href="http://pololu.github.io/qtr-sensors-arduino/">here</a>.</p> <!-- table(side_by_side_pics). |<table class="picture_with_caption center"><tr><td style="max-width: 160px"><img alt="" class="" data-gallery-pictures="[{&quot;id&quot;:&quot;0J4428&quot;,&quot;caption&quot;:&quot;\u003cp\u003eQTR-L-1A reflectance sensors.\u003c/p\u003e&quot;,&quot;url_tiny&quot;:&quot;https://a.pololu-files.com/picture/0J4428.98x98.jpg?b754854c94f6723103f6c20d033e364e&quot;,&quot;url_medium&quot;:&quot;https://a.pololu-files.com/picture/0J4428.600x480.jpg?b754854c94f6723103f6c20d033e364e&quot;,&quot;url_full&quot;:&quot;https://a.pololu-files.com/picture/0J4428.1200.jpg?b754854c94f6723103f6c20d033e364e&quot;,&quot;longest_side&quot;:800}]" data-picture-id="0J4428" data-picture-longest_side="800" src="https://a.pololu-files.com/picture/0J4428.160.jpg?b754854c94f6723103f6c20d033e364e" /></td></tr><tr><th style="max-width: 160px"><p>QTR-L-1A reflectance sensors.</p></th></tr></table>|<table class="picture_with_caption center"><tr><td style="max-width: 180px"><img alt="" class="" data-gallery-pictures="[{&quot;id&quot;:&quot;0J625&quot;,&quot;caption&quot;:&quot;\u003cp\u003eQTR-1RC reflectance sensor.\u003c/p\u003e&quot;,&quot;url_tiny&quot;:&quot;https://a.pololu-files.com/picture/0J625.98x98.jpg?e821a1f5ecbf3a8e8f74d08e3343dbfa&quot;,&quot;url_medium&quot;:&quot;https://a.pololu-files.com/picture/0J625.600x480.jpg?e821a1f5ecbf3a8e8f74d08e3343dbfa&quot;,&quot;url_full&quot;:&quot;https://a.pololu-files.com/picture/0J625.1200.jpg?e821a1f5ecbf3a8e8f74d08e3343dbfa&quot;,&quot;longest_side&quot;:677}]" data-picture-id="0J625" data-picture-longest_side="677" src="https://a.pololu-files.com/picture/0J625.180.jpg?e821a1f5ecbf3a8e8f74d08e3343dbfa" /></td></tr><tr><th style="max-width: 180px"><p>QTR-1RC reflectance sensor.</p></th></tr></table>| <table class="picture_with_caption center"><tr><td style="max-width: 150px"><img alt="" class="" data-gallery-pictures="[{&quot;id&quot;:&quot;0J615&quot;,&quot;caption&quot;:&quot;\u003cp\u003eQTR-8A reflectance sensor array.\u003c/p\u003e&quot;,&quot;url_tiny&quot;:&quot;https://a.pololu-files.com/picture/0J615.98x98.jpg?ef5903b25450c25de151ed9b43d1fce3&quot;,&quot;url_medium&quot;:&quot;https://a.pololu-files.com/picture/0J615.600x480.jpg?ef5903b25450c25de151ed9b43d1fce3&quot;,&quot;url_full&quot;:&quot;https://a.pololu-files.com/picture/0J615.1200.jpg?ef5903b25450c25de151ed9b43d1fce3&quot;,&quot;longest_side&quot;:800}]" data-picture-id="0J615" data-picture-longest_side="800" src="https://a.pololu-files.com/picture/0J615.150.jpg?ef5903b25450c25de151ed9b43d1fce3" /></td></tr><tr><th style="max-width: 150px"><p>QTR-8A reflectance sensor array.</p></th></tr></table>| | --><table class="picture_with_caption center"><tr><td style="max-width: 400px"><a href="https://a.pololu-files.com/picture/0J4642.1200.jpg?9ae24a3959a88fee8dd66d333023e2dc" class="noscript-fallback"><img alt="" class="zoomable" data-gallery-pictures="[{&quot;id&quot;:&quot;0J4642&quot;,&quot;caption&quot;:&quot;\u003cp\u003eQTR sensor size comparison. Top row: QTRX-HD-07, QTR-HD-07; middle row: QTR-3, QTR-1, QTR-L-1; bottom row: QTR-8.\u003c/p\u003e&quot;,&quot;url_tiny&quot;:&quot;https://a.pololu-files.com/picture/0J4642.98x98.jpg?9ae24a3959a88fee8dd66d333023e2dc&quot;,&quot;url_medium&quot;:&quot;https://a.pololu-files.com/picture/0J4642.600x480.jpg?9ae24a3959a88fee8dd66d333023e2dc&quot;,&quot;url_full&quot;:&quot;https://a.pololu-files.com/picture/0J4642.1200.jpg?9ae24a3959a88fee8dd66d333023e2dc&quot;,&quot;longest_side&quot;:934}]" data-picture-id="0J4642" data-picture-longest_side="934" src="https://a.pololu-files.com/picture/0J4642.400.jpg?9ae24a3959a88fee8dd66d333023e2dc" /></a></td><p></tr><tr><th style="max-width: 400px"><p>QTR sensor size comparison. Top row: QTRX-HD-07, QTR-HD-07; middle row: QTR-3, QTR-1, QTR-L-1; bottom row: QTR-8.</p></th></tr></table></p> <p>The Pololu QTR reflectance sensors carry infrared LED and phototransistor pairs that can provide analog measurements of IR reflectance, which makes them great for close-proximity edge detection and line-following applications. The modules come as compact, single-sensor units (<a href="/product/2458">QTR-1A</a> and <a href="/product/2459">QTR-1RC</a>; <a href="/product/2454">QTR-L-1A</a> and <a href="/product/2455">QTR-L-1RC</a>), 3-sensor arrays (<a href="/product/2456">QTR-3A</a> and <a href="/product/2457">QTR-3RC</a>), or as 8-sensor arrays (<a href="/product/960">QTR-8A</a> and <a href="/product/961">QTR-8RC</a>) that can be optionally split into a 2-sensor array and a 6-sensor array.</p> <p>The modules are available in two different output formats: the QTR-xA outputs an analog voltage between 0 and Vcc that can be measured by an analog-to-digital converter (ADC), and the QTR-xRC outputs require a digital I/O line capable of driving the output line high and then measuring the time for the output voltage to decay (which provides an analog measurement of reflectance).</p> <table class="side_by_side_pics"> <tr> <td><table class="picture_with_caption center"><tr><td style="max-width: 200px"><img alt="" class="" data-gallery-pictures="[{&quot;id&quot;:&quot;0J4433&quot;,&quot;caption&quot;:&quot;\u003cp\u003eQTR-L-1A reflectance sensor schematic diagram.\u003c/p\u003e&quot;,&quot;url_tiny&quot;:&quot;https://a.pololu-files.com/picture/0J4433.98x98.jpg?e738d61d87595c2b0ece249fc21fb152&quot;,&quot;url_medium&quot;:&quot;https://a.pololu-files.com/picture/0J4433.600x480.jpg?e738d61d87595c2b0ece249fc21fb152&quot;,&quot;url_full&quot;:&quot;https://a.pololu-files.com/picture/0J4433.1200.png?e738d61d87595c2b0ece249fc21fb152&quot;,&quot;longest_side&quot;:300}]" data-picture-id="0J4433" data-picture-longest_side="300" src="https://a.pololu-files.com/picture/0J4433.200.jpg?e738d61d87595c2b0ece249fc21fb152" /></td></tr><tr><th style="max-width: 200px"><p>QTR-L-1A reflectance sensor schematic diagram.</p></th></tr></table></td> <td><table class="picture_with_caption center"><tr><td style="max-width: 200px"><img alt="" class="" data-gallery-pictures="[{&quot;id&quot;:&quot;0J630&quot;,&quot;caption&quot;:&quot;\u003cp\u003eQTR-1A reflectance sensor schematic diagram.\u003c/p\u003e&quot;,&quot;url_tiny&quot;:&quot;https://a.pololu-files.com/picture/0J630.98x98.jpg?0338402f14f65ad38bf92790ff6b2cde&quot;,&quot;url_medium&quot;:&quot;https://a.pololu-files.com/picture/0J630.600x480.jpg?0338402f14f65ad38bf92790ff6b2cde&quot;,&quot;url_full&quot;:&quot;https://a.pololu-files.com/picture/0J630.1200.png?0338402f14f65ad38bf92790ff6b2cde&quot;,&quot;longest_side&quot;:300}]" data-picture-id="0J630" data-picture-longest_side="300" src="https://a.pololu-files.com/picture/0J630.200.jpg?0338402f14f65ad38bf92790ff6b2cde" /></td></tr><tr><th style="max-width: 200px"><p>QTR-1A reflectance sensor schematic diagram.</p></th></tr></table></td> </tr> </table> <table class="picture_with_caption center"><tr><td style="max-width: 200px"><img alt="" class="" data-gallery-pictures="[{&quot;id&quot;:&quot;0J631&quot;,&quot;caption&quot;:&quot;\u003cp\u003eQTR-1RC and QTR-L-1RC reflectance sensor schematic diagram.\u003c/p\u003e&quot;,&quot;url_tiny&quot;:&quot;https://a.pololu-files.com/picture/0J631.98x98.jpg?ae9455b459ff6470ff8055966838a530&quot;,&quot;url_medium&quot;:&quot;https://a.pololu-files.com/picture/0J631.600x480.jpg?ae9455b459ff6470ff8055966838a530&quot;,&quot;url_full&quot;:&quot;https://a.pololu-files.com/picture/0J631.1200.png?ae9455b459ff6470ff8055966838a530&quot;,&quot;longest_side&quot;:300}]" data-picture-id="0J631" data-picture-longest_side="300" src="https://a.pololu-files.com/picture/0J631.200.jpg?ae9455b459ff6470ff8055966838a530" /></td><p></tr><tr><th style="max-width: 200px"><p>QTR-1RC and QTR-L-1RC reflectance sensor schematic diagram.</p></th></tr></table></p> <p>Please see the <a href="/category/123/pololu-qtr-reflectance-sensors">product pages</a> for more information on how these sensors work.</p> <p>This document will explain how to install Arduino libraries for the Pololu QTR reflectance sensors, and it will provide sample sketches as well as links to library documentation. The libraries will give you everything you need to interface with a QTR-8x reflectance sensor array or multiple QTR-1x reflectance sensors, including advanced features like automatic calibration and, in the case of line detection, calculation of the line&#8217;s position.</p>

New Products

0.100″ (2.54 mm) Breakaway Male Header: 1×4-Pin, Right Angle, Black, 50-Pack
24V Step-Up Voltage Regulator U3V9F24
JST SH-Style Connector Board for Micro Metal Gearmotors, 2-Pin, Side-Entry (2-Pack)
ACS72981ELRATR-200B3 Current Sensor Compact Carrier -200A to +200A, 3.3V
Pololu Reverse Voltage Protector, 4-60V, 12A
JST SH-Style Connector Board for Micro Metal Gearmotors, 2-Pin, Back-Entry (2-Pack)
JST SH-Style Cable, 4-Pin, Single-Ended Female, 75cm
Pololu RC Switch with Isolated Solid State Relay/Switch, SPST, 30V, 10A
QTRXL-MD-01RC-S Reflectance Sensor: 1-Channel, 8mm Wide, RC Output, Long Range, Side-Entry Connector
3.3V, 100mA Step-Down Voltage Regulator D45V1E1F3
Log In
Pololu Robotics & Electronics
Shopping cart
(702) 262-6648
Same-day shipping, worldwide
Menu
Shop Blog Forum Support
My account Comments or questions? About Pololu Contact Ordering information Distributors