![]() |
||||
Measuring RPM via Photo reflector
Computer
Interface
|
Infrared Sensors and Sensor Circuits In order for the robot to determine its position in the house, some kind of proximity sensing device is needed. After some consideration, an infrared system was chosen for its simplicity. Other types of sensors (specifically ultrasonic) do give higher degrees of accuracy when measuring distance; however, infrared remains a simple and sufficient solution at a lower price tag. Additionally, the infrared sensing devices are available locally. Infrared phototransistors function by using light to stimulate the electrons in the base of a transistor. Simply put, when light falls onto the device, the transistor becomes "closed" and current is allowed to flow from collector to emitter. Similarly, when the device is in complete darkness, the transistor is "open" and the collector current is zero. The amount of collector current is directly related to the amount of light on the device. Because the infrared component of ambient light (or normal room light) may change depending on several uncontrollable environmental factors, the ambient light alone cannot be used for proximity sensing. Rather, an infrared light emitting diode (IR LED) is used to provide a more usable level of IR to the phototransistor. When the IR LED is forward biased, IR light will emit out of the device and reflect off the white walls back to the phototransistor. Because light intensity falls off as a function of distance, the amount of IR sensed by the transistor is directly related to the distance to the reflecting surface. All transistors, however, have a limited operating region. Specifically, a phototransistor's collector to emitter voltage will only vary within a certain range of light intensities. To prove that the IR sensors would be sufficient for proximity detection, a series of tests were performed and measurements were recorded. In each test, a phototransistor was biased with a different collector resistor to determine an adequate resistance value. The results of the tests were graphed as transistor voltage as a function of wall distance. Figure 4 shows these results. The project nature requires that the sensors have good resolution at relatively close ranges. Although the 10k and 20k Ohm resistors gave a smooth range of values between 3 and approximately 16 inches, it was decided that a low-range cut-off of 3 inches would not suffice. The 5k Ohm resistor performed better in that it gave a lower cut-off point of approximately 2 inches, while the 1k Ohm resistor failed to detect the wall at approximately 5 inches. The measurements show that a 3k Ohm resistor provides the perfect bias: A moderately smooth change in transistor voltage occur between 1.5 and 8 inches. Because the critical robot movements occur in the 18 inch-wide hallways and the robot is 12 inches wide, the side sensors will be able to accurately determine the distance to each wall. It should be noted, though, that the above graph reflects sensor measurements taken with a small flashlight illuminating the wall surface. Because a flashlight bulb can provide a large amount of IR, it was the first choice for the infrared source. It was later discovered that the flashlight bulbs would be a poor choice for two reasons. First, the bulbs have a slow on-off time, so slow that it is visible to the human eye. With the large number of sensor readings that the robot must make, the slow switching becomes intolerable. Second, the bulbs draw far too much current at approximately 1A per bulb. With 7 bulbs (one for each corresponding sensor), the current drain would become too much for a small mobile robot of this kind. The solution was to repeat the above process using IR LEDs instead of flashlight bulbs, take measurements, and produce a similar graph. From this graph, the designers were able to determine that a 15k bias resistor would be needed to work well with the IR LED. Because the LEDs emit far less IR light than the flashlight bulbs, the phototransistors must be biased differently. Initially, a simple proximity sensing solution was implemented using a IR LED and phototransistor pair. This method was adequate, but performed rather poorly when subjected to differing ambient light conditions. It was decided that an improved solution must be constructed. In order to cancel out the effects of ambient light, a form of heterodyne modulation of the IR signal is used. Figure 5 shows the demodulation circuit. The circuit theory is straightforward. The 68HC12 uses one of the built-in pulse-width modulation (PWM) channels to strobe the base of a TIP112 power transistor and flash an IR LED at a frequency of 1kHz. The signal received at the phototransistor will be comprised primarily of a DC level (from ambient light), a 120Hz signal (from standard room lights), and the 1kHz signal emitted by the IR LEDs. The idea then is to filter out the unwanted signals and obtain only the 1kHz "carrier". The intensity of the 1kHz signal can then be used to give an accurate indication of how far the robot is from a certain wall in the house. A 741 operational amplifier is used to create a bandpass filter for phototransistor signal. This circuit was designed around a high-pass filter from the AARL handbook. By adding a capacitor in the positive feedback path, the lower frequencies can be restricted. The result is a bandpass filter. The output of the bandpass filter is the recovered 1kHz signal. However, this signal cannot be read directly by the analog to digital converter on the 68HC12 because it swings to negative voltages. To make this signal useful, the signal must be converted to a relative DC level (or intensity level). In order to do this, the output of the 741 is passed through a diode that acts as a half-wave recitifier. The result is a waveform comprised of only positive levels. This signal is then passed over a 47uF capacitor to ground in order to smooth the signal to a near-DC level. The 10k parallel resistor provides a current path for the voltage stored in the capacitor, so that the voltage can change rapidly. Because the filter may output signals greater than 5V, a 5V zener diode is used to clip the output at 5V. By connecting the analog to digital input of the 68HC12 to the output of the filter, an accurate measurement of a wall distance can be obtained. Most importantly, the measurement will not be influenced by the amount of ambient light in the house. As stated previously, there are 4 sensor channels that utilize the above-described modulation/demodulation technique. These correspond to the right, left, front, and back wall sensors. The floor sensor, however, need only be capable of determining if a white line is present. In other words, the floor sensor measurement is converted to a binary value (present, not present), and therefore modulation is not necessary. The candle detection circuit also implements a phototransistor. However, because a candle emits a substantially large amount of IR, an IR emitter is not required. When the phototransistor is directly pointed at a lit candle, the collector to emitter voltage drops approximately 1.7V at a distance of 24 inches. Even at a distance of 3 feet, there is a significant drop in voltage to be detected by the microcontroller's A/D and to indicate the presence and direction of the candle. These specifications are within the requirements of the project. To further improve the directionality of the candle sensor and to improve its distance threshold, a reflective parabolic dish was placed around the candle sensor. By using a simple phototransistor for candle detection, the robot will be able to determine if the candle is present from the doorway of any room. |
|||