![]() |
Sensors Mice need a way of detecting the walls within the maze and most use near infrared sensors to do this. These IR sensors can either be simple proximity sensors or they can be distance sensors.
Proximity Sensors These types of sensors are usually mounted on "wings" so that they can look down onto the tops of the walls. If there is a wall directly below the sensor, it returns a logic value of true. If there is no wall below the sensor, the logic value is false. This type of mouse would look similar to this:
It has at least one sensor in the front and at least three sensors to each side. The front sensor prevents the mouse from crashing into an oncoming wall. The side sensors map the walls and allow the mouse to correct its heading. Using the drawing above as an example, if the left wing were read we would get a value of 010 indicating that the mouse is centered within the cell. If a value of 100 is read, it would indicate that the mouse is too far to the right and needs to correct to the left. If a value of 001 is read, it would indicate that the mouse is too far to the left and needs to correct to the right. These types of sensors also have another advantage. If the right wing is read in the drawing above, the value would be 011. Since the spacing between the sensors is such that the width of wall can only trigger one sensor at a time, a value of 011 would indicate that there is also a perpendicular wall to the right. Mapping walls in adjacent cells could result in less exploration time. Proximity sensors are easy to implement. The emitter portion would look like this:
![]() The resistor R is chosen to establish the proper current through the LED. Instead of connecting it directly to a constant +5 volts, another choice would be to connect it through a transistor which can be turned on by the microcontroller. That way, the LED's could be turned on by the microcontroller only when the sensors need to be read. The sensor portion would look like this:
![]() In order for the phototransistor to act like a switch it needs to be driven into a saturated condition. When the sensor is to be connected to CMOS logic a resistor value of approximately 10K would be a good choice. The LED and sensor can be separate components, or they can be housed together in a plastic package: ![]() If you will be competing against other schools, make sure that the height of your sensor wings are adjustable. The walls within the maze at the other school might be a little taller, shorter, etc. Although the rules specify the size and tolerances of the walls, you just never know what you'll find when you get there. The last thing you want to hear during a competition is a scraping sound as your mouse moves around.
Distance Sensors Unlike the proximity sensors, distance sensors do not return a simple true / false value. These sensors measure the physical distance between the mouse and the wall and return an integer value which the microcontroller can convert into a real world distance value. One way to implement this type of sensor is to use a circuit similar to the proximity sensor. The big difference is that the phototransistor is not forced into saturation but is used as an amplifier which produces a voltage that is proportional to the amount of light it sees. The sensor shines a light on the side of the wall and measures the light that is reflected back. The closer the mouse is to the wall, the brighter the reflected light will be. The microcontroller then uses an analog to digital converter to convert the signal from the phototransistor into an integer. Another popular method of measuring distance is to use a special sensor like the Sharp GP2D12.
These sensors shine an IR light onto the wall which is then reflected back onto a position sensing device. As the distance varies between the sensor and the wall, the angle of reflection changes and the light strikes different parts of the PSD. The circuit inside the sensor then converts this into an 8 bit integer which is transmitted serially to the microcontroller. This type of sensor is more immune to variations in wall color and lighting conditions. If you're using either type of IR sensor, make sure that you test them in a very bright room. One of the competitions we attended was held underneath a large sky light which flooded the maze with sun light. At the very least your sensors should have a purple lens over the detector to filter out most visible light. If this is not enough, you will need to pulse the emitters and add a resistor / capacitor high-pass filter to the output of the sensor to filter out unwanted signals.
Summary The proximity sensors are easier for first-time mousers to build and use since they do not use analog-to-digital conversion. Mice with distance sensors, on the other hand, are more compact and are less likely to miss reading the walls. In either case, test your sensors under various lighting conditions and, if possible, in several different mazes. |