feeding lego reliably from a hopper is surprisingly hard
April 30, 2017 7:11 PM   Subscribe

Not thinking too hard I put in some bids on large lots of lego on the local ebay subsidiary and went to bed. The next morning I woke up to a rather large number of emails congratulating me on having won almost every bid (lesson 1: if you win almost all bids you are bidding too high). This was both good and bad.
posted by Chrysostom (43 comments total) 28 users marked this as a favorite
There's probably a market for Lego-sorting machines.
posted by Nancy Lebovitz at 7:25 PM on April 30, 2017 [5 favorites]

I recently spent an inordinate amount of time sorting an enormous bin of Lego for my oldest kid. I didn't sort it very granularly, of course but even so.I would totally pay money to be able to haul a couple of bins somewhere and have them machine-sorted.
posted by Orlop at 7:29 PM on April 30, 2017 [5 favorites]

My husband is the market for Lego-sorting machines.
posted by jesourie at 8:53 PM on April 30, 2017 [6 favorites]

Sorting Lego? 10-year-old me with several large tubs of miscellaneous Lego that I pawed through to find the one piece I needed every time, by hand, uphill, both ways, just had his mind blown.
posted by AndrewInDC at 8:56 PM on April 30, 2017 [27 favorites]

If the downtime percentage of every COIN sorting machine I've ever seen is any indication, we will have our jet packs before something like this functions for more than ten Lego in a row.
posted by thebrokedown at 9:22 PM on April 30, 2017 [7 favorites]

So into what categories is it sorting them? In the demo videos there doesn't seem to be a rhyme or reason to the bins -- is that just for the demo? Or are they sorting fake/real? Or ...? Like can it sort "all blues" or "just 2x4 blues" or "minifig pieces only"?
posted by Eyebrows McGee at 9:31 PM on April 30, 2017 [5 favorites]

Looked like it was just separating plain bricks from everything else. Maybe he'll have an extended sorter with finer-grained sorting and more bins later.
posted by Mister Moofoo at 9:39 PM on April 30, 2017

I'm disappointed. With all that mixed lego he's got, he should have built the sorter out of lego technic. And then he could use it to ... nevermind.
posted by sebastienbailard at 10:01 PM on April 30, 2017 [3 favorites]

The comments on hacker news indicates that it's a multi stage sorting process; blow things into seven sub categories, and then blow those out into seven smaller categories, until you've got what you want.

Author also indicates that sorting by color is exactly the wrong thing to do, since it's hard to pick it a particular red piece from a large collection of red pieces. This makes a lot of sense, but adds to the visual chaos.
posted by kaibutsu at 11:41 PM on April 30, 2017 [5 favorites]

If I bought 2 metric tonnes of Lego I'd need a device to sort all my worldly possessions, ready for when I'm thrown out of the house prior to the divorce.
posted by dowcrag at 12:35 AM on May 1, 2017 [28 favorites]

Looks like he's got 6 blowers, although 4 of them are pointing toward the camera, presumably to bins that are hidden in the view he shows.

Doing it in multiple passes is definitely the way to go. I mean there's buying-two-metric-tons-of-Lego crazy and building-a-machine-to-sort-every-type-of-Lego-in-one-shot crazy. Plus immediately after doing that Lego would introduce a new piece and then where would you be?
posted by ckape at 1:09 AM on May 1, 2017 [3 favorites]

nicely done sir
posted by fistynuts at 1:56 AM on May 1, 2017

Jesus how does he detect fake parts? It took me an inordinate amount of time to weed out a few fake parts from my son's modest (but still sizable) pile of Lego, in a process that involved looking for the Lego logo on every goddamned piece and tossing the ones that didn't have it. And in the end, I MISCLASSIFIED one piece and ended up having to sheepishly go to the daycare we had donated the fake parts and ask for that one wheel back...
posted by caution live frogs at 5:42 AM on May 1, 2017 [3 favorites]

Lego has just announced a one metre long Apollo Jupiter V model.

I am about to regress to the age of seven...
posted by Devonian at 5:49 AM on May 1, 2017 [6 favorites]

Has someone who has a unfathomable number of bricks to sort, this person's journey is 100% relevant to me.
posted by Twain Device at 5:57 AM on May 1, 2017

In the video, there was a 1x red square on the 6x1 piece.. I'm guessing the machine doesn't break bricks apart. So if sorting is the hard job, I think I'd call "breaking apart all the bricks" as an impossible job.
posted by k5.user at 6:33 AM on May 1, 2017

Yesterday LEGO announced that their new LEGO Apollo Saturn V set will be available to buy on June 1, 2017.

Just in time for my birthday!!!
posted by lollymccatburglar at 6:36 AM on May 1, 2017

THERE ARE 38000+ SHAPES???!!!!

Can this be true? Are there even 38000 shapes in my daily life?

posted by janey47 at 6:53 AM on May 1, 2017 [4 favorites]

Jesus how does he detect fake parts?

The neural network I guess. If it comes down to the logo and he trained with enough negative examples it might not be that hard. I didn't catch anything he said about accuracy though.
posted by mark k at 6:55 AM on May 1, 2017

