reviewmylife has a great project to sort M&M candy based on color. An iPhone detects the color of a falling M&M from its camera and communicates with an Arduino and solenoids using Bluetooth low energy. As each candy falls it’s pushed into an appropriate bin based on the detected color. From the video you can see the project can sort M&M’s at a fairly high speed. Nice work!
M&M sorting machines are a popular project for people who like combining electronics, programming and machine building. I decided I’d try to make my own version but with a different approach to the majority of existing M&M (or Skittles / Smarties!) sorting machines out there.
Most of them send a single M&M down a chute to a simple colour sensor where the colour sensor will then take a second or two to figure out the colour. A servo motor will then rotate a chute that will direct the M&M into the correct pot.
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 my rough prototype 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