I am studying the description of QTR1-RC.
I have a great doubt: are you sure the when you put a HIGH on Vout the C charges and when you turn the uP IO on Vout in input the C discharges? I think that it is the contrary.

At the beginning Vout=INPUT and VIN=5V is Charged. When Vout is at HIGH there is a low imedance path at C terminals and the C discharge. When Vout is in Hi-impedence (uP in INPUT) the C charges again.



Hello, Antonio.

We deliberately use that phrasing because we feel it is the least confusing way to explain what is going on. You are correct that driving the output high will cause the capacitor to lose energy, but the effect is to raise the voltage on the output node, which is equivalent to the notion of “charging” the output node relative to ground. Usually, when you talk about discharging a capacitor, you are doing so relative to ground, so that the voltage on both sides of the capacitor is your reference voltage (0 V). However, the way the capacitor is used in this circuit is relative to VIN, which can be somewhat confusing to people who think of the term “charged” as corresponding to increased voltage and “discharged” as corresponding to ground. For this reason, we want to avoid a potentially confusing instruction like “drive the sensor output line high to discharge the capacitor, which causes the sensor to output high until the capacitor charges through the phototransistor”. That the capacitor charges (gains energy) or discharges (loses energy) isn’t really a significant point; rather, the concept we’re trying to get across is that you put a voltage (charge) on the output that then decays (discharges) at a rate determined by the reflectance.

- Ben