ATmega328 is under the hood of this sweet candy sorting machine

If you’re like most people when it comes to Skittles, chances are you love red and purple, tolerate green and orange, and strongly dislike yellow. Sound familiar? Instead of tediously sifting through bowls full of candy, a Maker by the name of Torsten has created a slick sorting machine that arranges sweets by color. Essentially, the machine separates different colored Skittles (and M&Ms, too) and puts them into their respective individual cups.

According to the project’s official Wiki page, the fully-automated platform is capable of sorting an entire 1.5kg/56oz bag in approximately five minutes. Powered by an ATmega328 microcontroller (Arduino Uno), the candy sorting machine also features an RGB color sensor, IR distance sensor, two servos, plastic frame tubes and a few custom designed 3D-printed parts.

“The processing is structured around pseudo-realtime programming which makes the system responsive and keeps it running smoothly. Each process in the system is designed around the notion of event driven finite-state machine (FSM) execution,” Torsten explained.

“Central in the system is Atmel’s ATmega328 AVR MCU — integrated nicely on an Arduino Uno platform. All the sensors and servo actuators connect to this board. An external 9V power supply keeps the system running. 5V and 3V3 power for the servos and board is supplied by the 5V power supply. The programming mimics a real time system where each of the four processes are state driven, which means only a short instruction performed before the system jumps to the next process.”

The machine is equipped with a pair of GWS servos for loading and sorting the pieces, while a continuous rotation servo with a variable rotation speed loads pieces into predefined slots in the feed wheel. After the pieces are placed in individual slots, a white LED illuminates the piece and an ADJD-S311-CR999 CMOS IC with integrated RGB filters captures three color profiles at different angles.

“For the piece to be successfully identified and pass control, at least two profiles have be within three standard deviation (three-sigma rule) of the pre-calibrated data set for Skittles or M&Ms. A RGB LED next to the feed wheel will illuminate to give a visual indication of the detected color,” Torsten continued. “The feed wheel rotation is governed by a QRE1113 IR distance sensor which detects the slot depth change. This transition is used to change process state and start the color analysis at the right moment.”

When the color has been identified, the piece is dropped from the feed wheel and onto a 360-degree servo with a feeding tube attachment which guides the piece into the right cup. The piece is release from the feeding wheel just before the feeding tube is within range of the cup.

“This [method offers] increased performance as the system does not need to hang around and can move to the next cup straight away. This is done by timing the expected rotational velocity and no feedback is provided by the servo,” Torsten added.

Interested in learning more about the Atmel powered candy sorter? Check out the sweet project’s official Wiki page here. 

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s