Tutorial - Control of a single IR Sensor

I just posted a new tutorial that describes the operation of the 3Pi IR sensors.


This is a code example for operating an IR sensor without calling
the PololuQTRSensors Library. The code essentially follows the typical
sequence for reading the sensor that is listed on the QTR-1RC page:

1. Set the I/O line to an output and drive it high
2. Allow at least 10 us for the 10 nF capacitor to charge
3. Make the I/O line an input (high impedance)
4. Measure the time for the capacitor to discharge by waiting for the
   I/O line to go low


1 Like

Hi Dan,

Thank you for sharing your tutorials with us! I have added a link to your 3pi tutorials site from our community projects page and from the 3pi resources tab.

Do your projects assume that one has first reconfigured their Arduino IDE as described in our programming the 3pi from the Arduino environment app note? If so, it might be helpful if you mentioned so in your introduction (or made an initial tutorial talking about how to get things set up) and perhaps provide a link to the document (since the Arduino IDE requires modification to work with the 3pi, and the 3pi user’s guide does not talk about the Arduino IDE).

Also, I think it’s worth noting that while the reflectance sensors on the 3pi are very similar to our qtr sensors, they are not identical, so the schematic you show on your tutorial page is not entirely accurate. For example, the capacitors on the 3pi sensors are 2.2 nF, not 10 nF, and while the LEDs are powered from VBoost, they are connected in series, which means the LED current is actually a lot lower than one would deduce from the schematic you show. The 3pi user’s guide has a more appropriate schematic diagram of one of the sensors, and you can see how all of the sensors are connected here.

- Ben

Hi Ben -

Thanks for all the comments! I will make sure to incorporate them into my projects. Its nice to get feedback…

All the best,