Hey everyone, I wanted to share my recent project of building an automatic hand sanitizer using ESPHome, NodeMCU, an ultrasonic sensor, and a motor-driven sprayer. It’s been a fun and practical addition to my smart home setup, especially with everything going on in the world.
I started by gathering all the components: the NodeMCU, ultrasonic sensor, motor, and the necessary wiring. The initial setup was a breeze with ESPHome, and I managed to get everything connected and powered up. The sensor detects hand movements, and the motor activates the sprayer, dispensing a small amount of sanitizer. It’s super convenient and hygienic!
However, I ran into a couple of hiccups along the way. Sometimes, after restarting the device or turning it off and on, the sprayer would activate on its own and wouldn’t stop. That was a bit frustrating, but I think I figured it out. I adjusted the sensor’s sensitivity and added some delays in the code to prevent false triggers. It’s working much better now!
Another issue I faced was with the ultrasonic sensor occasionally giving reverse readings. After some troubleshooting, I realized it was a calibration issue. I tweaked the sensor’s placement and adjusted the threshold values in the code, and that solved the problem.
I’d love to hear from anyone who has tried something similar or has tips to improve my setup. Maybe adding a motion sensor or a timer to control the dispensing frequency could be next on my list. For now, I’m really happy with how it turned out and how it’s helping keep my family safe.
If anyone has questions or suggestions, feel free to reach out! Happy tinkering everyone! ![]()