With a partner designed an automatic device to sort M&Ms by color into different cups. For the project we used an Allen Bradley CompactLogix PLC.
Feeder
For the feeder we used a plastic funnel so that the M&Ms could be loaded into the top and come out one at a time. We used two Styrofoam discs, one that was stationary with one M&M sized hole cut into centered above the conveyor belt and. The other disc was connected to a stepper motor and had four identical holes cut into it so that the M&Ms were evenly spaced out once on the conveyor. The code was set up so that the stepper motor was only running while the conveyor belt motor was running.
Camera
We used the Keyence Vision System to conduct a pattern match on a select region below the camera. The pattern match was used to determine how many M&Ms were in the region and the color of M&Ms. M&M color was then stored in an array.
Conveyor
The conveyor belt could be turned on and off by an operator via push buttons. If more than one M&M was detected in the camera's scan region, the conveyor was also temporarily stopped. If this happened the most recent M&Ms were unloaded from the array in a LIFO (last in, first out) manner to ensure that these colors were no longer stored. The operator could then decide to remove M&Ms and press a push button to resume the system or they could press a different push button to fully stop the system.
Optical Sensor
Whenever an M&M blocked the optical sensor the first color value in the array was unloaded and stored into a variable called color which was used to tell the stepper motor which position to rotate to so that the M&M would fall into the correct cup.
Room for Improvement
The feeder was not part of our initial designs since we had limited time for the project and wanted to focus our attention on the other aspects that were necessary to sort the M&Ms. We didn't like that we had to load M&Ms by hand one at a time as we wanted the system to be fully automated so the feeder was a last minute addition to the project when we had some extra time at the end. As a result, the feeder was not up to the standard that we would have liked. M&Ms sometimes came out of the funnel two at a time, and other times got jammed and didn't come out at all. The way the funnel was mounted it sometimes got caught on the rotating Styrofoam disc.
We also wanted to add the ability to sort out peanut m&ms but had difficulty perfecting the pattern match for this during out limited time frame.
© 2025 • All content within this project is strictly the property of Tristen Wastell and is not for public use without permission.