At the very end of the process, the LEGOs are sorted into cups spread out on a disc that rotates to put the correct cups in position to receive each brick. The current disc holds ten cups, spaced evenly. This lets the machine sort the bricks into ten categories: this could be ten colors, ten shapes, or a mixture of the two. By default, the cups are marked for three colors (red, green, and blue), each with three shapes (1x4, 2x2, and 2x4). The tenth cup is for bricks that don’t fit into any of these categories, so that the machine can handle weird cases like a white brick.
When the camera scans a new brick, it identifies the shape and color and sends two signals to the motors: one to the stepper motor that rotates the disc, lining up the cups, and another to the servo that tilts the V-plate, tipping the brick into the correct cup. The stepper motor is a more powerful motor than the servo, because it has to be able to support more weight: the disc, cups, and legos aren’t individually that heavy, but they add up. The stepper motor also has the advantage of being able to turn a full 360 degrees, unlike the servo, which only sweeps through a 180 degree arc. The limited strength and range of motion isn’t a problem for the V-plate, but for the disc, we needed the more serious stepper motor.
The stepper motor for the disc and the servo for the v-plate are both controlled by the Arduino. The Raspberry Pi processes the signal from the cameras, determines how the motors should be positioned, and sends the appropriate command to the Arduino.
The stepper motor we used to move the tray of cups.
The motor shield that allows the Arduino to interface with the stepper motor.