HE BUILT A MACHINE THAT SORTS LOOSE LEGO BY ITSELF USING A CAMERA AND AI
A machine that feeds loose LEGO bricks up a hopper, photographs each one, and sorts them into bins using a trained neural network — no human in the loop.
AutomationAI
- difficulty
- ●●●●○
- time
- a long weekend-plus
- license
- GPL-3.0
- repo
- repo ACTIVE20 stars
●●●●○ · a long weekend-plus · GPL-3.0 · 20 stars · repo ACTIVE
WHAT YOU’LL NEED
- Electronic parts — full list with part numbers in the repo BOM
- Dev board / microcontroller — runs the project firmware
Partner
COMPAREE VERDICT
This is a complete sorting pipeline — hopper vibrates bricks onto a belt, a camera captures each one, and a neural network classifier decides which bin it drops into. The model and all code are in the repository, and the documentation covers wiring, setup, and retraining. What is missing is the frame: no CAD, no drawings, no cut list. You will be designing the physical structure yourself, which is fine if you are comfortable with that kind of fabrication, but it is the single biggest gap between the repository and a working machine. The parts list is honest and detailed, but there is no published total — expect 400-500 dollars depending on what you already own. The stepper wiring and conveyor mechanics are not trivial, so this is not a first electronics project. If you have a big LEGO collection and the workshop confidence to build a custom frame and belt system, this is a genuinely useful build. If you need step-by-step CAD and cut files, you will be designing half of it from scratch.
IN THE REPO
NOT IN THE REPO
- —The trained classifier model (models/CLASSIFIER_MODEL.h5) ships with the repository and can be retrained on your own brick categories.
- —Python code for the Raspberry Pi, Arduino sketch for motor control, and a detailed parts list are all present.
- —No 3D files or frame drawings — you will need to design or improvise the physical structure, hopper, and conveyor yourself.
- —The author never published a total build cost; the parts list (Raspberry Pi, camera, Arduino, stepper drivers, motors, belts, rollers, vibrating feeder, power supply, bins) suggests roughly 400-500 USD.
- —GPL-3.0 licence: open for commercial use with source disclosure.
- —Documentation walks through hardware assembly, software setup, and model retraining, but assumes you know how to wire steppers and build a conveyor.
Can I build this?
This build involves mains voltage — for adults comfortable with electrical work only.
Build at your own risk. Projects involve tools, electronics and sometimes mains voltage — follow the creator’s safety notes.
Partner · KickstarterCORE POWER BANK S: 0.2" thin, 2.8 oz, 5000 mAh with 22.5W fast charging. Semi-solid battery, carbon fiber, IPX7 waterproof.
Videos
I Built a LEGO SORTING MACHINE with a Raspberry Pi! #diy #lego ...
Gallery
Start here
Navigation into the creator’s own docs — we don’t rewrite the guide, we route you to the source.
- 1.Read the full parts list in the repository README and order components (No single supplier or kit — you will be sourcing steppers, drivers, belts, and frame materials separately.)
- 2.Design or improvise the frame and conveyor structure(No CAD or drawings provided — you will need to plan how to mount the hopper, belt, camera, and bins.)
- 3.Follow the wiring guide to connect the Arduino, stepper drivers, and motors (Includes pinout diagrams for the Arduino and stepper connections.)
- 4.Set up the Raspberry Pi, install dependencies, and load the pre-trained classifier model (Python environment setup and model file placement are documented.)
- 5.Run the test script to verify camera capture and sorting logic before running a full batch (Recommended to test with a small set of bricks first to calibrate camera position and bin alignment.)
Resources
Documentation, files and community threads for this build — we link straight to the original sources and never rehost the creator’s files.
KNOWN ISSUES
- No frame CAD or drawings — you will be designing the physical structure, hopper mount, and conveyor yourself, which is the biggest time sink if you are not experienced with mechanical builds.
- The author never published a total cost, so budget 400-500 USD and expect to adjust based on what you already own or can salvage.
- Stepper wiring and driver configuration can be fiddly — if the motors do not move or move erratically, check your wiring against the pinout diagram and verify driver current settings.
- Camera position and lighting matter — if the classifier is misidentifying bricks, adjust the camera angle and add diffuse lighting to reduce shadows.
- The vibrating feeder needs tuning to feed one brick at a time — too fast and bricks jam, too slow and throughput drops.
- Model retraining requires collecting and labelling your own training images — plan a few hours if you want to add custom categories.
Can I use a different single-board computer instead of a Raspberry Pi?
Yes, as long as it runs Python and supports the Pi camera or a USB webcam. You may need to adjust the camera capture code.
How accurate is the classifier on unusual or worn bricks?
The pre-trained model covers common bricks, but worn or rare pieces may misclassify. Retraining the model on your own images improves accuracy for those cases.
Do I need to design the frame from scratch?
No drawings are provided, so yes — plan how to mount the hopper, belt, camera, and bins. Wood or aluminium extrusion both work.
How long does it take to sort a large bin of LEGO?
Throughput depends on your feeder tuning and belt speed. Expect several hours for thousands of bricks, faster than hand-sorting but not instant.
Can I add more sorting bins?
Yes — update the category list in the code and retrain the model to recognise the new bins.
Community builds
No community builds yet — be the first, we feature the best ones.
Discussion1
FROM THE COMPAREE TEAM
The trained model ships with the project, and it can be retrained on your own brick categories. What would you sort first — by color, by type, or by set?
BrickSortingMachine
The creator built this machine to solve the universal LEGO problem: finding one specific piece in a bin of thousands. The repository documents the full pipeline from hopper to classifier, and the model ships ready to run.
DISCLAIMER
- Comparee is not the author of the projects featured here. All rights to each project belong to its creator — every page links to the original source, and we never host creators’ files.
- Information is provided without warranty and may become outdated as projects evolve. Prices are indicative bands only — always check the creator’s parts list for current costs.
- Building and operating any project is at your own responsibility. Protective equipment, safe workshop practice and compliance with local regulations are the builder’s responsibility.


CompareeTEAM20d ago
Practical notes from our verification: the repository includes a detailed parts list and wiring guide, but no frame CAD or drawings — you will be designing that part yourself, which is the single biggest time sink if you are not experienced with mechanical builds. The pre-trained classifier model is in the repo and runs on a Raspberry Pi, and the documentation walks through retraining if you want custom categories. The author never published a total cost, but the parts list suggests 400-500 USD depending on what you already own. The Instagram demo shows the machine running, and the repository was active as of our check.