Automatic Candy Sorter

EECS373 final project

Posted by Yanqi Liu on Dec 22, 2016

All the Raspiberry Pi code can be checked out at github repo. The SmartFusion code is under reorganization


We are designing and building a sorting machine that will sort small objects based on color and shape. We will demonstrate our sorting machine with candy. Our device will sort small colored candies, most likely skittles or starburst, into bins based on their color. Our ultimate goal is to sort any classifiable objects given a precomputed training model utilizing OpenCV. A running count of each unique item will be kept and wirelessly sent to a display screen/tablet.

Major Functions:

  • Color/shape detection and machine learning
    • Classify objects based on their color using OpenCV.
    • Sort objects based on color, and reject items that are not the correct shape.
  • Infrared detection
    • Use infrared laser to detect items at the end of the track and interrupt the track motors to stop, take a picture and notify the start of the collecting mechanism.
  • Physical dispensing and sorting mechanism
    • Rotate a motor with cutout of object to separate and dispense items individually.
    • Swap out cutout for different objects to sort.
    • Rotate another motor at a constant speed to implement a “conveyer belt” for transporting objects to camera and bins.
    • Rotate the collector servo until the corresponding basket reaches the receiving position.
  • Wireless Communications
    • Send data to LCD/tablet to display number of objects in each bin
    • Send user command to start and stop the system and reset the display
  • LED display
    • Have a LED display flash different colors depending on color detected.
    • Have a LED touch screen for selection of start, stop, reset


  • Camera
  • Button/Switch
  • LCD/Tablet via Bluetooth
  • Infrared receiver


  • LCD/Tablet via Bluetooth
  • Motors (3)
  • LEDs