The simple kind of reflective wall sensors have a number of limitations. Chief among these is that they are very dependent upon the reflectivity of the walls. When you watch a mouse that uses these sensors, you can sometimes see it stear around dark or light patches. This is not very robust behaviour – especially at speed.
It would be nice if we could somehow eliminate this variability. Dave Otten’s sensor design used a Position Sensitive Device of the kind specifically designed for this task. These are very effective albeit somewhat more complicated to construct and use.
A little thought will reveal that, if we can compare two sensors pointing at the same bit of wall but seeing different amounts of light, the ratio of the two readings should eliminate variability due to reflectivity. There are still plenty of problems to overcome but it was not unitl Duncan Louttit presented a paper on this kind of sensor at Minos’04 that I thought very seriously about them.
The basic arrangement would be something like this:
Sensor a is closer to the wall than sensor b. The difference in the amount of light seen by each will depend upon the distance, x, from the wall.
If we can combine the two readings in a suitable manner, the effect of reflectivy will go away. The question is how do we do that.
Duncan’s paper can be found here:
I have been playing around with the maths to try and make the process a bit simpler. My observations are in a PDF file here.
I have dumped it into a PDF because it is full of unpleasant formulas. I will turn it back into a web page one day.
The long and short of it is that I think you can obtain a linear function of distance by using differential sensors and only one multiply, one divide and a subtraction per measurement.
Where a(x) and b(x) are the sensor readings, and d is a constant, nominally the distance between the sensors. In practice, d would be chosen to produce an appropriate output scale.
There are still plenty of things that will make this kind of sensor unreliable. Not the least of them is the actual A/D sampling process. Since the samples are unlikely to be taken simultaneously, there will be some error due to both incident light modulation and simply because the mouse will have moved between samples. Or at least, it better had.