M&M sorter

By Ben Everard. Posted

This article was originally published as part of HackSpace magazine, which has since been incorporated into Raspberry Pi Official Magazine.

M&M sorter

There’s a wonderful legend that the 1980s band Van Halen included on their list of demands that they be served a bowl of M&Ms with all the brown ones removed. If they arrived at the venue they were booked to play and found brown M&Ms in the hospitality area, they were contractually allowed to cancel the show, at the expense of the promoter. This sounds like spoilt brat behaviour, but the clause was inserted as a quick way to check that the promoter had read every line of the contract. Rather than check all the lighting, power, and sound requirements, they just had to look in a bowl of sweets to check that everything else was all right.

That approach wouldn’t work today, as we have this visual sorting mechanism built by Jackofalltrades. It sorts a mixed load of M&Ms into six colours, using nothing more complicated than an Arduino Uno, a combination of a photoresistor and a white LED to detect the colour of the sweet, and a few other components to drive the mechanism. We’ll admit, at first glance, we thought this was a machine learning project, but we’re pleasantly surprised to find out it’s so simple


Ben Everard

Ben is the Editor of HackSpace magazine. When not wrangling words, he enjoys cycling, gardening, and attempting to identify wild mushrooms.

From Raspberry Pi Official Magazine store

Subscribe

Subscribe to the newsletter

Get every issue delivered directly to your inbox and keep up to date with the latest news, offers, events, and more.