Let’s face it. Deep in our hearts, we all know some colored M&M’s taste better than others. For me, it’s the red and green ones; for my wife, it’s the brown and orange ones. And Van Halen famously stipulated in all its contracts that the band should never be served any brown M&M’s, requiring some lowly stagehand to pick them all out by hand from a bowl before every show.
These days, things would be easier. Case in point: This simple machine, which was custom-rigged out of just an iPhone and an Arduino to individually sort M&M’s by color, no human intervention required.
Here’s how it works, in the words of the machine’s creator:
My approach sends M&Ms down a chute to start with. But I don’t stop the M&M for colour recognition. Instead I use an iPhone to capture the colour of the M&M as it is in freefall. As it is still falling the iPhone talks to a Bluetooth module attached to an Arduino and that fires off the correct electro magnet controlled gate. This sends the M&M into the correct pot. Even though this is just a rough prototype it is reasonably fast because the colour recognition and path that the M&M takes down the chute is decided and determined whilst the M&M is moving under gravity. Here’s a video of the prototype.
As you can see, it works pretty well, except for one big problem: It doesn’t sort brown M&M’s very well, because subtle shadow variations can cause the algorithm to mistake them for orange M&M’s.
A future version of this machine might use LEDs to more evenly illuminate the cascading M&M’s to solve this problem. Let’s hope so: This machine will never win the Van Halen seal of approval until it can properly isolate the browns!.