Here is a cool robot that can sort M&M’s and Skittles using an Arduino, TCS34725 color sensor, and stepper motors. It can sort 2 pieces of candy per second. Simply put unsorted candy in the hopper and the machine will do the rest. Pieces will be sorted and put into six bowls on the bottom.
The machine sorts pieces by color by performing optical measurements using the RGB sensor. It takes approximately 3 minutes to sort a 300g bag of Skittles.