The sensors are a critical part of a micromouse. Primus uses six infra-red reflective sensors. Here is code to test that they are working.Now that we have a nice display to show what the sensor reading are, we can get that module tested. Since the hardware is very simple, there is not a lot to go wrong. Yet somehow I had a dead sensor when I first tested the Primus prototype. It was a simple dry joint that would have been detected by more careful inspection of the board.This program just sets up the sensor hardware and activates each channel in turn. All six channels are then displayed on the screen as raw ADC values. there is no real need to scale these numbers. If it is working correctly, each channel should show values between nearly zero and about 700 or so.For best performance the sensors will need careful alignment. For now, just check that they are working. They should easily detect the presence of a wall at distances of 150mm and should not saturate until the wall is only about 35-40mm away.The reason the maximum value is only about 700 is that the TSL262 can only reach a maximum output value of around 3.5V. You should find that the sensors are relatively immune to ambient light levels although they will become less sensitive under very bright conditions. A black paper or card shield is needed over the TSL262s to reduce the effect of ambient light.The sensor module is also responsible for measuring battery voltage via a potential divider on the battery input. While not essential for use with NiMh or NiCd cells, it is particularly important that LiPo cells do not become discharged to too low a level. You program can monitor the battery voltage and sound an alarm or shut the mouse down if the battery voltage gets too low. The processor will carry on as long as the voltage into the regulator does not drop below about 7V so you should have plenty of time to avoid trouble.The project files can be downloaded here:

Primus4
Primus4
primus4.zip
523.6 KiB
15 Downloads
Details...

Leave a Reply

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