The competition requires our robot to be able to shoot colored ping pong balls through corresponding colored hoops. Our approach is to index the colored balls by location in the carousel, allowing us to shoot balls two at a time through the corresponding hoops, regardless of the order in which the balls are loaded. In order to do this, we need a way to detect the ball color. We decided to use transmitting LED's and some sort of receive device to determine ball color. A couple receive options were proposed:
Photo resistors are resistors whose resistance decreases with increasing light intensity. Ideally, purple will reflect the least amount of light producing the largest resistance, white will reflect the most light producing the smallest resistance, and pink will be somewhere in between. Using this photo resistor, we run into a couple problems.
The TCS3200 Color Light-to-Frequency Converter combines photo diodes and a current-to-frequency converter on a single IC. It outputs a square wave with frequency directly proportional to the light intensity. This chip would be a great option for color detection. Unfortunately, it did not arrive in time for us to implement.
LED's can act as photo diodes and detect light with a shorter wavelength than that transmitted by the LED. The initial plan was to use two different colored LED's, red and yellow, to detect ball color. Both the red and yellow LED's are sensitive to the different colors, however, the yellow LED alone provides enough sensitivity and specificity to determine color.
We have discovered that the output voltages for photo resisters are too similar for us to distinguish between colored balls. The light-to-frequency chip would work well but has not arrived in time for us to implement. Our final circuit includes a 10mm white LED for transmit, a 5mm yellow LED for receive, and an LM324 op-amp for amplifying the signal from the yellow receive LED. Voltage output levels for the yellow LED (post-amplification) can be found below along with the final circuit schematic and a picture of the PCB. For example code see the Shooting files in the github repository.
|Purple Ball:||0.95V +/- 240mV|
|Pink Ball:||1.45V +/- 240mV|
|White Ball:||1.89V +/- 240mV|