Hand tools and fabrication machines
The funny story is that this project was never meant to be.
About 3.5 years ago I started design a much funkier color sorting machine and like many of my projects it ended up half finished collecting dust on the window ledge (I am sure nobody else can relate to this haha).
Long story short, a few months ago I decided to pick up this old project back up. The first thing I needed to work out was how to collect Skittles from a reservoir and check their color quite reliably while keeping the system as compact as I could (which I failed to achieve the first time). I managed talking myself into designing a simpler color sorting machine just to get the design of the collection system right. I foolishly thought It would be a 2 weekends job, nice, easy and quick... Oh boy!!! was I wrong...
I took me 2 completely different design and many tweaked prototypes to get something that worked in a acceptable manner (I am still experiencing some pick up issues from time to time).
Even though it's not perfect I am quite pleased with the result.
The machine can be split in 2 main stages.
At the top you can find the reservoir for the unsorted Skittles. At the bottom of this reservoir is the feeding mechanism responsible for collecting Skittles and positioning them in front of the color sensor where their color will be checked.
The feeding mechanism include an arm that shakes the content of the reservoir to make sure the Skittles flow nicely through the orifice of the feeding mechanism without jamming inside the reservoir ( unfortunately it still happen sometime ).
Once the color of the Skittle has been found, the second stage of the machine comes into action. The test tubes holder align the right tube in front of the feeding mechanism for the Skittle to be dropped in.
The cycle can then be repeated until the reservoir is empty.WANT TO MAKE YOUR OWN???
Once you have downloaded and printed the parts you should end up with something like this :
Note that the front shell comes in 2 versions. No real difference they just look different.
The rest of the parts needed.
Here is a video of the assembly process. I even tried to be an artist by making an intro with slowmo 3D printer shots!!!INITIAL SETUP.
The first thing the machine does when you turn the power on is to move both servos to their initial position. When you start the machine for the first time you need to make sure the gear/shaft collecting the Skittles is at its top position and that the tube holder is align with the feeding mechanism.
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.
Tubes don't align properly:
During the starting sequence the tubes holder will move 5 times, once for each color. 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 color, by changing those values you can fine tune the where the tube is going to stop for each colors.
Due to printing tolerances you might also get some backlash in the tubes 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 color angle values depending which way the holder is spinning to compensate for this backlash.
If you experience some color 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 color, plug the machine to your computer and open the serial monitor. Every time a Skittle is being checked you should get its read RGB values and what color the program think it is. This should give you a better idea of what sort of values should associated with each color.A FEW COOL FEATURES.
(well I think they are anyway!)
The RGB LED:
There is a RGB LED fitted to the base of the machine. During the sorting process it changes color to match the color of the Skittle being dropped. It goes through every single Skittle colors continuously once the reservoir is empty.
It will also bling red on start up if an issue is detected with the sensor.
The tubes holder is spun using a couple of spur gears. Due to printing tolerance is is very difficult to completely get rid of any play in the gears. This means the tube holder tend to overshoot its ideal position. The code allows to compensate for this by stopping the holder earlier by a certain amount depending on what direction the holder is spinning.
Delay with extra:
The code include a "set_led(ms, color)" function. It act exactly like the "delay(ms)" function but allows the LED to smoothly shift to its new color while the delay happen. It work a treat to change the colors of the LED while the tube holder spin to its position !EXTRA NOTES.
Note 1: I printed my machine in black, this will have an impact on what color 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 colors seem to become more difficult to read reliably. I assume this is due to them losing their shine after rubbing inside the reservoir to many times or them going a little stickier when handled by hand (sounds gross!). When calibrating the color values try to use 'fresh' Skittles.
Note 3: Please make sure you take all precaution necessary when handling food. This include making sure you use food safe printing filament.
Note 4: I try to post some work in progress and what project I am up to on Instagram. If it's your thing you can have a look here : https://www.instagram.com/little_french_kev/