Optical-Mechanical Lego Sorting Machine

Similar projects worth following
Optical-Mechanical Lego sorting machine based on many of the designs already built using Legos and Mindstorm motors. This one is scaled up and ready for a lot of Legos with industrial components. It uses an implementation of emguCV, and can sort by color, shape, or set. The basis for this design is a machine that can be built from hardware purchased exclusively from McMaster, and requires a drill and a scroll saw. We plan to release the hardware design and parts list over the next few months.

I will add more details over the next few days, but one of the most important parts of the project is that it can be built almost entirely from McMaster parts, a scroll saw, and a drill. I designed this with the vision that anyone with minimal shop tools could put it together.

It has taken me over a year to design, prototype code, fabricate, and test.

Part selection to minimize cost was also important, and took a fair bit of time.

If you cannot wait for my updates, please ask questions and I will do my best to answer them and post them here, emailing me joseph(at) is the best way to reach me.

Sizzle Reel:

Sorting by shape:

  • 1 × Aluminum 48" x 48" x 0.250" plate
  • 2 × Gear Motors Misc gear motors, part numbers to come later
  • 1 × 1080p Camera Logitech C525
  • 1 × emguCV Image Recognition SW
  • 1 × Lots of time

View all 7 components

  • GoLive!

    Joseph Jankowski01/27/2015 at 05:37 0 comments

    We are going live today with our project and our website for a maker space we are trying to start in the South Bay of Los Angeles. I have been following hackaday for years, and wanted to use this project to kick off my first hackaday post and also begin planting the seeds for a new maker community. I plan to make updates to the hackaday space and our home page concurrently. Please check back often for more updates.


View project log

  • 1
    Step 1

    We will be adding build instructions over the next few months. I have 37 hours of video footage that I am trying to figure out how to break this down into usable vignettes. We will also be releasing a parts list, estimated cost, and drawings for the plates.

View all instructions

Enjoy this project?



codread wrote 02/26/2018 at 21:02 point

Oh wow awesome @senjuny and @Joseph Jankowski! How did you make the recognition or better (as I assume its a Neuronal Network) where did you get your training material for all the different types and shapes?

  Are you sure? yes | no

senjuny wrote 04/23/2016 at 02:33 point

I am developer in Korean.  I have been study a year Lego recognition. 

My prototype  can detect all of lego parts . 

You can see video --> 

this is recent . Fast recognition in three scecons.

this is last year. Slow recognition.

  Are you sure? yes | no

Joseph Jankowski wrote 04/23/2016 at 05:55 point

That is pretty awesome work Senjuny, how do you get the black and white camera image? 

  Are you sure? yes | no

senjuny wrote 04/23/2016 at 06:35 point

Hi! You can get black & white image by opencv. 

search google  opencv "ThreadHold"

  Are you sure? yes | no

Terminal wrote 01/07/2016 at 10:22 point

Thx for answer. There is no email on raritylabs page. Pls give a link to contact form or write to my email

  Are you sure? yes | no

Joseph Jankowski wrote 01/05/2016 at 15:17 point

Quick update: The wireless camera project has failed through four HW prototypes.  I think that is dead now.  However, I have been working on a touch screen Lego inventory manager, which is a key component to the backend of this Lego sorter.  With that software complete, I have been modifying the camera shape recognition algorithms and implemented a faster detection loop.  When I get some good working videos I will post them and more detailed build videos.  If anyone wants to get more details, please email me through the raritylabs web page and look for more updates soon.

  Are you sure? yes | no

Terminal wrote 01/05/2016 at 14:36 point

Great project! How can I connect with you?

  Are you sure? yes | no

Joseph Jankowski wrote 03/25/2015 at 01:31 point

Thanks to those who started following this project.  I will post more videos in May 2015.  We are currently working on a 13MP wireless streaming video system and have put this on the side burner for a few months.  I will be creating a project page for that soon, and make more updates here.  Talk to you soon!


  Are you sure? yes | no

Joseph Jankowski wrote 02/02/2015 at 00:27 point

Just uploaded a new video showing the machine sorting by shape. I will capture some video of sorting by color in a few weeks. I have to refactor some code and finish the build video first. New video can be found here:

  Are you sure? yes | no

Joseph Jankowski wrote 01/28/2015 at 06:39 point

Thanks, it will be a few more weeks on a video with more sorting. I really wanted to get the teaser reel out there first.

  Are you sure? yes | no

Adam Fabio wrote 01/28/2015 at 06:25 point

Awesome project! Can't wait to see videos of it sorting LEGO. good luck with the hackerspace!

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates