1 Introduction
2 Setup
The diagram below shows the top view of a Minibot and the orientation of the three light sensors and two touch sensors (feelers). The two light sensors on the edges were used in differential mode, meaning the robot would drive forward and steer based on the error between these two sensors. The middle sensor (optional) was used to detect if the light source was directly in front of the robot. Finally, the two touch sensors acted as feelers to detect objects while the robot was wandering towards a light source.
If you are planning to build a robot similar to the Minibots, I highly recommend incorporating some type of light sensor to your system. IR detectors similar to the ones available from Radio Shack will suffice. Digikey (refer to this article for part numbers) and a host of other electronic component suppliers also stock a wide variety of light sensors. Assuming that you are using the Radio Shack brand IR detectors, the diagram below illustrates the interface between a sensor and the 68HC11E2 (BotBoard) microcontroller. Simply wire up the sensor in a voltage divider configuration and feed the signal (Va) into the A/D port of the HC11 as shown below. 3 Theory of Operation
4 Sample Software
The file light.asm, when downloaded to a robot similar to the Minibot is programmed to use two light sensors connected to ADR1 and ADR2 to scan and find an IR light source. I'm assuming that two servo motors are used for locomotion. Use a flashlight as a source of IR light. Refer to light.asm code for more details. The file light2.asm is a bit more complex. It requires the robot to have three IR sensors connected to ports ADR1, ADR2, and ADR3, where ADR2 is the middle sensor. In addition, two touch sensors are also used for object detection and avoidance (optional). The Mood LED is also optional and can be left out (see sample code for more details). The behavior of the program is simple. When no light source is picked up by the middle sensor (indicated by a certain threshold read from ADR2), the robot simply scans in a circle. Once light is detected by the middle sensor, which is below some threshold, then the robot begins to drive towards the source while monitoring its two edge light sensors and touch sensors. If the light level of the middle sensor is above the "detect light" threshold, then the robot will rotate in the direction of the greatest amount of light determined by the difference or error between the two edge light sensors. The process repeats. Along with the behavior of finding and driving towards a light source, the robot is capable of avoiding objects using its touch sensors. If either sensor is activated, the robot determines which sensor was tripped and avoids accordingly. Refer to sample code for more details. Have fun with this example.
|