BALL SORTER

BALL SORTER

DESIGN PROJECT

Spring 2026

DESIGN PROJECT

Spring 2026

Prototyping, Laser Cutting, 3D Printing, CAD, Electronics, Color Sensors, Python

Prototyping, Laser Cutting, 3D Printing, CAD, Electronics, Color Sensors, Python

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. 

Rack and pinion isolated design

Rack and pinion isolated design

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.

Initial CAD design

Midpoint CAD design

Final CAD design

Initial CAD design

Midpoint CAD design

Final CAD design

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 with collector down

Final with collector down

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

Create a free website with Framer, the website builder loved by startups, designers and agencies.