Now I understand my wife's obsession with keeping her Lego sets as intact and separate entities (seriously, we're in our late 30s now, but she still has her original Lego sets in their original boxes ... and gets more sets for Christmas most years, though we haven't opened one in a few years, because our boys are too young for those sets.)

My sets are a chaotic jumble, in bins for the future when our boys are older and can be trusted to run wild with Legos. For now, they have a bin of Duplos, and Duplo fakes, which co-exist happily.
posted by filthy light thief at 7:27 AM on May 1, 2017

janey47: THERE ARE 38000+ SHAPES???!!!!

Can this be true?

Brickset has a database of parts, obtained directly from LEGO, contains information on over 30570 items, in 179 different colours, produced over the last 34 years. Maybe that list of 38,000 includes knock-off brand shapes? I can't imagine that Brickset would be off by almost 7,000 shapes in their automated tallying. (Oddly, Brickset states they currently have 38377 reviews, which seems like an odd coincidence for numbering.)
posted by filthy light thief at 7:30 AM on May 1, 2017 [1 favorite]

My. God.
posted by Theta States at 8:04 AM on May 1, 2017

I sort my lego pieces by dissolving them in acetone and making new parts from the resulting ABS slurry.
posted by kleinsteradikaleminderheit at 8:55 AM on May 1, 2017 [13 favorites]

This is great. And I really like the multi-pass solution, sorting into 7 groups and then sub-sorting those, and sub-sorting those; it's nice and general solution that puts more hard boring work onto the computer, which should be the goal. I wish there was a bit more end-to-end documentation of both the build out and the sorting process in action, but I suppose he might talk about some of that in the HN comments.

Also, that Saturn V set, yowza.
posted by cortex at 9:04 AM on May 1, 2017

Maybe it's my little space-nerd bubble, but from the number of mentions I'm seeing of that Saturn V all over the web, I think it's going to sell out fast...
posted by rhamphorhynchus at 9:33 AM on May 1, 2017

Now make a machine to keep cats from mistaking a bin full of Legos for a litter box...
posted by gottabefunky at 9:34 AM on May 1, 2017 [4 favorites]

i wonder if you could sort them hydrologically? Different colours of identical shapes might seem not to lend themselves to that, but perhaps bursts of high power monochromatic light to heat up each colour in turn, thus changing the density of the bricks...

Personally, I'd train chimps. Or children. In a big warehouse.
posted by Devonian at 9:40 AM on May 1, 2017

Anyway I did some quick calculations and for 30570 different bins with a 7-bin sorter you'd need to do over 4700 passes, even worse if you are using up first-level bins to weed out stuck together pieces and fakes, as would expect. Although the good news is that after the first pass the system should be able to identify which parts are not present at all and can adjust the sorting tree appropriately.
posted by ckape at 11:41 AM on May 1, 2017 [1 favorite]

Your second sentence seems like the key thing, yeah; it seems unlikely that one would actually end up with anything close to a full complement of 30K+ block types even with a pretty large assemblage of second-hand lots, so letting the computer inventory blocks on the first pass and from there do an inventory of the sorted bins by subtype should go a long way to reducing the overall complexity of the sort.

And for the stuff that you do have in the long tail, it'd probably suffice to set a threshold for actual separation based on some minimum number of a given block type to justify machine sorting. Binning out 20 of a given block from a mix might be worth it; binning out two or three, nah. Let those go into larger mixed bins for hand sorting.
posted by cortex at 11:50 AM on May 1, 2017

30570 different bins with a 7-bin sorter you'd need to do over 4700 passes,

If you're separating out specific, individual pieces with each pass, yes.

Otherwise, a far smarter sorter would have everything sorted in ~6 passes. (log base 7 of 30570 = ~5.3)
posted by k5.user at 12:49 PM on May 1, 2017 [3 favorites]

Ah, but you're counting sort depth, not actual sorting passes. The depth is definitely manageable as you say, but the number of actual runs required balloons at each step down the sorting tree.

First step, sort 30K types of bricks into 7 buckets.
Second step, sort each one of those 7 buckets into a new separate set of 7 buckets each.
Third step, sort each of those 49 buckets into etc etc.

So it only takes a few sorting passes to separate out one specific unique block type from an arbitrarily large pile of legos, but it takes far more to separate out every unique block type. Unless you're figuratively panning for gold, you can't get away with traversing just one branch of the search tree.
posted by cortex at 1:01 PM on May 1, 2017 [1 favorite]

I'd just like to mention to you all that I found a Gamestop that was selling their Lego Dimensions inventory for 50% off everything. You might look at it as a Disney Infinity/Skylanders knockoff, but might I suggest looking at it as a way to cheaply get a Lego Minifig Mr. T, among other things?

The game's pretty awesome too, I hear, which is basically massive crossover shenanigans. It contains, among other things, an opportunity to roam around the actual Gauntlet arcade game, and a boss fight in which you distract GlaDOS by opening a portal to HAL from 2001 and getting the two into an argument (in which HAL keeps calling her "Dave").
posted by JHarris at 2:09 PM on May 1, 2017 [3 favorites]

