Our strategy requires two types of measurements to be made on the infrared beacons: the frequency of the beacon is needed to determine which color of ball should be shot through the hole we are looking at, and the amplitude of the signal is required for aiming the robot at the hole.
We chose to use an IR photodiode as the sensing element as opposed to a phototransistor because the diode has faster response times than the transistor (which was potentially important for sensing the 11kHz signal), and because we seemed to be able to get better results sensing the beacon output at the required distances with the photodiode than we did with the phototransistor.
The circuit we chose to use for signal conditioning is a multi-phase op-amp circuit based largely off of the example circuits presented in Introduction to Mechatronic Design, pp. 378–349. This circuit consists of four main stages: the photodiode amplification, gain stages, edge detector (Schmitt trigger), and peak detector. A rail splitter is also used to provide a virtual reference ground halfway between the two rails. We chose to use the LM6144 op-amp for its high speed and rail-to-rail input-output operation. The complete schematic for our circuit is shown in the following figure, and each of the stages is explained in greater detail below. The schematic is also available for download on the github repository.
The photodiode amplifier (labeled "Trans-Resistive Stage" in the schematic) circuit was taken from The Art of Electronics, pg. 253. The photodiode is oriented pointing from the non-inverting input to the inverting input of the op-amp (anode on pin 10, cathode on pin 9 of IC1). When the photodiode is exposed to infrared light from the IR beacons it produces a voltage that depends on the intensity of the light hitting the sensor. The op-amp circuitry simply amplifies this signal to a usable level, and provides a current buffer between the photodiode and the rest of the circuit. After being amplified, the signal is passed through a high pass filter and AC coupling, which provides a cleaner signal that is centered around the virtual ground (VCC/2).
The gain stages used in this circuit are simple non-inverting operational amplifier configurations. The first gain stage provides a gain of approximately 4 for the inputs to both the frequency and amplitude protection circuits. The second gain stage amplifies the signal to a better level for the amplitude detection circuit, and provides an additional gain of 2. After each amplification stage, the signal is again fed through an AC coupling high-pass filter to keep the signal clean and centered around the virtual ground reference voltage.
The purpose of this stage is to take the noisy signal coming from the sensor and provide a clean digital square-wave signal to the microprocessor at the same frequency as the beacon being currently being looked at. This was done using a standard Schmitt trigger configuration, as shown in the schematic. The large network of resistors connected to the non-inverting input of the op-amp is simply a way to get the desired resistor values for controlling the hysterisis characteristics of the circuit while only using standard resistor sizes.
The purpose of this portion of the circuit is to provide the microprocessor with a flat analog signal that follows the peaks of the square wave signal coming from the beacon. This signal can then be used by the microprocessor to determine when the robot is best aligned with the beacon. The signal is first fed through both a high-pass and low-pass filter to remove as much noise as possible. The corner frequencies for these filters were chosen to allow the specified beacon frequencies to pass through with no or very little attenuation, while blocking all frequencies either above or below this range.
After filtering, the signal is fed into the non-inverting input of the "Peak Detector" op-amp. The diode on the output of the op-amp causes the capacitor to charge as the signal rises to its peak, and then prevents the capacitor from discharging as the signal falls again. This causes the voltage on the upper end of the capacitor to follow the voltage level of the signal peaks. The capacitor can still discharge through the connection going to the microprocessor; however, as the microprocessor input draws very little current this was not an issue. The value of the capacitor C9 was chosen to smooth the output signal as much as possible while still responding quickly to changes in the signal amplitude.
After successful testing on a breadboard prototype, we designed and built a circuit board for the IR detection. The EAGLE schematic and board files are available on the github repository, and the finished board is pictured below:
The IR detection circuitry worked quite well for sensing distances of up to about 4 feet or farther, which is more than sufficient to be able to sense the beacons from the center of the arena (a distance of about 34 inches). A picture of an oscilloscope measurement of the two outputs for the 11kHz beacon is shown below. The top line shows the output from the frequency detection portion of the circuit, and the bottom line shows the output of the amplitude detection portion. As can be seen from the photo, the circuit performs quite well and provides very clean signals to the microprocessor.