My micromouse, Decimus 2A, has not been behaving well. The most notable problem is that detection of the wall ahead, and the distance to that wall has been erratic. Worse, the problem seems to come and go. For a while I thought I might have damaged an emitter or had a dry joint but, when I looked again at the calibration figure, the left front sensor was giving a reading much smaller than the right front sensor…

Tobe test the damaged emitter idea, I replaced both emitters. Testing showed that the old, removed emitters gave the exact same response as the new, replacement emitters. No amount of poking and prodding or changes to the supply voltage could make the sensor reading alter. The emitter mounts were stable so it was not an alignment issue. the only thing left was the detectors – TSL252 devices. When I replaced those, I suddenly had consistent readings again.

I cannot think of any feasible failure mode for the detectors but changing hem made the problem go away. Unfortunately, I threw them away and can no longer perform tests on the old devices to see if they really were different.

So, what did the problem look like?

The sensors are common reflective types and the response is linearised to give me a largely linear value for distance from the sensor. As they were, a typical response looked like this (raw values are takend from the ADC, others are linearised):

original micromouse front sensor response

You can clearly see that the left sensor response is smaller. A consequence of this is that the slope of the linearised result is different and that the signal to noise for the left sensor falls off quite badly as the distance gets more than 100mm. You can see that as more noise on the result. Since the mouse sensors are about 150mm away from the wall at the point where I want to check it while exploring, the answer can be badly affected by noise. In fact, the sensor response now consists of things like backscatter from the floor and other effects as much as from the wall. That, I think, is one of the reasons for odd crashes into walls ahead. If I had realised earlier, I could have just ignored the left sensor reading for that purpose.

After replacing the emitters and the detectors, as well as changing the alignment of the emitters to point almost directly forwards, the response looks like this:

Replacement front micromouse sensor response curvesNow it is clear that the sensors give a larger response and that they are more closely matched ove the majority of the working range. The two linearised responses are almost identical. Note that below 10mm the separation of the emitter and detector make it difficult to get a good response.

The change in alignment will mean an alteration to some steering code but hopefully, the poor detection of walls ahead, and the subsequent crashes, should be more rare in future.

This Post Has One Comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.