Should I Use Phototransistors or Photodiodes for Sensing?
Consider a spot image center with position varying over a pair of photodiodes producing signals A and B. The magnitude of A and B vary with target range AND reflectance, so the difference A-B is ambiguous with respect to range. However, the quantity (A-B)/(A+B) is independent of target reflectance. That is, we normalize the difference A-B by the total reflected signal. So, we can write:
f® = (A-B)/(A+B)
The sum and the difference terms are easily done with op amp circuits, but the division operation requires fancier circuits or digital computations. One popular signal processing approach is to logarithmically transform the terms, take the difference, then exponentiate to obtain f®. The Ham. Camera chips work this way. In addition, the chips use pulse timing to subtract off ambient light currents, i.e., the terms A and B represent only the additional signal produced by a briefly flashing LED. Since people don't expect their cameras to take millions of pictures, the camera makers get some of their performance by really blasting the LED…as much as a 10Amp pulse! The simplest chip models produce only a step output to drive a 4 to 7 position focus solenoid. The more complicated ones produce more steps and/or a voltage proportional to f®.
If you want a linear distance instead of f®, it's best to calibrate each unit, although the geometric derivation of an expression of the form R = g[f®] is straightforward. Most of us simply correct f® by means of a lookup table or best-fit polynomial.