This Arduino device will sort your M&M’s by color

Arduino TeamJune 18th, 2021

Hyperedge- . IoT, Embedded Systems, Artificial Intelligence,

If you were challenged to design a device that could sort M&M candies by color, how would you make it work? You might consider using machine learning, which has become accessible in recent years. There are even ML models available today that can run on Arduino boards. But Jack Monaco (AKA Jackofalltrades_) found a more elegant solution when he created this Arduino Uno-controlled M&M’s sorter.

We perceive color based on the wavelengths of light that an object reflects. A white object reflects all visible wavelengths well. A black object doesn’t reflect any visible wavelengths well. A blue object reflects blue wavelengths better than others. This machine relies on those facts to detect the color of an M&M candy.

A hopper mechanism feeds a single candy into a small, dark chamber. A white LED and an RGB LED then shine different colors of light onto the candy while an Uno measures the intensity of the reflected light using a photoresistor. If the measured intensity is highest when the RGB LED is set to full red, then the board knows that M&M is red and will dispense it into the correct receptacle using a small servo motor.

The hopper and dispenser mechanisms are 3D-printable. A plastic bottle feeds the hopper and is big enough for a normal bag of M&M’s. The sorted candies drop into a small glass jar that has a 3D-printed divider, creating separate areas for each color. If you want to build your own M&M’s sorter, Monaco included the STL files and Arduino code in his Instructables tutorial.

This post was first published on: Arduino Blog