BrickPi Candy Sorter

3. A Quick Overview

First, we’ll make a Python list of the candy we like and a list of the candy we don’t like. After we fire up the Python program, you’re going to dump your unsorted candy into the machine. The individual candy bars will be sorted onto a conveyor belt. The conveyor belt dumps the piece of candy into the imaging basket.

 

 

Once your candy is dumped into the imaging basket, the Ultrasonic Sensor is tripped and the BrickPi turns off the conveyor belt. In the imaging basket, the Raspberry Pi camera will take a picture of the candy bar and upload it to the Google Cloud Vision, asking for a brand label.

Google Cloud Vision will search the image and return its best guess for what the brand is of the object (candy) in the picture.



Finally we’ll compare the value returned by Google Cloud Vision to a list of candy we want to keep, and a list we want to give to our brother. The candy sorter will dump in one direction if it’s a keeper, and another if it’s a reject! As a final touch, the speaker will yell out loud whether it was Good Candy or Bad Candy, and what brand candy it found.