The simple sensor circuit described by Ng Beng Kiat seems to give the best results.On his web site (http://www.np.edu.sg/alpha/nbk/) Beng Kiat describes Min4, one of his recent mice. In there is a PDF with schematics for the mouse. The sensor circuit for Primus is essentially the same except for a couple of component value changes. The emitters are run in series pairs from the 5V supply. Not shown here, a ULN2003 darlington driver does the switching.
The TSL262 is used as a detector. Although Beng Kiat’s circuit shows a Shottky diode, it is omitted from this version as tests indicate they serve no apparent purpose in this design. Another change is to the values of the AC coupling components. This has little discernable effect on the circuit operation but 33nf ceramic capacitors in a suitable size are relatively hard to come by whereas 100nF items are cheap and plentiful as they are used universally for power supply decoupling.
A simple test rig for this circuit allowed me to generate a graph of analogue reading against distance. The ADC is operating in 10 bit mode so full scale is 1023. Note that the TSL262 cannot bring its output above about 3.75V. although the data sheet indicates that this can be extended with a resistor from the output to Vdd, it seems to have little effect in this circuit.
While very non-linear, beyond abut 30mm, the results are completely monotonic. That is, as distance increases, reading always decreases. Closer than 30mm, the physical arrangement of the sensor assembly prevents the sensor from seeing the spot of light. It is not a good idea to compensate too much for this as we can arrange that the sensors are only used at distances greater than 40mm from a wall. Notice that it is quite easy to detet the presence of a wall at distances of at least 120mm. there is not, however, enough of a response to be sure of seeing a wall in an adjacent cell.