Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

You can build an automatic LEGO sorter by combining a camera, an image classifier, a mechanism that presents one piece at a time, and motorized gates that route each result to a bin. The Raspberry Pi can capture images and control the mechanism; classification can run on the Pi, on a separate computer, or—in a documented 2021 design—on a more powerful computer receiving images from the Pi. The exact choice depends on your model, hardware, and tolerance for setup and communications complexity.

These components solve different problems: TensorFlow classifies what the camera sees, while the feeder and gates handle physical separation and routing. A working design therefore needs more than a trained model. The example below explains the system and its design decisions, but the available projects do not establish a current, exact bill of materials or guaranteed performance for a new build.

How the sorter works

A sorter moves pieces through a sequence: present one piece, capture an image, classify it, and route it to the matching destination. In Raspberry Pi’s project feature published 19 January 2021, belts feed pieces onto a vibration plate, a camera scans them, a neural network identifies them, and servo-controlled gates send them to buckets. The maker, Daniel West, built a machine containing more than 10,000 LEGO bricks and 18 output buckets; Raspberry Pi reports that it sorted one brick every two seconds. Those figures describe that specific project, not a general benchmark.

The feature describes its classifier as a convolutional neural network (CNN), a model type commonly used for image classification. The overall design still depends on the mechanical and control stages: a correct prediction cannot reliably route a piece if several pieces overlap in the camera view or the gate does not move as expected.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
5 Tray Stackable Brick Sorter & Sifter for LEGO Bricks and Compatible Building Blocks | Stackable Sorting Tray Organizer | No Assembly | STEM Gift for Builders & Hobbyists
  • 【OPTIMIZED HEX GRID FILTERS FASTER, CLOGS LESS】- Our optimized hexagonal grid minimizes material between openings so bricks fall through cleanly instead of sitting on edges. This reduces clogging with tiny tiles, studs, and Technic pins. Designed and manufactured in the USA.
  • 【5 PRECISION‑GRADED TRAYS FOR PERFECT SIZE SEPARATION】- Each tray is calibrated for a specific size range so bricks, plates, and micro‑elements automatically settle into the right level. Stack the trays, pour your bricks in, shake - sorted.
  • 【BUILT TO LAST - TOUGH & CRACK-RESISTANT】- Made from durable, impact‑resistant material that handles heavy loads of bricks without cracking or warping. Ideal for long sorting sessions and large collections.
  • 【COLOR‑CODED SIZES - GRAB THE RIGHT TRAY INSTANTLY】- Each size has its own color (red, orange, yellow, green, blue) so you instantly know which tray holds which size. No reading labels, no guessing - just reach for the color you need and get back to building.
  • 【COMPATIBLE WITH LEGO BRICKS - FOR BUILDERS & COLLECTORS】- Perfect for sorting bulk brick hauls, organizing a build table, or managing a serious collection. Compatible with LEGO bricks and other major building block brands. Makes a brilliant gift for any builder.

Choose where TensorFlow inference runs

Inference is the step that applies a trained model to an image and returns a predicted class. You have several possible architectures; they are not interchangeable implementations, and none of the cited projects establishes a guaranteed speed or accuracy for a particular current Raspberry Pi.

Approach What the sources establish What to consider
Pi captures; separate computer classifies The 2021 Raspberry Pi feature describes video sent from a Raspberry Pi 3 Model B+ to a more powerful computer for neural-network classification, with the result returned to control the sorter. Raspberry Pi project feature. Requires a connection and a computer running the classifier. Test the complete image-and-control path, not just model inference.
Train elsewhere; Pi requests predictions A separate pbackx project repository describes gathering machine images, training on a PC or cloud environment, and sending the resulting model to a prediction server. The repository describes a different design and says its setup is not plug-and-play and is being overhauled. Do not assume its software or hardware matches the Raspberry Pi feature.
TensorFlow Lite camera post-processing Raspberry Pi’s camera documentation describes a TensorFlow Lite object-classification stage. It states that Raspberry Pi OS Trixie onward includes a TensorFlow Lite package, and that rpicam-apps must be recompiled with TensorFlow Lite support to use those stages. Follow the current camera-software instructions for the OS and pipeline you actually use. This documentation does not show that a particular LEGO model will meet a particular speed or accuracy target on your Pi.

