top of page

Create Your First Project

Start adding your projects to your portfolio. Click on "Manage Projects" to get started

Detection and Sorting System

Project type

University Project

Date

Spring 2026

Two-person final project for UVic's mechatronics course: an automated conveyor that sorts 48 blocks of aluminum, steel, white plastic, and black plastic in a single continuous run. The blocks are identical in size and shape, so classification rests entirely on surface reflectivity, measured by an optical sensor as each piece crosses a sampling window and read through the microcontroller's ADC.

An ATmega2560 running bare-metal C handles the entire system: ADC sampling, classification, conveyor PWM, stepper positioning, and the LCD interface. The architecture is interrupt-driven, with time-critical sensing in the ISRs and classification, queue management, and display updates deferred to the main loop. The largest performance gain came from restructuring the ADC path. Instead of returning to the main loop between conversions, each completed conversion re-triggers the next from inside the ADC interrupt itself, sampling continuously until the piece clears the window and keeping only the minimum value. That change cut per-piece sampling overhead enough to load blocks nearly back to back without the system merging two pieces into a single reading, which had been the dominant failure mode at speed. A FIFO linked-list queue holds each classified piece's bin code so the tray always knows what is arriving next, and a Hall effect sensor homes the stepper tray to a known reference position at startup.

Belt speed was deliberately detuned from 60 percent to 53 percent duty cycle. Faster was achievable and the classifier kept up, but pieces carried enough momentum to reach the end of the belt before the tray finished rotating into place. The stepper, not the sensing, was the real bottleneck: a trapezoidal acceleration profile was used as a fallback after an S-curve proved too aggressive to run reliably once the tray was loaded with sorted pieces.

Result: Best demonstration run of 29.7 seconds with zero classification or placement errors, against a 60 second requirement. The system also implements a pause mode that brakes the belt and displays live per-material counts, and a ramp-down mode that finishes every piece already on the belt before shutting down cleanly.

Tools: C, Atmel Studio, ATmega2560, interrupt-driven firmware, PWM motor control, stepper control, ADC sensing.

bottom of page