

SUMMARY
In my introductory robotics course, I worked with a partner to create a ball sorting machine to sort 10 random balls of red, green, blue, and yellow. This project was quite open ended, and had no requirements other than it must sort without any human intervention.
We came up with a setup that utilized stepper motors, one of which moved a rack and pinion and the other which spun a reservoir depending on the color noticed by the sensor. The code also contained callable calibration and run code triggered by a user input on the computer.
DESIGN
Our initial goal was to figure out the most efficient way to move a single ball into 3 locations, the entrance, the sensor, and the exit. We decided on an enclosed rack and pinion “elevator” where the ball would roll onto a slope mounted on the top of the rack. With our rack and pinion, we were able to use a single stepper motor effectively to push the ball up a channel with high precision.
From this, we added on radially, choosing designs for our input ramp and output ramp, ball container, and base structure to support and mount the motors and system. The size of our rack and pinion elevator shrunk to try to keep the ball from shifting with the hopes of standardizing the sensor measurements. We built the central chamber out of black matte acrylic inside to try to control the light level, and the catcher out of clear acrylic for visibility.
CODING AND ELECTRONICS
The sorter was controlled by a raspberry Pi and written in python. Our code went through many iterations; my partner worked on the movement code, testing the steps needed to push the rack the appropriate amount with a reasonable wait time for input and output. My job was to create the calibration code, which went through a variety of iterations.
Despite our efforts to make a light resistant box, we decided that pre-sorting calibration would still increase accuracy if there was a change in ambient light. For this calibration, we opted to have the sorter take multiple measurements, along with moving the rack up and down to simulate potential differences in positioning within the chamber. These measurements were taken, averaged, and stored for reading the random balls. When the balls were read, a nearest neighbor approximation between the averages was used to select its color.

Final prototype
FINAL PROTOTYPE DESIGN
Our final product was highly accurate, running many perfect test runs (and a few with one off…) and successfully sorted all ten balls during a live in class demo.
Demonstration of ball sorter




