Introduction: Color Sorter
This Color Sorters goal is to move m&ms into different piles based on their color.
Step 1: Step 1: Making the Bases
The first step to making this project is making the base that the motors and and color sorter sensor sit on. These bases are 5.3 cm by 12 cm and you need to make three of them. After that you create the small quarter circle that has a radius of 4.1 cm and inside of the quarter circle make a 1 cm square cutout for the m&ms to fall through.
Step 2: Step 2: Cutouts and Slider
For the next step you will cut out a shape as shown above to create a path for the quarter circle from the previous step to slide across. On the path cut out a hole at the end to make a way for the m&m to fall down to the slide.
Next cut out a 0.5x0.5 cm square and cut the square in half making it half its original height. Then take a small screw and poke it through the path you created, the 0.5x0.5, and the base that all of this sits on.
Cut out holes and slits to allow for a place for the servo motors and color sensor to sit. You will need to make one hole on that base that will sit lowest in the build. This cut out will be the size of the servo motor. The middle base needs two cutouts. One cutout will be the same size as the cutout from the previous base and the other will be 2cmx2cm and this will be directly under the hole on the path that the m&m falls through.
Step 3: Step 3: Slide
For this step cut a 4cmx14cm rectangle and make lines 1 inch in on both sides that extend 14 cm. Cut down the lines on both side but DO NOT cut all the way through the board. After you make these two cuts both 1cm side should be able to move up and create railings for the slide.
Next make a base for the slide to sit on so it can connect to the servo motor. To do the you will need to create two small rectangles as seen in the picture. connect the two rectangles at a right angle with 2 pushpins and place one pushpin in the middle of the rectangle that will sit parallel to the floor(this is how it will connect to the motor). And finally for this step use two small nails to connect the slide to the two rectangles keeping the slide at an angle so the m&ms can roll down.
Step 4: Step 4: Connecting Everything
The final step to putting together the body of this project is connecting all of the parts. To do this you will need to cut out two 5.3x18cm rectangles and one 13.2x18cm rectangle. The two 5.3x18cm rectangles will be used for the sides and and the other rectangle will be the back
In the back rectangle cut out 3 holes to give the wires connected to the Arduino a way to connect to the motors and sensor
Then connect the two 5.3x18cm rectangles to the sides of the 5.3x12cm bases that is 5.3cm long using pushpins. The first base will be 3 cm from the ground. The second base will be 10.5cm from the ground and the third base will be 15cm from the ground. Each base should be connected with 4 pushpins adding up to 12 pins on both sides. Connect the 13.2x18cm rectangle to the back doing the same thing with 4 pins on each side.
Step 5: Step 5: Building the Arduino
The animated picture is the diagram of the Arduino that was build by the original person that made the color sorter.
For my Arduino I moved where the different wires go because I did not use an Arduino Nano. I keep all of the spots the same as shown in the diagram other than the 5V and GND for the motors. For the 5V I took a wire and directed it from the 5V spot onto the board to the left of it. Then I took two wire and put them in the same row as the 5V wire and then connected these two wire to the motors. I did this same process for the GND wires.
Step 6: Step 6: Arduino Code
For the code the first part defines where the different wires are in the Arduino and sets variables like the two servo motors and S[0-1]. Next the code moved the top servo motor with the m&m to directly under the color sensor. Next the LEDs connected to the color sensor turn on and the color sensor takes in a value for the Red Green and Blue frequency it detects in the m&m. Then depending on the amount of RGB it picks up it assigns the m&m a color and sets it to color = [1-6]. From the color it is given it will lead it to one of the six cases. The different cases all start different sets of code that rotate the bottom servo motor connected to the slide different amounts to create the different piles of different color m&ms