With just two servos, the ColorPal sensor, and a whole lot of hot glue, you can build your own Candy Sorter. A sturdy cardboard base structure holds the ColorPal Color Sensor above an angled top chute. As you feed individual candies into the sorter, the top servo traps the candy with the ColorPal sensor and it takes a reading. Then the servo lifts it up and the candy slides down to the bottom chute. The bottom servo turns this chute to the correct cup for that color of candy.
*Items are in the BlocklyProp Starter Kit. ** The BlocklyProp Starter Kit has just one servo, get another servo here.
CAUTION! Don’t try to run this project off of your computer’s USB power alone – use the battery pack too. The servos can take quite a bit of current when they move, and may exceed the amount of current that your USB port can supply.
This example program was, through trial and error, tuned to a bag of Skittles and the cardboard structure shown in this tutorial. You will need to further tune the example code for the individual geometry of your custom candy sorter structure, and the type of candy you are sorting.
Although candy sorting is simply a fun thing to do, material sorting has real-world applications, and can even be used to help protect the environment. People are more likely to recycle their trash if it’s easy for them to do. If the garbage facility is able to sort the trash is recieves, it can reduce the amount of trash that ends up in a landfill, and reduce the need to mine for raw materials. Can think of ways to use machines, sensors, and microcontrollers to sort materials?