This Scanner Automatically Sorts Out the Peanut-Free Peanut M&Ms

Harrison McIntyre built a machine that scans Peanut M&Ms and sorts out the candies that don't actually contain a peanut.

Cameron Coward
5 years agoFood & Drinks / Sensors

If you like to enjoy Peanut M&Ms on the reg, you’ve probably noticed that you occasionally get one that was manufactured improperly and doesn’t actually contain a peanut. Depending on your tastes, this can either be a special little treat or a lumpy nugget of disappointment. In either case, it would be nice to be able to separate the peanut-free candies from those that were manufactured as intended. Frankly, it’s a bit surprising that Mars, Incorporated doesn’t do that themselves at the factory. Harrison McIntyre decided to address that oversight by building a machine that can scan Peanut M&Ms and separate those that don’t contain a peanut.

McIntyre first thought up this idea several months ago when he constructed a machine that automatically catapults M&Ms into a person’s mouth. He had considered using Peanut M&Ms for that project, but decided that they were too irregular and too dangerous to teeth. He was contemplating that irregularity, and how it relates to whether a peanut is present, when he came up with this project. Originally, he had planned on measuring the sphericity, or 3D “roundness,” of each candy. The idea being that those M&Ms that do contain peanuts are more oblong than those that don’t. Unfortunately, this proved to be an inconsistent method of sorting the candy, because some peanuts are fairly spherical.

He then realized that peanuts and chocolate have different densities. Chocolate is more dense than peanuts are, so a peanut-free M&M should have a higher overall density than its peanut-impregnated brethren. Because Peanut M&Ms have such an irregular shape, McIntyre first had to come up with a way to calculate an individual candy’s volume before he could calculate its density. To do that, he created a DIY 3D scanner using a Raspberry Pi and an Arduino. The candy rests on a small rotating platform while a 2D line laser scans a series of points on its surface. The resulting 3D model can be used to determine the volume of a candy. That piece of candy is then weighed on a little scale and the density is calculated. If a candy is particularly dense, the machine assumes it doesn’t contain a peanut. It can’t sort perfectly, but it is about three times more accurate than simply picking Peanut M&Ms at random.

Cameron Coward
Writer for Hackster News. Proud husband and dog dad. Maker and serial hobbyist. Check out my YouTube channel: Serial Hobbyism
Latest articles
Sponsored articles
Related articles
Latest articles
Read more
Related articles