Lego (Color) Sorters
Summary
Motivation: Everyone would love to clean up their Lego parts automatically. A sorter built with Legos is more satisfying. It was a fun build/ test.
Build :
- Decided on Sorter Car because it doesn't limit the number of colors.
- Used (Rebrickable - MOC by Philoo) build unchanged except delivery shoot.
- Took off end L beam on delivery shoot, because it was too low and pieces hung when landed in same place.
Program: (See photo) Used associated program as guide Two real changes:
1) Fewer bins since mapped colors to bin number. Philoo mapped to Lego Color, so more bins then colors. This mapping makes it easy to sort few colors
2) Added code for minimal error checking for color sensor not knowing color. Only happened when add while running and lands crooked. And code handles if using few colors and unknown color there.
3) Color of power button used as an indicator of the color of piece last seen.
Status: Finished
School use:
- Build : easy enough for middle school up.
- Program:
- Use if s with Middle Schoolers or beginners.
- Using relative position is a better solution if students can handle the concept and formulas.
- Mapping color to bin is a good concept for more experience students to learn.
- Could be used to teach testing.
What Part to sort? Affects delivery shoot build. [consider if modify for another build]
- Must be Multiple colored and similar sizes like pegs and colored regular Lego pieces.
- How easy to build Delivery Shoot work for part sorting?
- Does the part size affect the delivery bin build?
Build
Used Spike Prime Color (Car) Sorter idea from Rebrickable - MOC by Philoo No changes were needed.
Part Sorted: Lego 2x4 Shoots width fits this part best.
Programming (Word blocks)
Wanted:
- Readability (define own block and couple variable with meaningful names)
- Actions separated out (what do when color detected)
- Initialize motors
- Prefer go to next color without going back to the beginning,
- Used formula that used current relative position
Programming approaches:
in order of my preferences
- Event oriented (Broadcast/ Receive) [my preference - didn't work]
- wait doesn't block, so when next color detected, starts on it without finishing previous color.
- Possible solution is adding a timed hard wait
- Define Blocks (Philoo) - modular, goes directly to next color, but formula makes harder to read,
- Used a modified version with bin mapped to color so only colors used have a bin. summarized above. Note: Mapping makes it easier to use fewer colors.
- if/then Let's Craft Big easy to read, goes back to beginning each time (simplest)
- Could handle multiple blocks in same loop round, depending on order of parts but ...
- Since goes back to beginning each time, that is ok unless reading cloor
- Nested if/then/else Mr. Hino, goes back to beginning each time
- If/then/else was needed when added the reaction for unknown colors.
Tests
Stable Build tests
Car : stable attachments (doesn't wobble and fall off)
Smooth transitions of Lego part to be sorted :
- Part Shoot to...
- Color Sensor to... [Yellow - occasional problems. Read best piece upside down.]
- Shover to... [Had to be just a little back or pieces didn't slide in place always]
- Delivery Shoot to... [removed end L beam because too low and could dragged delivered parts
- Bin (=Compartment) [Just used floor]
Program Tests
- Tested first with 3 colors. Load Stack. Stack had same color together, mixed colors, so order changed. [Especially important when using relative position]
- Loading pieces on the fly
- With few colors, introduce an unknown foruth color to test unknown
- Test with all colors
Design Discussion
Simplest : Color Sorter because Lego robots have a color sensor.
Sorters by size: Shake down by hole size is currently popular.
- Round holes
- Square holes
High Level Functional Design:
Step1: Deliver part to color sensor- Manually deliver part to a shoot where part slides down to the color sensor
Step 2: Put part to color bin
- Option 1: Deliver Bin to part
- Small footprint, but needs 2 extra motors. Fun build.
- Option 2: Deliver part to Compartment (multiple approaches)
Design Choice: Option 2 / Car: Deliver Part to Bin via Sorter Car
- Number of colors to sort not limited
- If lots of color may take more space
- Few components (2 shoots, wheels motor, shover motor, color sensor)
- Program can be simple
Similar:
EV3 Car Sorter build Original sorter car idea was this EV3 education version
MOC - Spike Prime Color Sorter (Car) by Philoo (The Original for Spike Prime)
Includes build instructions pdf.
Program: Defines own blocks. Goes directly to next color.
V3 Program in comments: Goes directly to right color from current position
Program: Uses If/Then Both motors go forward then backwards to the beginning each time. Clean to read. OK if find more than one color before restarting loop.
No build instructions. Found fastest by google.
Program: if/then/else and goes forward then back to the beginning each time. Since go back to beginning each time, else is not needed. OK if find more than one color before restarting loop.

Comments
Post a Comment