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

    Intro to Mechatronics [e-book pdf]

    Intro to Mechatronics - lecture by Professor Vikram Kapila, New York University Mechatronics Defined Mechatronics: Working Definition for us Product Realization Paradigm Disciplinary Foundations of Mechatronics Multi-/Cross-/Inter-Disciplinary Sequential/Concurrent Product Realization Mechatronics-based Product Realization Mechatronic Design Process

    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.

    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.

    How 6-Axis Industrial Robots Work

    6-axis industrial robots are commonly used in the manufacturing industry due to their flexibility, powerful programming software, payload capacities ranging from 5kg up to 1000kg and accuracy to 0.1mm or better. Here is a basic breakdown of how a standard 6-axis robot works. The way it rotates, how it is programmed, and the different types of tooling and grippers.

    Mechatronic Systems Applications [e-book pdf]

    Mechatronics is the synergistic blend of mechanics, electronics, and computer science. This book is concerned with applications of mechatronic systems in various fields, like robotics, medical and assistive technology, human-machine interaction, unmanned vehicles, manufacturing, and education.

    How Automated Parking System Works

    An automated car parking system is a mechatronic system designed to transport and park cars automatically. The first semi-automated parking system was used in Paris, France in 1905 at the Garage Rue de Ponthieu (the car was transported to selected level using an internal elevator and the vehicle was parked by attendants). An automated storage and retrieval system for cars is a solution to cities' parking problems, such as the space wasting in a multi-story parking.

    Smart Home Makes Your Life Easier

    Smart homes are also called intelligent, automated or autonomous houses. Nowadays, you can also automate the flats. Dynamic development of automation technology gives you opportunities that were only seen in sci-fi movies in the past. Soon, probably only your imagination will be the limit. What gives us the smart home system?