# Arduino Lego Sorter with vision

**URL:** <https://forum.arduino.cc/t/arduino-lego-sorter-with-vision/1389700>\
**Category:** General Guidance\
**Created:** [June 18, 2025, 2:31pm UTC](https://forum.arduino.cc/t/arduino-lego-sorter-with-vision/1389700 "2025-06-18T14:31:29Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![traderjoe](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/traderjoe/32/1013044_2.png) [@traderjoe](https://forum.arduino.cc/u/traderjoe)\
**Post date:** [June 18, 2025, 2:31pm UTC](https://forum.arduino.cc/t/arduino-lego-sorter-with-vision/1389700/1 "2025-06-18T14:31:29Z")

</div>

I'm thinking of making a Lego Sorter with a vision camera to help ID the piece. I want to sort by part number, not by color. I'd imagine the logic to go something like this:

1.) Trigger camera  
2.) Scan object  
3.) Look up object comparing it against a DB of known lego parts  
4.) Sends results back to Arduino  
5.) Sort

I think the hard part is step 3. Is this something doable with the arduino? Or is it best left for the raspberry pi? Thoughts on this?

Here's someone doing it with a raspberry pi  
[Video](https://www.youtube.com/watch?v=uCuQsNwX1QY)

he doesn't explain anything, just a demo of the sorter working.

---

<div class="post-metadata">

**Author:** ![anon94801460](https://avatars.discourse-cdn.com/v4/letter/a/278dde/32.png) [@anon94801460](https://forum.arduino.cc/u/anon94801460)\
**Post date:** [June 18, 2025, 2:33pm UTC](https://forum.arduino.cc/t/arduino-lego-sorter-with-vision/1389700/2 "2025-06-18T14:33:34Z")

</div>

Step 3 is the only difficult step. What is the approach?

---

<div class="post-metadata">

**Author:** ![Paul\_KD7HB](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/paul_kd7hb/32/1127958_2.png) [@Paul\_KD7HB](https://forum.arduino.cc/u/Paul_KD7HB)\
**Post date:** [June 18, 2025, 2:36pm UTC](https://forum.arduino.cc/t/arduino-lego-sorter-with-vision/1389700/3 "2025-06-18T14:36:53Z")

</div>

I think step #5 will be the hardest to achieve. Please expand on what and how you think sorting will be achieved!

---

<div class="post-metadata">

**Author:** ![traderjoe](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/traderjoe/32/1013044_2.png) [@traderjoe](https://forum.arduino.cc/u/traderjoe)\
**Post date:** [June 18, 2025, 2:40pm UTC](https://forum.arduino.cc/t/arduino-lego-sorter-with-vision/1389700/4 "2025-06-18T14:40:43Z")

</div>

Specifically? No idea! That's why I'm here 🙂  
I'd imagine the arduino would scan the object in #2, then compare against a DB of known parts(?) the decide where to place the part. However, where is the DB? I'd think it's on the cloud. How do we access this cloud data? Where does the logic to compare the scanned parts vs DB of parts take place?

These are the initial questions I have. Thoughts?

---

<div class="post-metadata">

**Author:** ![traderjoe](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/traderjoe/32/1013044_2.png) [@traderjoe](https://forum.arduino.cc/u/traderjoe)\
**Post date:** [June 18, 2025, 2:43pm UTC](https://forum.arduino.cc/t/arduino-lego-sorter-with-vision/1389700/5 "2025-06-18T14:43:13Z")

</div>

So I was envisioning something like this:  
[Video](https://www.youtube.com/watch?v=uCuQsNwX1QY)

This is with a raspberry pi. But I find the arduino to be easier to work with.

How do you envision getting past step 3?

---

<div class="post-metadata">

**Author:** ![anon94801460](https://avatars.discourse-cdn.com/v4/letter/a/278dde/32.png) [@anon94801460](https://forum.arduino.cc/u/anon94801460)\
**Post date:** [June 18, 2025, 2:44pm UTC](https://forum.arduino.cc/t/arduino-lego-sorter-with-vision/1389700/6 "2025-06-18T14:44:01Z")

</div>

> [@traderjoe](#):
>
> However, where is the DB?

Good question, but it is not an Arduino question.

Most Arduinos have too little memory to do any serious image manipulation (if an image is a result of the "scan"), let alone comparison of images.

You might start by investigating the existence, locations, contents and structures of Lego part databases.

---

<div class="post-metadata">

**Author:** ![Paul\_KD7HB](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/paul_kd7hb/32/1127958_2.png) [@Paul\_KD7HB](https://forum.arduino.cc/u/Paul_KD7HB)\
**Post date:** [June 18, 2025, 3:15pm UTC](https://forum.arduino.cc/t/arduino-lego-sorter-with-vision/1389700/7 "2025-06-18T15:15:50Z")

</div>

If you have to sort the Legos in order to take an individual picture, what is the point of sorting them a much later time?

---

<div class="post-metadata">

**Author:** ![traderjoe](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/traderjoe/32/1013044_2.png) [@traderjoe](https://forum.arduino.cc/u/traderjoe)\
**Post date:** [June 18, 2025, 6:10pm UTC](https://forum.arduino.cc/t/arduino-lego-sorter-with-vision/1389700/8 "2025-06-18T18:10:31Z")

</div>

The Legos are in mixed together. So I'll have a separator that separates them, take individual photos, processes, then sorts them to the appropriate bin.

---

<div class="post-metadata">

**Author:** ![PaulRB](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/paulrb/32/216330_2.png) [@PaulRB](https://forum.arduino.cc/u/PaulRB)\
**Post date:** [June 18, 2025, 6:15pm UTC](https://forum.arduino.cc/t/arduino-lego-sorter-with-vision/1389700/9 "2025-06-18T18:15:20Z")

</div>

> [@traderjoe](#):
>
> So I was envisioning something like...  
> This is with a raspberry pi.

There's a reason for that. Take a look at the specs of a RPi (CPU cores, clock speed, RAM memory...) and compare them to the specs of a variety of Arduino boards. What do you see in common?

---

<div class="post-metadata">

**Author:** ![dougp](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/dougp/32/238908_2.png) [@dougp](https://forum.arduino.cc/u/dougp)\
**Post date:** [June 18, 2025, 10:17pm UTC](https://forum.arduino.cc/t/arduino-lego-sorter-with-vision/1389700/10 "2025-06-18T22:17:42Z")

</div>

> [@traderjoe](#):
>
> then sorts them to the appropriate bin.

Based on what criteria?

Same but different project.&nbsp; Possibly useful.

https://www.youtube.com/embed/s7dy0odA44U?feature=oembed&wmode=opaque&list=PL6ub9IFZuQ5FrVuH2LGPoBVt1JWzbpzYu&start=12

---

<div class="post-metadata">

**Author:** ![oqibidipo](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/oqibidipo/32/221794_2.png) [@oqibidipo](https://forum.arduino.cc/u/oqibidipo)\
**Post date:** [June 19, 2025, 3:51am UTC](https://forum.arduino.cc/t/arduino-lego-sorter-with-vision/1389700/11 "2025-06-19T03:51:47Z")

</div>

How large variety of bricks does it need to handle? Maybe you don't need an Arduino at all? 🙂

[![](https://europe1.discourse-cdn.com/arduino/original/4X/b/0/4/b04ab4d08854633bdab6d6a10d4518c87cf0ba4f.jpeg "Lego Brick-Sorting Bird") ](https://www.youtube.com/watch?v=vNdhyDScDBk)

---

<div class="post-metadata">

**Author:** ![xfpd](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/xfpd/32/1120236_2.png) [@xfpd](https://forum.arduino.cc/u/xfpd)\
**Post date:** [June 19, 2025, 4:24am UTC](https://forum.arduino.cc/t/arduino-lego-sorter-with-vision/1389700/12 "2025-06-19T04:24:57Z")

</div>

> **[Pixy2 Camera - Simple Object Recognition camera](https://dronebotworkshop.com/pixy2-camera/)**
>
> Pixy2 is an affordable camera capable of object recognition, line tracking, and barcode reading. Interface options for Arduino, Raspberry Pi, and others.

> **[HuskyLens - AI Machine Vision Sensor | DroneBot Workshop](https://dronebotworkshop.com/huskylens/)**
>
> Today we will learn how to use the HuskyLens, an AI Machine Vision sensor based upon the powerful Kendryte K210. We’ll use it by itself and with an Arduino

---

<div class="post-metadata">

**Author:** ![Grumpy\_Mike](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/grumpy_mike/32/213521_2.png) [@Grumpy\_Mike](https://forum.arduino.cc/u/Grumpy_Mike)\
**Post date:** [June 19, 2025, 6:17am UTC](https://forum.arduino.cc/t/arduino-lego-sorter-with-vision/1389700/13 "2025-06-19T06:17:31Z")

</div>

Yes I would agree that the HuskyLense is the way to go. I have one myself and it is fast and is simple to train.

I friend of mine who saw it working and had a Pixy2 said it knocked the socks of the Pixy2, which he considered useless.

> [@anon94801460](#):
>
> Good question, but it is not an Arduino question.

The fact that the HuskyLens handles all the heavy grunt and is so easy to connect to the Arduino in several ways, does make it, in my opinion, an Arduino question.

PS. the Lego corporation make it very clear that these bricks should be called Lego and **not** Legos.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [December 16, 2025, 6:18am UTC](https://forum.arduino.cc/t/arduino-lego-sorter-with-vision/1389700/14 "2025-12-16T06:18:02Z")

</div>

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
