Description of how qtr sensors work

This seems like a picky issue but I believe that the description of how the QTR sensors work has the words Charge and Discharge reversed.

Basically, to run the sensor, you set the digital I/O to OUTPUT and hold it high. This in effect Discharges the capacitor since it is tied to +5v, and not ground.
When you switch the digital I/O to INPUT and wait for the line to go LOW, you are measuring the time it takes the photo transistor to charge the capacitor with enough voltage to present a LOW at the output.

If I am wrong, please explain. This has been bugging me for a while since there are many people who rely on these descriptions to further understand how the electronics work.


I agree that there is something wrong with the description and that the terms charge and discharge have been reversed.
However, the description agrees with the oscilloscope trace shown here: which looks like a capacitor discharge. However, it is not a discharge curve.

Here is how I think about it:

As you have pointed out, based on the diagram, putting the IO line to high discharges the capacitor by connecting it to Vcc.

Then after switching the IO pin to an input, the phototransistor would act as a constant current sink based on the light input to the base junction. A current source or sink has very large impedance and the charge on the capacitor is initially zero (so the voltage across it is zero) and so Vcc initially appears at the phototransistor collector junction.

As the capacitor charges, the voltage drop across it increases (Q = CV) and consequently the phototransistor collector voltage decreases, which agrees with the scope trace.

Hello, griffin2003.

This has come up a few times. Here is my most recent response:

- Ben

Since this question keeps coming up, the “simplified explanation” is bothersome and ultimately confusing for those who really want to learn.

Ben, perhaps you could put a footnote somewhere leading to a more detailed, correct explanation of how the circuit functions. It is a pretty cool and nonobvious circuit, by the way, and I like that it is fast!

Hi, Jim.

I’m pretty swamped getting ready for our upcoming Black Friday sale, but I have added this to my to-do list.

- Ben

Hello, Jim.

We have changed the descriptions of the QTR-xRC sensors on our website to be less confusing. The QTR-1RC and QTR-L-RC pages have a new “How it works in detail” section. The following pages and documents were also updated:

(We didn’t update the product page for item 959 because it is discontinued.)