TensorFlow’s 17 May 2022 maker-kit article describes a Raspberry Pi, Pi Camera, and Coral USB Accelerator arrangement for advanced vision models on a Coral Edge TPU. Treat Coral as an optional acceleration route for compatible models, not a required component of a LEGO sorter.

Rank #2
LEGO Ideas Minifigure Vending Machine 21358
  • RELIVE CHILDHOOD MEMORIES – Spark nostalgia with the LEGO Minifigure Vending Machine (21358) building blocks for adults 18 years and up
  • LEGO COIN-OPERATED ACTION – Builders can construct their own vending machine, then drop a LEGO coin element in the slot and turn a handle that really clicks to release a capsule containing 16 buildable LEGO minifigures
  • 16 LEGO MINIFIGURES – Build characters from classic LEGO themes including Castle, Paradisa, and Fabuland, as well as 4 fan-selected minifigures, a minifigure of this set's designer, and more
  • HOME & OFFICE DECOR – Relax and unwind with a mindful construction challenge, using clever LEGO building techniques to build a classic vending machine that's fun to play with and doubles as a creative decoration for a bookshelf or bedroom
  • GIFT FOR MEN & WOMEN – Treat yourself or gift this LEGO building set to other creative adults who love retro art, design, and enjoy collecting LEGO sets and minifigures

Plan the camera view and image capture

Make the camera see one piece in a consistent position and under repeatable lighting. The 2021 machine used a Raspberry Pi Camera Module V2; that historical parts list is not a current compatibility recommendation. The pbackx repository also discusses focusing the camera and checking its live feed before continuing. Camera choice should follow the board and software setup you intend to run; the available sources do not validate one camera module for every current Raspberry Pi model.

  • Position the camera so the scanned piece is large enough and not obscured by the feeder or surrounding parts.
  • Keep the camera, piece location, background, and lighting as consistent as practical.
  • Check focus and exposure using representative pieces, including the angles and colors your sorter will encounter.

Define the classes and collect training images

Decide what the classifier should recognize before collecting data. A class could mean an exact LEGO part ID, a broad shape, a color, or a practical group of pieces that share a bin. Those choices affect the model and the number of output bins; the cited projects do not experimentally compare different class schemes.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
LIGHTAILING Light for Lego-76429 Talking Sorting Hat - Led Lighting Kit Compatible with Lego Building Blocks Model - NOT Included The Model Set
  • USAGE: The Light Set is used to light up 76429 Talking Sorting Hat (NOT include the Lego Set).
  • PRODUCT FEATURE: The Light is made use of original material purely handmade. It contains 1 USB light kits, instruction guide, battery box. Plug in power, and light up your building blocks with our amazing design!
  • TIPS: Prepare three AA Batteries, or USB Charger and Voltage should be less than 5V to avoid burning.
  • INSTALLATION INSTRUCTION: The light set installation is done to your preference. Please install your led light carefully, no hard pulling and no need to bend or shake it.
  • ABOUT US: Specialized in custom-designed Lighting Kit toys, we aim to supply customer with good products and quality services. Make your creations unique with your rich imagination and creativity. Let 's light up your bricks and bring them new vitality. If you have any problems, please do not hesitate to contact us. Have a happy shopping experience!

The Raspberry Pi feature says West trained the featured classifier using 3D LEGO model images. The pbackx project describes a different workflow: collecting photographs on the machine, removing unusable images such as unclear pieces or frames with two parts, and keeping image counts roughly balanced between brick types. These are alternative data strategies, not evidence that one is best for every build.

  • For a custom photo dataset, include the lighting and piece angles the machine will encounter.
  • Remove images that do not clearly show the intended single object.
  • Check that classes are represented reasonably evenly so the model is not trained on a skewed sample.
  • Evaluate using photos that were not used for training; otherwise, the results may not reflect how the model handles new images.

Feed one piece at a time

Singulation—the process of separating pieces so only one reaches the camera at a time—is a mechanical requirement, not a function of the classifier. In the Raspberry Pi design, primary and secondary belts moved pieces onto a vibration plate, which shook them apart before scanning. If the model is meant to identify one piece per image, overlapping parts or multiple pieces in a frame can undermine the result regardless of how well it was trained.

