

Ever since I saw Akiyukiโs Lego-sorting machine way back in 2011, Iโd had the idea of building one as well. About 3.5 years ago I was in university for computer science, and started playing around with computer vision. About a year later, I started reading some articles on AI, and realized it was perfectly suited for the task.
My machine first separates the bricks into a stream, using belts and a vibrating table powered by a Lego motor spinning an offset weight. This part of the machine went through more iterations than any other component, and even then Iโm not totally happy with the solution โ sometimes parts will fall through more than one at a time.
The separated parts then move through a โlightboxโ that records video for AI classification. Mechanically this is the simplest part of the machine โ all the hard work is left to the AI.
The parts are then distributed into 18 output buckets, using a series of gates controlled by servo motors. Iโve never seen anything like this done before, and it means that the machine can be used for self-contained Lego storage.
The most difficult and complex part of the project is the software. A Raspberry Pi has to interpret individual frames of the scannerโs video to extract cropped images of the parts. Those images are sent to the AI convolutional neural network, which is trained to detect the part number out of almost 3,000 possible options. The neural network is trained using 25 million โsyntheticโ images of digitally rendered Lego bricks. To improve accuracy, the network is also trained on about 200,000 โrealโ images, which had to be manually labeled with their correct part numbers.
The video Iโve released has inspired lots of others to start working on their own machines, and Iโm very excited to see how people will improve and refine the technology!
ADVERTISEMENT