toothpaste dispenser

The dispenser was built using lego, 3d printed parts and laser cut acrylic

projcet description

A quick overview of the system. See the full video at the bottom of the page!

My fourth project in my robotics class was an automatic toothpaste dispenser with image recognition. Our objectives for the project were to:

  1. Load a toothbrush automatically

  2. Use a sensor to check if the brush was loaded

  3. Dispense a known amount of toothpaste onto the brush

  4. Update a digital twin in OnShape with the current state of the dispenser

  5. Detect the toothpaste with a camera, and take a photo of the brush

  6. Unload the toothbrush

I accomplished all of these objectives with my build. I used OpenCV to continuously take images of the toothbrush loading location, brightening the images and using a color mask to look for the toothbrush.

An overview of the image processing portion of of the assignment. OpenCV is a very powerful tool!

If the toothbrush was detected, a user could press a button to dispense toothpaste onto the brush using the slider mechanism mounted on the toothpaste tube. A motor and a rack and pinion would pull on the slider from both sides, squeezing the tube and dispensing paste onto the brush. An OnShape assembly of the system would then be updated by the OnShape REST API, relocating the slider in the digital model to its real-life location.

After each extrusion, the camera would take another photo and saturate the image, looking for blue pixels that could indicate toothpaste. When the camera detected toothpaste, the system would reset and return the brush to the user.

Through this project, I learned a lot about image recognition, digital twins and mechanical extrusion of paste. I found that the largest challenge of the project was just getting the paste to dispense accurately onto the brush.

Check out the code on GitHub, and be sure to watch the full system in action at the bottom of the page!

OnShape REST API controlling and updating my digital twin

Early prototype of extrusion mechanism