The Resistors

Me En 495R Mechatronics Competition, Brigham Young University

Color Detection

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 Resistor

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.

  1. There is an obvious resistance difference between red, yellow, and green LED's placed on top of the photo resistor. However, light reflected off a ping pong ball is not strong enough to produce a distinguishable difference in resistance.
  2. Ambient light has a large effect on resistance of the photo resistor.
These complications make results inconsistent. A calibration circuit can be implemented but, with other color detection options available, switching makes more sense.

Light-to-Frequency microchip

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

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.

Visible Light Spectrum

Final Design

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

Schematic

Schematic for transmit and receive color detection circuit. PIN1 = 3V3, PIN2 = Vout, PIN3 = GND.

Eagle PCB Layout

Board layout designed in Eagle. Red traces on top, Blue traces on bottom.

Finished product with team slogan.

Functioning Color Detection