If I bought 2 metric tonnes of Lego I'd need a device to sort all my worldly possessions, ready for when I'm thrown out of the house prior to the divorce.

I'm sure your partner would let you back in the house after a few months of penance in the backyard shed.

2 metric tonnes of Lego is a pretty nice shed, in potentia.
posted by sebastienbailard at 3:05 PM on May 1, 2017 [2 favorites]

I love Legos, but I think part of the fun is sifting through the bins to find the perfect piece, because along the way you'll see something that gives you another idea. Consequently my Legos are sorted into just four categories: in creations (both assembled and in progress), deep under furniture or behind the fridge (credit to my cat), in the bins where they belong, and on the floor, where either my cat will find them first and dispatch them into another dimension, or I will step on them in bare feet.
posted by carmicha at 3:06 PM on May 1, 2017 [1 favorite]

A piece of Lego is a brick
Two pieces of Lego are two bricks
A box of Lego is a box with Lego in it.
A metric fuckton of Lego is a very great deal of Lego.

You may collect Lego.
You may buy enough Lego for a 1:1 model of the ISS, or Tokyo.
You may stand on Lego with your bare feet in the night.

All these worlds are yours.

Except this: You may not collect, box, count, bankrupt or inflict exquisite pain on yourself with, Legos.

Legos is a misspelling of a city and a state in Nigeria.

I am not a prescriptivist. I am not a grammar nazi. I fully accept - indeed, delight in, language following its own path. But there is this, sole and pure unto itself:

Lego does not take the plural.


Thank you.
posted by Devonian at 3:35 PM on May 1, 2017 [4 favorites]

Lego does not take the plural.

[Hangs head in shame.]
posted by carmicha at 4:57 PM on May 1, 2017 [1 favorite]

no please don't exile me to the garden shed with my 2 tonnes of lego i beg you
posted by um at 5:51 PM on May 1, 2017

This is very cool but yeah, I want more writeup. I need to know what the right binning strategy is.
posted by LobsterMitten at 6:22 PM on May 1, 2017 [1 favorite]

It's been nagging me all day that something was wrong with my math, and I finally figured out where I went wrong. The whole complex algorithm I used is unnecessary and the number of passes for the admittedly naïve/worst-case is just (total bins - 1)/(machine bins - 1), so it's actually a bit worse than I had said before at 5095 passes.

Also, the overall structure of the sorting tree doesn't affect how many passes are needed, although it would impact how long each of those passes takes. It would make sense to have a lopsided search tree, where the more common pieces get final binned earlier to keep the average number of passes per piece down. But of course since this is for capitalism, market forces also apply and so maybe bin out the more profitable pieces earlier. And as an ongoing operation it could end up with tailings of pieces that are less profitable than feeding a fresh batch into the sorter.
posted by ckape at 6:40 PM on May 1, 2017

cortex - you're just saying if you need 30K buckets, you're going to end up with 30K buckets. Well, yah.

An efficient sorting mechanism can still be log(n), and that matters. And, from looking at the database, I suspect that A) about 20 buckets would cover >99% of pieces, and B) it's only 30K because of the colors. I grew up on red, blue, yellow, gray, black. I may be old, but in my day, light lavender lego bricks would have been considered an abomination, and rightly so.
posted by kleinsteradikaleminderheit at 6:52 PM on May 1, 2017

What I'm (totally congenially!) saying is that I want k5.user to be clearer about what

Otherwise, a far smarter sorter would have everything sorted in ~6 passes.

is using as an assumption about the desired ending state, and/or about what a "pass" involves physically in terms of loading buckets and running the machine. Because I'm genuinely interested in if I'm misunderstanding something, but find it deeply counterintuitive that 6 single iterations of "dump stuff in hopper, run machine, end up with pieces sorted among 7 buckets" would yield anything other than a very, very rough sort with lots of different brick types in each bucket, if we're tendering the possibility that there are thousands (if not actually tens of thousands) of distinct blocks that we wanted sorted out.

I might be intuiting badly, so I'm curious about the reasoning!
posted by cortex at 10:56 PM on May 1, 2017

Reading Gladwell's book on the 10,000 hour mastery thing made me realise the only legitimate skill I have ever developed to an expert level is the ability to find the desired block in a big tub of unsorted lego.
My kids will sometimes call me in from another room to find a motorbike wheel or left hand miniature wing or something and be flummoxed when I rake my hand over the bin and pull out the desired piece.

I could have misspent my youth in worse ways, but it always makes me wonder if I could have more productively become a concert pianist or NBA player.
posted by bystander at 1:42 AM on May 2, 2017 [3 favorites]

I was looking at it from a perspective that every piece will be sorted (sent through the machine) at most 6 times before it's in the correct/final bucket.

Not distinguishing how many different bucket loads go through, rather, per-piece, it will take 6 iterations to finalize.
posted by k5.user at 7:12 AM on May 2, 2017

« Older The dummy is a trifle. It is nothing.   |   DEAR WHITE PEOPLE Newer »

This thread has been archived and is closed to new comments