I decided to put my own spin on a classic arduino beginner project, the Skittle colour sorting machine . I could have designed one for sorting M&M's but everybody know that Skittles are better !!!
Although this is a beginner friendly project I will assume that you already know some very basic things about arduinos such as using servos, controlling an RGB leds using PWM and of course uploading a program to your arduino .
The way it works is quite simple .
For this project I tried to design a device as compact as I could .
A reservoir that contain the unsorted Skittles seats on the top of the machine .
At the bottom of this reservoir you will find the feeding mechanism which collect the skittles one by one and move them in front of the colour sensor .
NOTE : From time to time the feeding mechanism can struggle piking up skittles despite the reservoir shaking arm . A minor redesign of the reservoir is probably necessary to cure the problem completely .
Once the colour of the Skittle has been checked, the bottom part of the machine will move to align the matching container with the feeding mechanism . When this is done the Skittle can be release and the cycle repeat itself until every Skittles have been sorted .
WHAT YOU NEED .
*** disclaimer : some of the links below are affiliate links, this means I get a small commission when you purchase using them ( at no extra cost to you ) . If you like this website please consider using them but you don't have to ! ***
- wire stripper
- pliers (for support material removal)
- soldering iron
- crimping tool
- 3D printer
- LM2596 buck converter
- arduino nano (or clone)
- 2X MG-90S servos
- TCS 34725 RGB sensor
- 3X MR105ZZ ball bearing (5 x 10 x 4 mm)
- 608RS or 608ZZ ball bearing (8 x 22 x 7mm)
- 6003RS ball bearing (17x35x10mm)
- M3*15mm countersunk screw
- 20X M2x10 self taping screws
- RGB led (common Anode(+))
- 3X 220 ohm resistors
- 2.1x5.5mm jack plug
- heatshrink tubing
- dupont connectors
- 9V or 12v power supply (1 amp minimum)
- 5X 22mm(OD)x100mm test tubes (those are from Danmu Art)
- and of course some skittles
You can also find them on the DOWNLOAD PAGE
SHELL REAR SHELL FRONT
SERVO GEAR TOP GEAR
The front shell comes in 2 different version .
IMPORTANT : Make sure your buck converter output 5V before wiring anything to it !!!
software (and servos setup) .
You can also find them on the DOWNLOAD PAGE
Before uploading the program you will need to make sure the Adafruit tcs34725 library is installed .
Toward the end of the assembly video you can see me powering the system and unplugging straight away . This is to force the feeding mechanism and the tube holder servos to move in their initial position .
On start up the feeding mechanism collecting shaft should to it's top dead centre position and one of the tube holder hole aligned with the feeder mechanism .
TROUBLE SHOOTING .
If you decide to make this sorting machine yourself you might run into a few common issues . here is how you can resolve them .
LED BLINKING RED - NO STARTING SEQUENCE .
After moving to it's initial position the machine should go through its starting sequence .
If it doesn't and instead the LED blinks red, it means you have some issues with your RBG sensor not being found . There is either a problem with your wiring or the sensor being faulty .
THE TUBES DON'T ALIGN PROPERLY .
During the starting sequence the tube holder will move 5 times, once for each colour . You might notice that the tubes don't align too well with the feeding mechanism . This could be due to the servos no being super precise or to some variations in the print dimensions .
This can be corrected through software by modifying the colour_angle variable array . Each values in this array represent the servo position for each colour, by changing those values you can fine tune the where the tube is going to stop for each colours .
Due to printing tolerances you might get some backlash in the tube holder gears . Depending which way the tubes are spinning their inertia can make them overshoot their stopping position . This can also be corrected through software by modifying the forward and backwash anti backlash variable .Those value will be added to or removed from the colour angle values depending which way the holder is spinning to compensate for the backlash .
COLOUR MIXING .
If you experience some colour mixing, you will have to modify colour limit values arrays . Each values in those array represent the minimum and maximum values for Red, Green and Blue .To have a better idea of what the values should be load the machine with only one colour . plug the machine to your computer and open the serial monitor . Everytime a skittle is being check you should get the read RGB values and what colour the program think it is . This should give you a better idea of what sort of values are associated with each colour .
Note 1 : I printed my machine in black, this will have an impact on what colour values the sensor will read especially when no Skittles is collected by the feeding mechanism .
Note 2 : After going through the sorting process several time the Skittles colours seem to become more difficult to read reliably . When calibrating the colour try to use 'fresh' Skittles .
Note 3 : Please make sure you take all precaution necessary when handling food. This include you make sure to use food safe printing filament.