Tag Archives: Arduino color sensor


Automatic candy sorter

Built by Willem Pennings from the Netherlands, this color candy sorting machine is robust and beautifully designed. It uses an Arduino controller, stepper motors, an RGB color sensor and several 3D-printed parts to perform sorting of colorful candies like M&M and Skittles. It can sort a 300 gram bag of mixed M&M in approximately 2-3 minutes.

Arduino candy sorter

Arduino candy sorter

Posted below is a video showing the machine in action.

The machine is able to sort M&M’s and Skittles by colour by performing optical measurements using the RGB sensor. It can be modified to sort any type of coloured object, as long as the individual pieces have a regular shape with even dimensions. It takes approximately 2-3 minutes to sort a 300 g bag of Skittles / M&M’s and sorts about 2 pieces per second. The machine is 250 mm in diameter and approximately 300 mm in height.

While in the hopper, candy pieces are constantly mixed to prevent clogging at the inlet of the upper scanner tube. The scanner consists of a small wheel with four slots which are 90 degrees apart. After a piece enters a slot, the wheel, which is powered by a stepper motor, rotates 90 degrees so a measurement can be performed. The RGB sensor takes three consecutive measurements, which take 30 milliseconds each. The Arduino controller then determines the item colour (based on reference data) and positions the exit tube (also using a stepper motor) to guide the piece to the correct container. Just before the exit tube reaches its target position, the wheel turns another 90 degrees to drop the piece. The process is then repeated. During the process, visual feedback is provided using the LED strip that encircles the machine.