Rank #4
Nitemode Light Kit for LEGO 76429 Talking Sorting Hat, Lights Only
  • 【Easy Installation】: NiteMode light kits are specially designed by our lighting experts with step-by-step online installation instructions
  • 【PERFECT COMPATIBILITY】NiteMode light kit is compatible with lego sorting hat 76429 Model, almost no bare wires, fits perfectly with the model, great upgrade for your building kit and a great gift for collectors
  • 【Great accessory for your model】: NiteMode Lighting Kit is compatible with Lego 76429 Talking Sorting Hat Model, Creative Lighting brings life and vitality to your models, this lighting kit can make your block kits shinier and more fun
  • 【PERFECT GIFT】NiteMode LED light kit will be the best gift for your lover, son, daughter, boyfriend and girlfriend and friends, such as wedding anniversary, birthday, Christmas, Valentine's Day and so on
  • 【Warm Service】 We always try our best to provide our customers with high quality products and excellent service. If you have any questions about the product, please email us and we will help you solve the problem in time

Design and test this stage with the actual range of pieces you intend to sort. The source projects do not provide a universal feeder design or a guaranteed singulation rate.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Route predictions and handle unknown pieces

Once the classifier returns a class, the controller must map that result to a physical destination. The Raspberry Pi reference used servo-controlled gates to direct pieces into 18 buckets. A separate camera-based prototype used predefined groups and could leave unmatched pieces unidentified rather than claiming perfect recognition. That is a useful design principle: provide a reject or unknown destination instead of forcing every uncertain result into a known class.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
HANTAVON Building Baseplate Table for Lego with Portable Lego Sorting Tray
  • VERSATILE DESIGN: This multifunctional lego table provides an ideal surface for builders of all ages. Crafted from premium wood, it accommodates multiple lego trays for building simultaneously to keep your projects neatly organized.
  • STORAGE SOLUTION: Keep your workspace clutter-free with this practical puzzle table layout. Making cleanup fast and effortless after hours of creative play.
  • DURABLE BASEPLATE: Features a sturdy lego board that secures bricks tightly, even when tilted. The spacious lego tray design underneath offers ample room for categorizing pieces by color or size, preventing missing elements.
  • PORTABLE WORKSTATION: Transition seamlessly from room to room using the convenient lego lap desk format. It functions beautifully as a compact lego desk for study, drawing, or collaborative block building activities.
  • CREATIVE FREEDOM: Equipped with dual-sided lego boards to build on, offering endless customization options. This innovative stud tubs lego lap desk setup keeps your essential components within arm's reach at all times.

Plan what the sorter should do when a prediction is uncertain or a servo does not reach its expected position. A safe stop, retry, or unknown bin may be appropriate, but the cited sources do not specify a universal confidence threshold or control design. Set those behaviors for your mechanism and test them with real pieces.

What the reported performance numbers mean

Published figures from different builds cannot be combined into a single expected result. Raspberry Pi’s 2021 feature reports one brick every two seconds for West’s machine. A separate 2018 build’s video description reports 89% accurately sorted bricks, 98% separation efficiency, and 90.8% classification accuracy in its first run (Francisco Garcia’s video description). These are self-reported results for that other build, not benchmarks for the Raspberry Pi feature or a new sorter.

Keep the measures distinct when evaluating your own machine:

  • Separation efficiency concerns whether the feeder presents pieces individually.
  • Classification accuracy concerns whether the model labels the images correctly.
  • Overall sorting yield concerns whether pieces end up in the right destination across the complete machine.
  • Throughput concerns how quickly the full system processes pieces, including capture, inference, mechanical movement, and routing.

Historical reference hardware and current planning

The 2021 Raspberry Pi feature lists a Raspberry Pi 3 Model B+, Camera Module V2, nine servo motors, six LEGO motors, and L298N motor controllers. Use this as a description of that machine, not as a ready-to-buy parts list or a recommendation for a current build. The cited sources do not establish a fully compatible current bill of materials, current availability, or a verified performance target.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose the board, camera, motors, drivers, and mechanical components around your intended design, and verify their compatibility with the specific camera software and control approach you plan to use. A Pi board and camera provide the computing and image-capture foundation; motors, servos, drivers, and LEGO mechanisms perform feeding and routing. The Coral USB Accelerator is optional and applies only to compatible acceleration workloads.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.