Difference between revisions of "Skittles M&M's Sorting Machine"
(54 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
[[Image:Sorting_machine_view.jpg| | [[Image:Sorting_machine_view.jpg|570px|right]] | ||
This machine sorts candy by color. It | This machine sorts candy by color. It separates different colored Skittles and M&Ms pieces and puts them into individual cups. The machine is fully automated and will sort an entire 1.5kg/56oz bag in approx. 5 minutes. It is built on an ATmega328 microcontroller (Arduino Uno), RGB color sensor, IR distance sensor, two servos, plastic frame tubes and a few custom designed 3D printed parts. The processing is structured around pseudo-realtime programming which makes the system responsive and keeps it running smoothly. Each process in the system is designed around the notion of event driven finite-state machine (FSM) execution. | ||
== Features == | == Features == | ||
[[Image:Sorting_machine_funnel.jpg|450px|right]] | [[Image:Sorting_machine_funnel.jpg|450px|right]] | ||
[[Image:Sorting_machine_wheel.jpg|450px|right]] | [[Image:Sorting_machine_wheel.jpg|450px|right]] | ||
[[Image: | [[Image:Sorting_machine_controller.jpg|450px|right]] | ||
* Supports Skittles, M&M's, Reese's pieces and similar sized candies | * Supports Skittles, M&M's, Reese's pieces and similar sized candies | ||
* Sorts based on color of the piece | * Sorts based on color of the piece using a RGB sensor | ||
* Up to six individual cup positions | * Up to six individual cup positions/colors supported | ||
* Hopper handles up to 500 gram / 17 oz bags | * Hopper handles up to 500 gram / 17 oz bags | ||
* Preemptively releases items for optimal performance | * Preemptively releases items for optimal performance | ||
* Processes up to 80 pieces per minute | * Processes up to 80 pieces per minute | ||
* Easy maintainable C code - Arduino IDE platform based | * Easy maintainable C code - Arduino IDE platform based (5min: download, open, edit, compile, upload - easy!) | ||
* Pseudo-realtime processing model with non-locking delay library | * Pseudo-realtime processing model with non-locking delay library | ||
* External terminal possible for statistics and diagnostics | * External terminal possible for statistics and diagnostics | ||
* Powered off single | * Powered off single 5V power supply | ||
== How it works == | == How it works == | ||
Line 36: | Line 36: | ||
Building the machine required the following parts - the BOM (Bill-Of-Materials). There is a few parts which were 3D printed but most should be easily available. | Building the machine required the following parts - the BOM (Bill-Of-Materials). There is a few parts which were 3D printed but most should be easily available. | ||
[[Image:Sorting_machine_feed.jpg| | [[Image:Sorting_machine_feed.jpg|290px|right]] | ||
{| class="wikitable" | {| class="wikitable" | ||
Line 54: | Line 54: | ||
| 4 || ROB-09453 || Analog Line Sensor (QRE1113) Breakout Board || 1 || 2.95 USD | | 4 || ROB-09453 || Analog Line Sensor (QRE1113) Breakout Board || 1 || 2.95 USD | ||
|- | |- | ||
| 5 || SEN-10701 || Color Light Sensor (ADJD-S311-CR999) Evaluation Board || 1 || 14.95 USD | | 5 || SEN-10701 || Color Light Sensor (ADJD-S311-CR999) Evaluation Board - discontinued unfortunately. Use [https://www.sparkfun.com/products/12829 ISL29125] or [https://www.adafruit.com/product/1334 TCS34725] instead. Note: these are not directly code compatible, but you can adapter the code using the libraries for the respective sensors (just need to get the RGB sensor values out from the library to the system variables). || 1 || 14.95 USD | ||
|- | |- | ||
| 6 || S35-STD || GWS Robotic Continuous Rotation Servo || 1 || 13.49 USD | | 6 || S35-STD || GWS Robotic Continuous Rotation Servo || 1 || 13.49 USD | ||
Line 89: | Line 89: | ||
== Download == | == Download == | ||
[[Image: | [[Image:Sorting_machine_assembly_view.png|470px|right]][[Image:Sorting_machine_assembly_view2.png|450px|right]] ''The image to the right is the base for making sure all the parts would fit and the dimensions of the supporting structure were right.'' | ||
* '''[http://beta.ivc.no/sorting_machine/sorting_machine_views.pdf Download views drawing]''' - PDF | |||
=== Schematic === | |||
At the moment there is no schematic, but the code details what pins are used for the I2C, LED and servo. Power to the servos is taken directly from the VIN/DC jack pin on the Arduino to avoid overloading the 5V LDO. Ground for all the servos and sensors is soldered to a central rail on the prototyping board. | |||
=== Code === | === Code === | ||
The C code for the project is available below. | The (Arduino) C code for the project is available below. Arduino IDE v1.0.5 was used to write and compile/upload the program to the board. All the required libraries are included and will open automatically, no need to install any libraries. | ||
* Download | The archive includes both the main code and a calibration routine code used to learn a new set of colors. Open the '''"sorting_machine_*.ino"''' file to let the Arduino application load the rest of the required files. | ||
* '''[http://beta.ivc.no/sorting_machine/sorting_machine_code_2013-12-20.zip Download code archive]''' - GitHub repo (coming soon) | |||
=== Models === | === Models === | ||
The package below contains all the 3D | The package below contains all the 3D models used in the project. The files are STL and ready to be imported into most 3D printing software. | ||
Includes .PRT files for Autodesk Inventor, .STP/STEP files for general viewing and .STL files for 3D printing. All the parts and assembly drawings are included. Total of '''8 parts''' where 3 are for the machine it self and 5 for the support structure. | |||
* '''[http://beta.ivc.no/sorting_machine/sorting_machine_models_2013-12-20.zip Download models archive]''' - GitHub repo (coming soon) | |||
<!-- If you want the parts, I can print the kit for you for 60USD. But please check that you can use all the parts for your particular setup. Small alterations of the parts can be made if dimensions and sketches are provided. --> | |||
[[-]] | |||
== Future improvements == | |||
* Change to a faster 360 degree rotation servo would greatly improve the performance of the system | |||
* Larger wheel which could hold more pieces could be used to implement a queuing system and improve unloading speed | |||
* A 720 or 1080 degree rotation servo could be used to calculate the shortest distance to the next cup | |||
* Add a vibration motor could be installed to avoid possible clogging in the funnel and hopper | |||
* Mount a LCD display which could show the current color distribution and other vital system information | |||
== Demonstration == | |||
== | View this presentation of how it is built and how it operates when sorting Skittles pieces. Check the comments on the [http://www.youtube.com/watch?v=H7HTQai7Wwg&hd=1&vq=hd720 Sorting Machine - Skittles and M&M's] YouTube page. | ||
<html><div style="width:100%;text-align:center"><object width="768" height="462"><param name="movie" value="http://www.youtube-nocookie.com/v/H7HTQai7Wwg?fs=1&hl=en_US&rel=0&vq=hd720"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube-nocookie.com/v/H7HTQai7Wwg?fs=1&hl=en_US&rel=0&vq=hd720" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="768" height="462"></embed></object></div></html> | |||
== References == | == References == | ||
* [http://www.mechatronic.me/automation/37-automatic-sorting-of-skittles-or-mms-by-colour Automatic Sorting of Skittles or M&Ms by Colour] | * [http://www.mechatronic.me/automation/37-automatic-sorting-of-skittles-or-mms-by-colour Automatic Sorting of Skittles or M&Ms by Colour] - inspiration for my machine came from this project | ||
* [http://www.youtube.com/watch?v=4Zzg86W2Fbw M&M sorter] | * [http://www.youtube.com/watch?v=4Zzg86W2Fbw M&M sorter] | ||
* [http://www.geek.com/news/lego-mm-sorting-machine-1531882/ Lego Mindstorms NXT - The M&M Dispencer] | * [http://www.geek.com/news/lego-mm-sorting-machine-1531882/ Lego Mindstorms NXT - The M&M Dispencer] | ||
* [http://www.youtube.com/watch?v=mjo8n9HvenE Lego Mindstorms M&M Sorting Machine] | * [http://www.youtube.com/watch?v=mjo8n9HvenE Lego Mindstorms M&M Sorting Machine] |
Latest revision as of 16:34, 10 February 2017
This machine sorts candy by color. It separates different colored Skittles and M&Ms pieces and puts them into individual cups. The machine is fully automated and will sort an entire 1.5kg/56oz bag in approx. 5 minutes. It is built on an ATmega328 microcontroller (Arduino Uno), RGB color sensor, IR distance sensor, two servos, plastic frame tubes and a few custom designed 3D printed parts. The processing is structured around pseudo-realtime programming which makes the system responsive and keeps it running smoothly. Each process in the system is designed around the notion of event driven finite-state machine (FSM) execution.
Features
- Supports Skittles, M&M's, Reese's pieces and similar sized candies
- Sorts based on color of the piece using a RGB sensor
- Up to six individual cup positions/colors supported
- Hopper handles up to 500 gram / 17 oz bags
- Preemptively releases items for optimal performance
- Processes up to 80 pieces per minute
- Easy maintainable C code - Arduino IDE platform based (5min: download, open, edit, compile, upload - easy!)
- Pseudo-realtime processing model with non-locking delay library
- External terminal possible for statistics and diagnostics
- Powered off single 5V power supply
How it works
Central in the system is an Atmel ATmega328 AVR microcontroller - integrated nicely on an Arduino Uno platform. All the sensors and servo actuators connect to this board. An external 9V power supply keeps the system running. 5V and 3V3 power for the servos and board is supplied by the 5V power supply. The programming mimics a real time system where each of the four processes are state driven, which means only a short instruction performed before the system jumps to the next process.
Loading pieces
The machine uses two GWS servos for loading and sorting the pieces. A continuous rotation servo with a variable rotation speed loads pieces into predefined slots in the feed wheel. Each slot is just wide and deep enough to hold a single piece and if there is a piece stuck between the loading tube and the slot, the system will detect this (the delay in the detection of the expected slot) and reverse the rotation of the feed wheel to free the piece. In addition, to prevent pieces from clogging the top funnel and loading tube, a steel rod connected to the feed wheel will stir the pieces. There is a total of 4 slots.
Analyzing color
After the pieces have been put into individual slots, a white LED illuminates the piece and an ADJD-S311-CR999 CMOS IC with integrated RGB filters captures 3 color profiles at different angles. For the piece to be successfully identified and pass control, at least 2 of profiles have be within 3 standard deviation (three-sigma rule) of the pre-calibrated data set for Skittles or M&Ms. A RGB LED next to the feed wheel will illuminate to give a visual indication of the detected color. The feed wheel rotation is governed by a QRE1113 IR distance sensor which detects the slot depth change. This transition is used to change process state and start the color analysis at the right moment.
Sorting
When the color has been identified, the piece is dropped from the feed wheel and onto a 360-degree servo with a feeding tube attachment which guides the piece into the right cup. The piece is release from the feeding wheel just before the feeding tube is within range of the cup. This means that the piece is on its way down the tube and just as it exists the end, the servo has has had time in the meantime to get into position. This leads to increased performance as the system does not need to hang around and can move to the next cup straight away. This is purely done by timing the expected rotational velocity and no feedback is provided by the servo. The servos are the bottlenecks of the system and predominately dictates performance.
After all the pieces have been sorted and the sensor does not register any consistent data, the machine is shut down and waits for the next round.
Parts and cost
Building the machine required the following parts - the BOM (Bill-Of-Materials). There is a few parts which were 3D printed but most should be easily available.
No. | Part number | Description | Quantity | Cost |
---|---|---|---|---|
1 | ARD-UNOR3 | Arduino Uno R3 | 1 | 29.95USD |
2 | RE210-S1 | Prototyping 2.54mm Pitch Board | 1 | 2.95 USD |
3 | ADA-276 | Switching 5VDC 1A power adapter | 1 | 5.00 USD |
4 | ROB-09453 | Analog Line Sensor (QRE1113) Breakout Board | 1 | 2.95 USD |
5 | SEN-10701 | Color Light Sensor (ADJD-S311-CR999) Evaluation Board - discontinued unfortunately. Use ISL29125 or TCS34725 instead. Note: these are not directly code compatible, but you can adapter the code using the libraries for the respective sensors (just need to get the RGB sensor values out from the library to the system variables). | 1 | 14.95 USD |
6 | S35-STD | GWS Robotic Continuous Rotation Servo | 1 | 13.49 USD |
7 | S125-1T-2BB | GWS Sail Winch 360-degree Rotation Servo | 1 | 19.95 USD |
8 | PRT-10373 | Jumper Wire 3-pin 12-inch | 1 | 1.95 USD |
9 | PRT-10375 | Jumper Wire 5-pin 12-inch | 1 | 1.95 USD |
10 | ROD-1MM | Steel Rod 15x1mm | 1 | 0.50 USD |
11 | PRT-FEEDER | 3D Printed Hopper/feed wheel | 1 | 8.00 USD |
12 | PRT-SEEDER | 3D Printed Carousel/item seeder | 1 | 8.00 USD |
13 | FUNNEL | Funnel 140mm | 1 | 3.00 USD |
14 | IC-TUBE | IC/compoment plastic tube 23x20x500mm | 10 | free/0.50 USD |
15 | DIN85M3x5 | M3 x 5mm Slot Pan Head Screw DIN 85 | 20 | 0.08 USD |
16 | DIN85M3x50 | M3 x 50mm Slot Pan Head Screw DIN 85 | 20 | 0.16 USD |
17 | DIN85M3x30 | M3 x 30mm Slot Pan Head Screw DIN 85 | 40 | 0.14 USD |
18 | DIN125M3 | M3 Washer Form A DIN 125 | 100 | 0.014 USD |
19 | DIN439M3 | M3 Thin Nut DIN 439 | 100 | 0.048 USD |
Total | 127.04 USD |
Download
The image to the right is the base for making sure all the parts would fit and the dimensions of the supporting structure were right.
- Download views drawing - PDF
Schematic
At the moment there is no schematic, but the code details what pins are used for the I2C, LED and servo. Power to the servos is taken directly from the VIN/DC jack pin on the Arduino to avoid overloading the 5V LDO. Ground for all the servos and sensors is soldered to a central rail on the prototyping board.
Code
The (Arduino) C code for the project is available below. Arduino IDE v1.0.5 was used to write and compile/upload the program to the board. All the required libraries are included and will open automatically, no need to install any libraries.
The archive includes both the main code and a calibration routine code used to learn a new set of colors. Open the "sorting_machine_*.ino" file to let the Arduino application load the rest of the required files.
- Download code archive - GitHub repo (coming soon)
Models
The package below contains all the 3D models used in the project. The files are STL and ready to be imported into most 3D printing software.
Includes .PRT files for Autodesk Inventor, .STP/STEP files for general viewing and .STL files for 3D printing. All the parts and assembly drawings are included. Total of 8 parts where 3 are for the machine it self and 5 for the support structure.
- Download models archive - GitHub repo (coming soon)
Future improvements
- Change to a faster 360 degree rotation servo would greatly improve the performance of the system
- Larger wheel which could hold more pieces could be used to implement a queuing system and improve unloading speed
- A 720 or 1080 degree rotation servo could be used to calculate the shortest distance to the next cup
- Add a vibration motor could be installed to avoid possible clogging in the funnel and hopper
- Mount a LCD display which could show the current color distribution and other vital system information
Demonstration
View this presentation of how it is built and how it operates when sorting Skittles pieces. Check the comments on the Sorting Machine - Skittles and M&M's YouTube page.
References
- Automatic Sorting of Skittles or M&Ms by Colour - inspiration for my machine came from this project
- M&M sorter
- Lego Mindstorms NXT - The M&M Dispencer
- Lego Mindstorms M&M Sorting Machine