The following project was completed for “MECH 458– Mechatronics”, at UVIC. The goal of the project was to design and optimize a sorting program (in C) which would sort 48 pieces based on their material in under 60s. The conveyor belt system was pre-built and groups are not allowed to change any part of them, or add any sort of physical optimization. The control system was powered by an Atmega2560 MCU, which received input signals from sensors on the conveyor belt system and drove two separate motors, a DC motor (belt) and a stepper motor (sorting bucket). Success in this project was determined by the accuracy and sorting speed, which was achieved through code optimization.
My partner and I completed the sorting process in 22 seconds with zero errors which was the second highest score out of over 30 groups. We were also the only group of the semester to successfully implement a continuous rotation optimization– replacing multiple consecutive 90° rotations with a 180°, 270°, or 360° rotation and multiple pieces sorted. This optimization saved time by reducing acceleration and deceleration phases of the stepper motor (and looked super cool).
Hardware components
Sensors implemented interrupts to control the material classification and overall flow of the sorting process, while the motors served to drive the belt and rotate the bucket to the correct material. Two push buttons were used as interrupts to perform required functions. Finally an LCD screen was used in parallel with the push buttons to display the counts of sorted and scanned materials.
Optical sensor: Detected when an object was in front of the the reflectivity sensor.
Reflectivity sensor: Identified material type base on calibrated reflectivity properties.
Exit sensor: Determined when there was an object at the end of the belt ready to be dropped into a bucket.
Hall-effect sensor: Used to initialize stepper motor (bucket) to a starting position.
DC motor: Served to actuate the belt and drive the objects through the sorting sequence.
Stepper motor: Operating with an s-curve to allow fast and smooth motion, the stepper served to rotate the bucket to align the correct bucket with the end of the conveyor.
Push button 1: This button was used to pause the program (stop the belt) and display on an LCD screen the number of sorted pieces for each material as well as the number of pieces which were scanned but not yet sorted into a bucket.
Push button 2: Used to terminated the program, when pushed the button would sort the remaining pieces on the belt before stopping the belt and displaying the final sorted counts of each material.

