Quick Candy Sorting Machine


OCD. Sometimes things just get to you, like those pesky bags of randomly assorted candies. [Torsten] decided to build a sorting machine capable of sorting Skittles or M&Ms into separate cups by color at around 80 pieces per minute. It’s a great implementation, using an Arduino Duo. He based the code on the principles of a finite-state machine, in order to make it as quick as possible.

It works as you would expect: When a candy piece is loaded, the color is determined using an RGB sensor. A 360-degree servo is used to move the chute to the proper position, and interestingly, the system preemptively releases the candy before the chute is in position in order to maximize the speed. If you watch closely, you can see this behavior in the video (embedded after the break).

[Torsten] includes a complete bill of materials, if you’d like to try it for yourself. He also included a list of possible improvements.


  1. Mohonri says:

    How about for the next contest, we have a “fastest skittle/m&m sorting machine” competition?

  2. rouan8bo says:

    Slick project. Looks to me like an arduino uno, might want to fix the article.

  3. garym53 says:

    Bet it doesn’t work for Liquorice allsorts… ;-)

    The colour sensing arrangement is quite interesting in particular – I wonder how accurate it is?

    • ERROR_user_unknown says:

      There seams enough color deferential to pick them apart with fairly low accuracy equipment. My guess is that this device run at better than 99.9% and most likely not made a mistake since final software revision.

  4. bandit, Albuquerque says:

    Just the thing when you need to eliminate all brown M&M’s:




    Personally, if I had ever produced their show (very unlikely :^), I would have adhered to the letter of the contract, but left a bag in a bowl and a big sign “pick out your own @#$% brown M&Ms.

    (I tried to get a boss to do basically the same – he sent a long and fairly detailed contract to a supplier. I wanted a clause in the middle where they would send us a couple of pounds of M&Ms when they actually signed the contract, just to check they really read it. He did not see the humor. Sigh.)

  5. bandit, Albuquerque says:

    Did he use a Mealy or Moore machine?

  6. Nova says:

    Really slick setup and good use of 3d printed parts. The wiring is even nice to look at,and modular. Not a practical machine but I’d put one on my desk ‘just because.’

  7. Angus says:

    Awesome. I wonder if it’d be practical to sort faster by having the chute rotate at a constant speed (higher than the current speed, as it wouldn’t need to keep stopping and starting) and just dropping the items at the right times.

  8. Mick says:

    If speed’s the driver, perhaps add a continuous rotation servo to the chute also? Seems to got ‘the long way around’ sometimes. A continuous rotation pot would give you abs. pos. feedback, as would reed/hall/IR/etc etc sensors placed at each cup. Does the system provide stats? Ie. total # counted, # of each colour, etc? Fun, elegantly designed project – thanks for sharing!

  9. This would be an interesting piece, not necessarily art, but something with the video or demonstration of Skittles or M&Ms being funneled together by the machine that makes them at the factory. As I’m sure they are made in batches by color. And then this little semi-autonomous machine, unsorting them. Like some kind of null void.

  10. Wiljan says:

    What happened to al the “Blue” M&M’s?

  11. CRJEEA says:

    It doesn’t appear to be able to choose which direction is shortest it just changes direction between each selection.

    • Roger Wolff says:

      I think his rotation servo is a 360 degree servo, not a “continuous rotation” one. It has an end-stop at the right. It cannot move directly from “two oclock” to “four oclock” except by passing the “nine oclock” position..

  12. Deeply Shrouded & Quiet says:

    I wonder if this can be used to sort beads.

  13. Tom the Brat says:

    Seems to go the wrong way around often. I programmed an 8 bin sorter like this in ’84, though we weren’t sorting skittles by color. Was easy with an 8 byte lookup table: Where you are vs where you want to be, 1 for CW and 0 for CCW.

  14. rue_mohr says:

    socket packing tube as frame! I love it!

  15. Jblanke says:

    Anyone else notice that it throws a brown one in with a yellow at 1:24?

  16. Gustav says:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

Join 98,146 other followers