This is another sub-experiment leading up to a project that I’ve only tangentially mentioned on this blog so far: a robot that automatically sorts and places Perler Beads. The robot starts with a pile of unsorted beads, and after it separates them into single beads, it needs a way to accurately sense the color of each individual bead.
The sensor has a built-in A/D converter with a simple I2C interface. I chose to use a Propeller prototyping board for the test, and display the resulting colors on my PC. For my test, I wanted to continuously compensate for ambient light, and just measure the light reflected off of the bead. So I integrate the sensed light levels twice, once with the LED off and once with it on, then I subtract them. A little scaling and white balance calibration, and I have an RGB color suitable for display on a monitor. The calibration is certainly nothing scientific, but it’s more than enough to get a visibly recognizable color, and I’m hoping it should be plenty accurate enough to differentiate the various bead colors.