Many mice use Infrared reflective sensors. They are relatively easy to design
and build and the parts are easy to come by. There are, of course, pitfalls.
A competition maze is likely to be extremely well lit. It will be even better
lit if there are film or TV crews present. If your sensors will not work
in this environment give some thought to building them some appropriate
shades. There may be other IR devices out there, some of them surprisingly
powerful. Autofocus from cameras has been known to upset the odd mouse.
While I refer to IR here, some folk prefer visible light as they can
at least see what is going on. It probably makes little enough difference
– just be sure that the detectors are suitably matched for wavelength.
A major problem with any reflective sensor is that the nature of the
surface can have a large effect on the size of the reflected signal. I
read of one maze where the posts were significantly less reflective than
the walls and some mice that relied on detecting the edges of cells got
lost as a consequence. In another case, the red paint on the top of the
walls turned out to be quite a good absorber of IR.
Reflective sensors really need to be AC coupled and synchronously detected
to avoid problems caused by high ambient light levels, flashguns and the
like. All this means is that you fire off the emitter, wait a bit an then
read the detector. The output of the detector goes through a capacitor
to filter out any steady state levels.
Suitable circuits can be found in the sections on each type of sensor.
Side-looking sensors really need to return an analogue signal whereas
top-down sensors are more likely to produce a digital output. There is
no reason why you cannot quantise side-looking sensor outputs to emulate
the action of top-down sensors.
There are two particularly unpleasant aspects to the use of reflected
light for detecting and sensing the positions of objects.
The radar equation
The first of these is the fact that light spreads out from the emitter.
It also spreads out from the reflector. The result is that the returned
intensity is significantly less than that radiated. Best case, it will
be proportional to the inverse square of the emitted signal if reflected
from a plane reflector, directly toward the receiver. Worst case is an
inverse fourth power response.
It is not hard to detect weak IR signals – after all, your TV remote
has no trouble most of the time and can even be bounced of the walls.
The problem lies in the non-linearity of the response. If you can detect
weak signals from distant walls you may be swamped by the strong response
of nearby walls. Non-linear amplifiers can be used to overcome this. Alternatively,
you could measure and use a lookup table in software to linearize your
readings. Remember the aim is to get a reliable, repeatable and accurate
measure of distance.
The cosine law
The second problem is the cosine law. This is just a way of saying that
the level of reflected light depends strongly upon the angle at which
it is reflected. The shinier the surface, the worse this problem becomes
as more light is reflected and less is scattered. In the extreme, a mirror
will only reflect in one direction.
The result of all this is that any measurement of distance (or even existence)
can be hopelessly affected by the angle of the sensors. This is dealt
with a little more in the section of side-looking wall sensors.