This Guy Spent 2.5 Years To Build A Machine That Sorts Out His Lego Pieces

Dhir Acharya


2.5 years perfect the software and 10,000 pieces to build a machine that sorts out Lego pieces using a neural network.

As you add more legos to your collection, it gets more and more interesting to play with, until there are too many of them and it’s almost impossible to find the piece you want. That’s when you need something to sort out the pieces for you, and this guy developed a sorting system using Lego pieces that sorts out the bricks automatically.

While there have been other sorting systems built years ago, those all required pre-sorting and had limited ability in categorizing and dropping pieces into separate bins. Meanwhile, Daniel West has built a system featuring a complex mechanism that supports 18 bins as well as categories of Lego pieces. But it can potentially sort out up to thousands of categories and support thousands of bins.

By estimations, West says that it took about 10,000 pieces to build this sorter, which include six Lego motors, a few non-Lego components such as lighting for the camera, a Raspberry Pi, servos, and a laptop to power the sophisticated neural network for identifying every piece.

It was extremely challenging to make the machine accept buckets but present one at a time to the camera, but West managed to address that using two vibrating plates to make sure only one piece passes through each time. It took West six months to build this system but took him 2.5 years to perfect the software and neural network.

For training the neural network to identify each piece as captured by the camera on the sorter, this guy needed to access an image database of all Lego pieces ever made. He couldn’t get that from the company itself, so he 3D-printed the parts whose images are available on online databases like Rebrickable and Ldraw.org.

To help the image recognition software match a photo of a piece with its 3D render, the convolutional neural network kicks in. Essentially, it learned to match the pieces’ 3D renders to their photos taken by the camera, which happens fast enough for the machine to process about two pieces per second.

West intends to write a paper about this machine and may release his software for free, but he doesn't have the intention of publicizing the instructions to build the machine as he wants Lego enthusiasts to come up with their own thing.

Next Story