M&M sorter

It’s time for a new Lego Mindstorms project, after the paper plane launcher and the coin pusher.

Until now, I’ve never really used my color sensor, so I decided to give it a try.

The plan

I wanted to see whether it is possible to sort M&M’s based on their color.

The construction consists of 3 main parts:

  • A slow caterpillar track where you can add all your M&M’s
  • A faster caterpillar track where the color is checked
  • Four buckets for each color

Slow caterpillar track

This is a larger area so that it can hold a lot of M&M’s at once. The caterpillar track moves slowly so that the next part only gets one M&M at a time.

Color checker

Both caterpillar tracks run at a different speed, so that distance between M&M’s is increased. The color is checked on the second caterpillar track.

Color sorting

The buckets rotate so that they can catch the M&M’s just in time.

The code

This first part of coding takes care of the startup of the machine, and sets both caterpillar tracks in motion.

This next part handles the color detection, and gives instructions to the motor that controls the buckets.

The result

One thought on “M&M sorter

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s