GroceryBot

GroceryBot is the final project I created in a class called Educational Robotics (ME193) at Tufts University.
Along with another engineering student and 4 child studies students, we made GroceryBot.
I was in charge of electronics and programming.



GroceryBot helps children of 5-9 years old learn about how to build training dataset in machine learning.

Children can place a fruit (a banana, an apple, or an orange) on the “scale” which has a color sensor incorporated.
By pressing the button of the fruit, GroceryBot obtains the color information of the fruit.

Training

By pressing the “?” button, GroceryBot tells chidren what she thinks the fruit is.
The LED matrix blinks yellow if banana, red if apple, and orange if orange.

Testing




I used LEGO SPIKE Prime hub as the controller, 1 LEGO SPIKE Prime color sensor, 4 LEGO SPIKE Prime force sensors as 4 buttons, and 1 LEGO SPIKE Essential LED Matrix.




I used Python to program GroceryBot. I used k-nearest neighbors (kNN) as the machine learning algorithm.

Everytime when the fruit button is being pressed, the controller stores the read of the color sensor and the category of the fruit.
When the “?” button is pressed, the program compares the read of color sensor with its closest k number (now set to 5) of data points.
The category that has most number of data points among the k data points is determined to be the category of the testing fruit.

You can go back and forth between training and testing without needing to switch modes.

The program is here: GroceryBot program




During testing, we noticed that children learned about how the training dataset affects the testing result.

When the testing result of an apple was inaccurate, children noticed that they were only training GroceryBot with the red side of the apple while during testing, the green side was facing the color sensor. Without instructions, they trained GroceryBot with as many sides of the apple as possible. They were very excited when the testing result became accurate after adding more training data.

I have witnessed many times that when using other machine learning tools (e.g. image recognition), children get frustrated that they don’t understand why they get inaccurate results. It is unclear to them how just a change in the background when taking a picture of an object can lead to different results.
As a solution to the issue, GroceryBot helps children to intuitively understand how to debug a training dataset when the result is inaccurate.




Learning how kNN works was very interesting. I was especially intrigued by how simple and intuitive the model can be for machine learning, because machine learning used to be a myth for me.

I am going to give myself a big pat on the shoulders because it was my first time programming a complete project in Python! I learned how to make good use of REPL, how to control SPIKE Prime hub, and explored breaking down kNN algorithm to smaller steps so that I could seek for help both online and to friends.

Now that I have gained the confidence, I am really looking forward to making more projects using Python :)).




  • GroceryBot program file