Automatic Sorting of Skittles or M&Ms by Colour - Mechatronics Engineering

Automatic Sorting of Skittles or M&Ms by Colour

Automatic Sorting of Skittles or M&Ms by Colour

Do you sort M&Ms or Skittles by colour before eating them?  For example, eat all the yellow ones first, then the red ones, then the blue and so on. Brian Egenriether, an electrical engineer, decided to make a small machine that looked like an appliance, which could perform these tasks automatically. This mechatronics project took him about 5 weekends to make. The use of the machine is very simple: pour Skittles or M&Ms into it, push a button and have candies sorted. Let us look at the construction.

The machine is well thought out, starting from its colour which is quite intentional. Brian said,

This is so the eye is not distracted by a colorful machine that would take away from the aesthetic of the perfectly sorted candy at the bottom.  They appear as solid "pops" of color at the base, all ordered and neat in white bowls--the opposite state of what you can see at the top.

The author formed many parts out of a machinable and paintable epoxy including the casing, the turnstile, the 5 tubes through which the candies fall to the bottom of the hopper.  The base is of wood and the bowls are ceramic (they are attached to the base). The control is done with a BASIC Stamp 2, and was written in PBASIC code. It sorts about 37 Skittles per minute.  The colour detection is done with a sensor made from TAOS (now out of production). The turnstile and all other parts inside the colour detection stage are black to avoid confusing the sensor. There are 3 servo motors, that perform defined tasks: rotate the hopper, rotate the turnstile and angle the chute to the proper hole.

The colour sensor looks at a Skittle and takes 3 measurements, red, green and blue. The value of each is sent back to the controller. The controller takes each 8-bit count and stores it.  Then it makes a decision on the actual colour of the candy. The RGB values were all determined experimentally for each Skittle colour. As the author said, it was not without problems:

The hardest part of color detection is that Skittles have a big white "S" on one side (not both). So depending on what side lands up in the sensor, the readings are quite different.  So for example an orange Skittle with the "S" facing up, looks a lot like a yellow Skittle with the "S" facing down, to the sensor.  I called this the "S Problem" and only through very precise positioning of the turnstile and a lot of statistical sampling of each color did I get it right.

Noteworthy is the candy "drive". One rotation does 3 things. When the turnstile rotates it takes one candy from the bottom of the tube (other sorting machines work on a similar principle) that comes from the hopper and rotates it to the colour sensor. At the same time, it takes the one that was analised by the sensor before and drops it into the hole that leads to the chute. Brian also briefly described the algorithm:

An infrared LED and Phototransistor look at small holes in the outer diameter of the turnstile.  These tell the servo motor when to stop turning.  In the code I have the servo move at a fast speed, then based on a timer it goes into slow speed.  This is right about the time when the hole will pass over the LED/transistor pair.  I make it go slow in the last tenth of a second so that it does not overshoot the stopping point.
It sorts about 37 Skittles per minute and rarely makes an error.


Skittles Sorting Machine 3

The video below shows the Skittles Sorting Machine with final modifications, and it was shown on television show "World's Smartest Inventions" on Tru tv. It is the 3rd revision of the original machine. The inside of this mechatronics project is now complete and features user-selectable inputs to choose which type of candy to sort. Types not shown include Reese's Pieces and other types of Skittles.

No comments:

Post a Comment

Share it!

Popular Posts