If you’re looking for a useful Raspberry Pi project to work on this summer, why not make something you can use every day? The world of DIY home automation is very accessible thanks to projects such as this automatic soap dispenser project, created by a developer known as Mellow Fire.
With the help of a Raspberry Pi Pico, this automatic soap dispenser uses a distance sensor to determine when it’s time to initiate the detergent pump. According to Mellow Fire, a Pico may be overpowered for the project but like most Pi projects, we work with what we have and Raspberry Pis are often the board within reach.
The best Raspberry Pi projects are ones you can make yourself and, thankfully, it doesn’t take too much to pull this project off. If you want to recreate it, you’ll need a motor driver module (Mellow Fire is using a DC Dual H-Bridge HW-095, which is commonly referred to as an L298N), an HC-SR04 ultrasonic distance sensor (the 3V compliant versions necessary for the Pico are commonly HC-SR04-P and HC-SR04 +) and a 12V DC peristaltic pump to move the soap through the tubing.
The code is a basic Python script that checks the distance sensor in a loop. When a hand or sponge is detected, it initiates the motor for the soap pump. The top of the dispenser was designed and 3D printed by Mellow Fire to fit a specific, spare glass container so the files for the top are not available.
You can find the code used in this project on GitHub which should serve as an excellent starting point for anyone interested in creating their own Pico-powered soap pump. This project could also be adapted for other liquids like hand soap or hand sanitizer. Be sure to follow Mellow Fire for more projects and updates on this one.