Search

Arduino M&m Sorting Machine!

About the project

This machine was built specifically to sort mini M&M's in the most efficient manner possible. All the components of the project are controlled by an Arduino micro controller.

Project info

Difficulty: Difficult

Platforms: Arduino

Estimated time: 1 week

License: GNU General Public License, version 3 or later (GPL3+)

Items used in this project

Hardware components

ARDUINO NANO V3 A000005 ARDUINO NANO V3 A000005 x 1
12v Buck Converter 12v Buck Converter x 2
TCS230 Colour Sensor TCS230 Colour Sensor x 1
DC Plug DC Plug x 2
SG-90 Servo Motor SG-90 Servo Motor x 5
12v Power Adapter 12v Power Adapter x 2
BreadBoard Arduino Large BreadBoard Arduino Large x 1

Software apps and online services

Arduino Arduino

Hand tools and fabrication machines

Glue Gun Glue Gun x 1
Sandpaper Sandpaper x 1
Soldering Iron Soldering Iron x 1
Plywood Plywood x 1
Cardboard Cardboard (Optional) x 1
Jigsaw Jigsaw x 1
Drill Drill x 1

Story

Story:

The M&M sorting machine was made for a school project but unlike the other kids I decided to take to project a step ahead. 

Note: all the footage in this article are from the video.

Project Video:

How it Works:

First the M&M’s get lined up in a tube. The tube leads to a sliding wooden strip with a M&M sized slot. When the slot lines up with the tube the M&M at the bottom drops into the slot. Then the strip moves the M&Ms under the colour sensor which reads its colour intensity and presents them in the RGB scale to the Arduino controller. During the calibration stage we measured colour intensity over 1000 times and worked out the ranges of the values for each of the colours then we put them into a pattern table. The Arduino then compares the values with a pattern table and depending on the colour of the M&M sets the variables which will dictate the actions for the servo motors attached to the sliding strips at each of the layers of the sorting mechanism. A M&M travels downwards through the layers of the sorting mechanism (AKA chamber). At each of the layers the M&M can be pushed in one of two holes and end up in one of six exit holes leading to a gathering tray where the M&M ends up with other M&M's of its colour. The machine sorts arduino one M&M per second.

The Tube where the M&M's line up:

The Sensor:

The Servos that move the layers: 

The Chamber that Sorts the M&M's:

The Tray where the Sorted M&M's end up:

Tutorial:

Step 1. Building the Chamber

The first thing that we need to do before we move on to the electronics or coding is to build the machine itself.  The machine consists of three layers of sliding plywood (plywood that will be moved using a servo motor) and four layers of static plywood. Each layer of plywood (sliding or static) has holes drilled into it. Every sliding layer has a static layer below and above it. The static layers above the moving layer get slightly lifted with rectangular pieces of wood (wooden chip) so the moving layers can move freely. Follow the schematics below to build the layers.

Note: the schematics will be drawn in CAD so they are easier to follow.

Sliding Layer 1(Above)

Sliding Layer 2 (Above)

Sliding Layer 3 (Above)

Static Layer 1 (Above)

Static Layer 2 (Above)

Static Layer 3 (Above)

Static Layer 4 (Above)

After you have made all the parts put them together like in the image below (Only glue the wooden chips to the static layer do not glue the moving layers):

What the chamber should looks like assembled:

Step 2. Structural Enhancement

Now that you have made the chamber you might have noticed that there is nothing holding the project up therefore we need to make the baseplate. The baseplate holds the project up and is what the pillars attach to.

Baseplate (Above)

Schematic for the baseplate:

After you have made the baseplate attach to the chamber it should look something like the image below.

Now it is time to attach the pillars to the baseplate. I made my pillars out of LEGO but you can make yours our of what ever you like.

My pillars:

Step 3. Servo Holders

Now that the chamber is standing up on its feet it is time that we add servo holders which will be for the servos that will be moving the layers in the chamber. You already have 1 of the 4 servo holders installed (the hole in the baseplate)

Servo Holders:

Schematics for the servo holders:

Servo Holder 1:

Servo Holder 2:

Servo Holder 3:

After you have made the parts attach servo holder 2 & 3 like shown in the image below:

Suspend servo holder 1 in the air with paddle pop sticks or a material of your choice.

Servo Holder 1 on my machine (Above)

Step 4. Setting up the Electronics

Now it's time for the interesting part of this projects the brains. Follow the schematic below.

Don’t forget to put the servos in the servo holders, glue them in place and attach them to the moving layers using paper clips.

After you have put everything on a bread board it should look something like this:

Put your breadboard somewhere on the machine. I put mine in between the pillars.

Step 5. Sliding Strip

The job of the sliding strip is to move the M&M’s from the hopper to the sensor and finally to the chamber.

Follow the schematics below to build the moving strip.

Note: for best performance with the sensor paint the strip black.

Use four wooden chips to firmly hold the strip in place. After this attach the strip to the servo motor that is located at servo motor holder 1.

Step 6. Sensor Setup

Before installing the sensor wrap it Arduino something dark. This will ensure more accurate sensor readings. Then glue the sensor to the machine like shown in the image below.

Step 7. Hopper and Anti-Clog Mechanism

Get a hopper and glue it onto a tube that is 10mm in diameter.

Time to make the anti-clog mechanism that will stop any clogging of M&M’s in the hopper. The mechanism comes in two parts: the plate and the claw.

Schematic for the plate:

Note: make two plates

 Schematic for the claw:

Time to assemble the plate and the claw. First slide a toothpick through the hole in the claw put a plate on either side. Glue the plates together (not too tight or the claw won’t rotate). Cut a thin hole down the side of the hopper and the tube. Glue the anti-clog mechanism to the side of the hopper claw first. Now glue the servo in the servo hole of the plate. Attach the servo to the claw. Now attach the whole contraption on the sliding strip(do not glue onto the sliding strip) .You are now done. The finished product should look something like this:

Step 8. Making the gathering tray

The last part of the sorting machine is the gathering tray. This step is optional. You don’t need to be precise when making the tray and that is why I didn’t provide a schematic.

 

My gathering tray (Above)

Thanks for Reading

Thanks for reading to the bottom. If you would like to support me please view my YouTube video on this project and subscribe. If you have any questions comment them on my YouTube video and I will answer them. I hope you had fun making this project.

Schematics and circuit diagrams

Sliding strip

Static Layer 1

Wooden Chip

Servo Holder 1

Sliding Layer 2

Static Layer 4

Electronics Schematic

Claw

Anti-Clog Plate

Servo Holder 3

Sliding Layer 1

Sliding Layer 3

Static Layer 3

Servo Holder 2

Baseplate

Static Layer 2

Code

M&M Sorting Machine Code

Credits

Photo of TemkaMikhaylov

TemkaMikhaylov

Iam a kid that is interested in electronics projects especially ones built using arduino.

   

Leave your feedback...