Touchless hand sanitiser dispenser
Hold your hand under it and a metal-gear servo presses the pump for you.
Shop by category
Shop all componentsA quarter-turn ball valve only needs 90 degrees of movement, which is exactly what a servo does. Small valves can be stiff, so this uses the DS3218, a metal-gear servo with about 20 kg-cm of torque. It draws large current peaks, so it gets its own 6 V supply from an MP1584 buck converter instead of the ESP32's pin. The ESP32 opens the valve for a set time at a set hour, and a web page gives an open and close button.
Keep a manual way to close the water in case the servo fails.
Tick anything you already have and the total updates.
Follow the colours: red is power, dark grey is ground, blue is a signal.
12 V adapter into the buck for the servo; the ESP32 on USB or its own 5 V.
valve_turner.inoVerify & upload in Electrolark#include <WiFi.h>
#include <WebServer.h>
#include <ESP32Servo.h>
#include <time.h>
Servo valve;
WebServer web(80);
const int OPEN_DEG = 90, CLOSED_DEG = 0;
const int HOUR = 6, MINUTES_OPEN = 15;
bool isOpen = false;
void setValve(bool open) { valve.write(open ? OPEN_DEG : CLOSED_DEG); isOpen = open; }
void page() {
if (web.hasArg("v")) setValve(web.arg("v") == "1");
web.send(200, "text/html", String("<h2>Valve is ") + (isOpen ? "OPEN" : "closed") +
"</h2><a href='/?v=1'>Open</a> | <a href='/?v=0'>Close</a>");
}
void setup() {
Serial.begin(115200);
valve.attach(18, 500, 2500);
setValve(false);
WiFi.begin("YOUR_WIFI", "YOUR_PASSWORD");
while (WiFi.status() != WL_CONNECTED) delay(300);
Serial.println(WiFi.localIP());
configTime(19800, 0, "pool.ntp.org"); // India time
web.on("/", page); web.begin();
}
void loop() {
web.handleClient();
struct tm t;
if (!getLocalTime(&t)) return;
bool shouldOpen = t.tm_hour == HOUR && t.tm_min < MINUTES_OPEN;
static bool lastAuto = false;
if (shouldOpen != lastAuto) { setValve(shouldOpen); lastAuto = shouldOpen; }
}
The valve is too stiff; work it by hand a few times or use a smaller valve.
The servo is on the ESP32's power; it must have its own supply with a shared ground.
Check Wi-Fi; the time comes from the internet at start-up.
Half-inch and three-quarter-inch garden ball valves usually turn easily enough.
No, keep it under a cover away from spray.
The DS3218 gives more torque at 6 V and is rated up to 6.8 V.
6 parts: DS3218 20 kg-cm Digital Metal Gear Servo, 180 Degree, Mini Buck Converter (MP1584 / Mini360), ESP32-WROOM-32 38-Pin Development Board, DC Power Adapter (5.5x2.1mm), Solderless Breadboard and Dupont Jumper Wires (40 pcs). Tools: Digital Multimeter. On this page you can tick the parts you already have and add only the rest to your cart.
It is a intermediate project and takes about 3 hours. The build on this page has 6 steps.
No. This page has the complete, tested code (valve_turner.ino).
About ₹2,387 for the parts at the prices on this page, plus tools if you do not have them. Quantity price breaks lower the cost when you build several.
Sizing a servo for a stiff load; Powering servos separately from the board; Time-based control over Wi-Fi.
Keep a manual way to close the water in case the servo fails.
Hold your hand under it and a metal-gear servo presses the pump for you.
Wave your hand and the lid lifts by itself, then closes after three seconds.
Your first motion project: turn the knob and the servo follows.
Dial in an exact servo angle, 2° per click, shown on screen.
Lessons are free to read. Maker (₹499/month) and Pro add quizzes, worked problems and certificates, paid with your Geekobot account. See plans
Learning project. Check every circuit and the datasheet of each part before you power it up.