Mechanically, the scanner system is just one servo motor and three pieces of plastic, all of which are 3D printed. One piece is a v-shaped plate attached to the servo, that the Lego falls into when it falls down the slides. The other two pieces are small arms that hold miniature 2.0 megapixel cameras, pointed at the plate: one from directly above, and one from the side.
The bracket that holds the servo to the board.
The v-shaped plate that catches the Lego bricks.
When the Lego falls into the plate, the servo rotates it 45 degrees, turning the v-shape into an L-shape. This lets both cameras see the brick, so it can be identified with computer vision. Having two cameras at different angles makes it easier to see 3D objects – that’s why most animals have two eyes. The two cameras identify the color and shape of the Lego, and send a signal to the spinner, getting that part of the machine ready to receive the brick. For more about the software and computer vision we used, check out the “Scanner” section.
We connected the servo that controls the tilting plate to an arduino. This Arduino communicates with the Arduino to decide how much to turn to dump the brick onto the slide.
The circuit diagram of the sorter. The servo motor is controlled by the Arduino, according to camera inputs passed through the Raspberry Pi.
Here is a link to our code that controls the servo with the Arduino.