AI candy sorting machine
Automatic sorting of six different colored candies using a machine learning algorithm is an excellent educational challenge for students. DNABOY candy sorter offers a complete solution for this challenge, with a sorting robot and a cloud server to train the machine learning algorithm. In addition, a block coding editor is available for students to use to run the machine and collect the required dataset. By using DNABOY candy sorter, students can develop an understanding of how machine learning algorithms work and how they can be used in real-life applications. They can learn how to train the algorithm to recognize different colored candies and sort them according to their color. This project can also help students develop their coding and problem-solving skills. Moreover, the DNABOY candy sorter can be used for various other sorting purposes, such as sorting different types of fruits, vegetables, or even recyclables. This opens up new possibilities for students to learn and explore the world of machine learning and its applications.
Candy sporter application note. Make smart candy sorting using color sensor
Six different colored candies can be an incredibly useful teaching tool for machine learning. By using a color sensor and servo motor, students can create an automatic candy sorter. The color sensor generates digitized Red, Green, and Blue (RGB) values that can be interpreted by the machine learning algorithm to classify the candy according to its color. This project offers an excellent educational challenge for students, providing them with the opportunity to develop an understanding of how machine learning algorithms work and how they can be used in real-life applications. By training the algorithm to recognize different colored candies and sort them accordingly, students can learn about the practical applications of machine learning. Moreover, students can also develop their coding and problem-solving skills by using a block coding editor to run the machine and collect the required dataset. The DNABOY candy sorter offers a complete solution for this project, including a sorting robot and a cloud server to train the machine learning algorithm. This project can also help students develop their creativity and innovation skills by providing new possibilities for sorting other items such as fruits, vegetables, and recyclables.
Session 1: Machine preparation
Step1. Assembly candy sortder device
The DNABOY candy sorter is a machine composed of five units that work together to sort six different colored candies automatically. The first unit is the candy motor, which grabs and moves the candy. The second unit is the WiFi computer module, which has the machine learning algorithm. The third unit is the slide motor, which sorts the candy by the command of Arduino computer. The fourth unit is the six collector bins, which hold each candy. Lastly, the battery and charger module provides 5V power to the machine. The candy sorter kit comes with these five separate modules that students need to assemble.
Step2. Connect to cloud candy sorter server
Once assembled and the power switch is on, the DNABOY candy sorter seeks a WiFi channel with the SSID name DNABOY001 and the password 'qqqq1111'. The teacher needs to provide an internet-connected WiFi over the classroom to ensure that the machine can connect to the internet. When the computer module is connected to the internet, it logs onto DNABOY cloud server. Students need to log onto the server by opening a web browser and connect to the URL [http://candysortrobot.web.app](http://candysortrobot.web.app/). From there, they can access the block coding editor to run the machine and collect the required dataset for training the machine learning algorithm.
Session 2: Play with candy sorter
Step1. Move candy motor
The candy sort robot has two motors and a color sensor. The first one is called candy motor. It turns swivel arm to move candy. Let’s send this code to the candy motor.
Thic block code turn candy motor to color sensor
Thic block code turn candy motor to slide. Candy is drop down all the way to the collector bin
Slide motor turns the slide to corresponding collector bin. You need to declare a variable that contain the number of collector bin. Place the variable block to the variable field of slide block
You need to declare a variable that contain the number of collector bin. Place the variable block to the variable field of slide block
Step2. Read color of candy
You can read RGB value of candy using this block code.
Combine two blocks
Change variable name to 'color'
Variable name is changed to 'color'
Change variable name to 'color'
Variable name is changed to 'color'
Step3. Run the code by sending block code to candy sorter machine
You can convert 'read sensor' command to javascript code by clicking 'Show Code' button.
Run the code by clicking 'Upload' button. The candy sorter read color and send R,G,B value to cloud server.
Step4. Check R,G,B values that candy sorter measured
RGB data is shown in texbox and the color is diplayed on the circle.
Session 3. Make data set with RGB data and candy class
Step1. Read color of red candy 10 times
To make candy dataset, we need to measure color at least 10 times. Following block code grab a candy and read color. The RGB valus are displayed on textbox. Students need to press 10 times to gather 10 RGB data for the red candy
Step2. Read color of remaing candies 10 times for each
If you read color 60 times (10 reading for 6 different candies), you can have complete candy color dataset
Step3. Add class of candy at the end of each line
Assign each andy unique class number. For example, red=0, orange=1, yellow=2, green=3, blue=4, brown=5. This number will be used as an indicator for each candy when training the machine learning algorithm.
Step4. Read color of remaing candies 10 times for each
If you read color 60 times (10 reading for 6 different candies), you can have complete candy color dataset
Session 4: Train machine learning algorithm
Step1. Upload the dataset
Go to candy sorter cloud server http://dnaboy.duckdns.org:9995 You can upload the candy dataset file (.csv format).
Step2. Split the dataset to train and test
The dataset need to be splitted randomly to train and test. By clicking split menu,the server does this job automatically.
Step3. Check the quality of dataset
Good data has small variance and no outlier. The variance plot visualize the quality of data.
Step4. 3D plot shows how RGB data is scattered in 3D space
One way to visualize the R,G,B values is to display them in 3D space.
Step5. PCA plot show if you can classify the candy or not
3D RGN dataset can be displayed on 2D chart by means of principal component analysis. You can have intuitive information how RGB data of each candy are separated.
Step6. Train Random Forest Classifier
Check if RFC is well trained.
Step7. Train Support Vector Classifier
Check if SVC is well trained.
Step8. Train Multi Layer Perceptron
Check if MLP is well trained.
Step8. visualization of decision tree
Relatiopnship between candy class and RGB value are complex but machine learning algorithm find the relation while training process. Visualization of decisiontree shows this finding intuitively.
Though I am teaching machine learning in college, it is my first time to make embedded AI machine like AI pH reader device. Labboy has built-in AI camera that can be trained using AI training server. It was a good fun and very informative. Many thanks to Labboy team
College professor
Pohang, Korea
Project information
- Category Machine learning, Color and Spectrophotometry
- Client SAGA Global Academy
- Project date 01 June, 2023
Feedback
Leave your feedback about 'Learning AI with candy sorter'
Address
450-5 Taejongro
Gyeongju, Korea, 38057
Call Us
+82 70 7014 9034
Email Us
Open Hours
Monday - Friday
9:00AM - 05:00PM