[Tomas] wanted to try building something mechanical with electronic control, and ended up with this sorter that organizes beads into one of two containers based on color. He built most of the structure from popular interlocking plastic bricks, then added a stepper motor salvaged from an old scanner and two plastic discs.
The two discs sit on top of each other. The bottom one is stationary and has two holes drilled in it, with a container sitting below each hole. The top disc has a smaller, bead-sized hole and rotates from its starting position—where it collects one bead—to a camera for analysis. After the camera determines the color of the bead, the disc rotates again to position itself over one of the two sorting holes in the disc below, and the bead falls into the awaiting container. The device is controlled by the MSP430 microcontroller on a FITKit (translated), which is the development platform of choice for [Tomas’s] school.
[Tomas] originally attempted to determine the color of beads by using 3 different color LEDs and a light-dependent resistor, but switched to using a webcam and a Java program to capture images and calculating average hues. You can find more details and the source code on his site, but first see the short video below.