Building a machine that sorts candy colors with iPhone

Building a machine that sorts candy colors with iPhone

The very idea of a machine being able to color-sort M&Ms teases an inventor's imagination and interest in machines, electronics and programming. A person with a website called "reviewmylife" had heard about machines that can do this by sending the famous candy down a chute where a color sensor takes a second or two to identify the color and then a servo motor helps direct the candy to the correct pot. That approach seemed too slow for reviewmylife's liking, and this thinker wanted to try something else—an iPhone—more specifically, an iPhone talking to a Bluetooth module (he bought a Bluetooth LE module for the Arduino so that the phone could talk to the Arduino) while the candy is still in freefall, firing off the correct electro magnet controlled gate and sending the M&M into the correct pot.

He developed the iPhone idea after an earlier attempt with the Arduino compatible color sensor: "I knew that I was going to use an Arduino to control the M&M sorter so it seemed natural to buy the Arduino compatible color sensor that most of the other projects were using," he said. He saw it was slow. "You have to individually sample the four color sensors (red, green, blue and white) and then figure out the color. This isn't as easy as the sensors aren't calibrated with each other, so you need to figure out the calibration first." Turning to the iPhone's camera, he found that the camera and CPU were fast enough to film the M&M in freefall and figure out what color it was.

Brown M&Ms were a pain and he did not sort them; they were hard to tell from orange and "shadow." He said it would need more software work "and perhaps some LED lighting on the chute to reduce the effect of the shadows."

Putting the machine together "involved a lot of foam board and glue from a hot glue gun." His interest in this project, however, has not yet been satisfied. He sees a lot of potential to the point where speed and sorting accuracy can be improved. In fact, this person is thinking about ditching the whole iPhone/Bluetooth setup. "I think to do this you could try using a Raspberry Pi with a high speed (60/120FPS) capable camera directly attached. The Pi probably has the processing power to do the image processing."

More information: … ndm-sorting-machine/

© 2014 Tech Xplore

Citation: Building a machine that sorts candy colors with iPhone (2014, December 23) retrieved 20 July 2024 from
This document is subject to copyright. Apart from any fair dealing for the purpose of private study or research, no part may be reproduced without the written permission. The content is provided for information purposes only.

Explore further

Shooting "color" in the blackness of space


Feedback to editors