Skip to main content

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.


You might also like

    Popular posts

    What is Mechatronics?

    Mechatronics definition Mechatronics is a synergistic combination of precision engineering, electronic control and mechanic systems. It is the science, that exists at the interface among the other five disciplines: mechanics, electronics, informatics, automation, robotics. It is one of the most dynamically developing fields of technology and science. The word 'mechatronics' appeared for the first time in Japan in 1969. mechatronics = mecha nics + elec tronics + computing

    Ascento - The Two-Wheeled Jumping Robot

    All-terrain capabilities are required to extend beyond flat surfaces the application range of wheeled robots. First think is four or six-legged robots which have been well known for years. Nowadays, thanks to more and more perfect gait algorithms, the two-legged (bipedal) robots appears more and more often. ETH Zürich students combine the advantages of wheeled robot and two-legged robot.

    Mechatronics System as the Future of Cooking at Home

    Do you get up in the morning and don't feel like making breakfast? One of the solutions is food delivery service, which leaves your takeout order outside of your front door. Other solution is a private chef who is responsible for shopping for food, menu planning, preparing and cooking meals for you. But if you love mechatronics systems, your solution is a mechatronic kitchen. It allows you to save time, free up your day from routine cooking, plan and adapt your menu according to different diets and lifestyles.

    Stretch - Boston Dynamics Unveils New Robot for Warehouse Automation

    Boston Dynamics is the global leader in mobile robotics. Their popular robots are SpotMini, Spot, Atlas and Handle. Now they has revealed 'Stretch', which is a new box-moving robot designed to support the growing demand for flexible automation solutions in the logistics industry. A Massachusetts company well known for its humanoid robots and dog-like androids is preparing to muscle its way into the warehouse automation industry with its latest mechatronic solution. Warehouse automation is a fast-growing market fueled by increased demand in e-commerce. The robot called Stretch is Boston Dynamics’ first commercial robot specifically designed for warehouse facilities and distribution centers. Robert Playter, CEO of Boston Dynamics said: Warehouses are struggling to meet rapidly increasing demand as the world relies more on just-in-time delivery of goods. Mobile robots enable the flexible movement of materials and improve working conditions for employees. Stretch

    Three Wheels Balancing Robot

    The three wheels balancing robot is similar to a ballbot from the point of view of the goal. In comparison to ballbot which balance itself on a single ball, three wheels balancing robot is designed to balance itself on a single rod. The common characteristics of this kind of robots is that there’s one sole contact point to the ground.

    DIY Low Cost 6-Axis Desktop Robot

    Learning how to build a robot is a long way. It is the way by mechanics, electronics and programming. Such a mechatronics project is associated with problems such as stiffness (mechanics), overvoltage (electronics) or bug (software). Of course, if something is wrong, we always say 'it's not a bug, it's a feature', but finally a robot has to start working properly.

    Theo Jansen Strandbeest

    Theodorus Gerardus Jozef "Theo" Jansen is a Dutch artist. Theo Jansen 's mechanism (named strandbeest - "beach animal") allows to perform walking motion. The advantage is that the required power of the engine used in the mechanism, must be sufficient to transfer only the legs (not transported elements). He invented that in 1991.