LEGO Sorting - High Level Vision
- Rockets and Robots

- May 25, 2020
- 4 min read
So we (Ladvien and I) are building a LEGO sorter. Why?
Well, there is this, which is sample of my LEGO parts.

Caption: I've tried more than a few ways to organize LEGO parts. For now, let's assume I know what I'm talking about.
This is a task of human-robot collaboration: let humans do things they're good at (or a robot is bad at), and let the robot do the repetitive parts that it can do well.
Let's plot this out into sub-assemblies
What we want it to do:
We pour in a bucket of separated LEGO parts into a hopper
The machine removes parts from that hopper, one at a time, and sends them to an identifier
The identifier determines the LEGO part id, and the color of the part
The sorter moves that part into the appropriate container (in the sorting dock)
Tangent warning: Jump to the Infinite Sorting heading if you don't care about these details:
Others have done this work before, and usually stop there. See Paco, 1080 Ti, and LEGO guy (my shorthand vernacular). We like all of those projects, for different reasons. We want something 100% open source though, and we want to solve the big problem that's left: how many different parts can be sorted. Paco had 12 bins, one of which was a "I don't know" bin. 1080 Ti didn't really state how refined the sorting can be, but from the video it didn't look like it was very many. LEGO guy was able to use vertical stacking to achieve 18. Impressive but still far from what is needed.
I bought 100 4"x4" cardboard gift boxes, separated them into box and lid, spread all 200 parts out on a 4' x 8' table, and sorted parts into them manually. Every single box was filled, and I was mainly only sorting Technic parts. There are literally thousands of different LEGO pieces, even before you start separating into colors. We'll come back to that. For now, just know that 18 is not sufficient.

Caption: Part of one drawer of sorted LEGO parts, into paper gift boxes, the drawer of an engineering blueprint chest.It still has issues, but these are on the right track.
Brickformula built a very impressive LEGO parts sorter that had many more levels of sorting. The scale and ingenuity of it is fantastic.
I simply don't have the space to dedicate to a machine that large, though. We'll have to do something else.
We're going to combine concepts from Kiva Systems (now Amazon Robotics), and Ocado Technology, which will give us something very exciting. We will have delivery bots to take containers from the sorting dock to the long-term storage area. That may be because a container is full, is not needed immediately, or because we need space for a different type of part in the sorting dock.
Infinite Parts Sorting (space permitting)
What we will add.
Bots will take parts from the sorting dock to long-term storage.
Parts will be stored in a database, including the number, color, and storage location of the part.
Bots will be able to retrieve specific part bins for us and deliver them to a work area, then return the box to storage when we're done.
(Unlike Ocado, which can grab individual items from a bin, we'll start with just bringing the whole bin to us, like Amazon currently does).
Automatic storage optimizations
Bots can deliver bins to the hopper, to feed through the identifier, to take inventory, and clean up mixed parts (or change storage scheme).
Bots can reorganize bins. E.g., put high-use parts near the delivery area. Put parts of one type together-ish.
Why do I want to do all those things?
My kids destroyed a few of LEGO builds I liked WALL-E and Dr. Who from LEGO Ideas, and all my Star Wars Technic characters. I have no idea where all of the parts are. I want to rebuild them and I don't want to spend all week finding the parts. The bots can help. (Holy New Idea - as I'm typing - Batman - a bin in the sorting dock could be for a kit. E.g., put all parts for WALL-E in bin A, parts for Dr. Who in bin B, put any other parts in storage.)
Robotics clubs Sometimes we need specific parts for a robotics club meeting. It can take weeks to find all the parts, and it's not fun. I want my bot to get the things I need, and clean up the parts the kids don't use when they're done.
Missing parts Over time, parts go missing or get broken. I can buy replacement parts from BrickLink easily enough, but I need to know what I'm missing. I can feed a list of LEGO kit IDs into the system, it compare the parts I should have against the parts I do have, and report the delta, including building a wish list on BrickLink for me to order.
AFOL and things-I-haven't-bought builds Similar to missing parts, I should be able to query my inventory against a new set, and find out how many of the needed pieces I already have, and how much it would cost me to fill in the rest. That should happen both for an exact match, and more of a close-enough Dr. Frankenstein match.
I'm sure other use cases will present themselves. For now, this is a high-level, early-ish map of what we're trying to do.

Comments