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 direct-acting solenoid valve opens a water line when its coil is powered and closes when power is removed, even with no water pressure, so it works from a raised tank with gravity alone. An ESP32 reads a capacitive soil moisture sensor and, when the soil is dry, switches the 12 V valve on through a MOSFET module for a few seconds. A diode across the coil protects the MOSFET.
Keep the 12 V wiring and the MOSFET module dry, away from the water lines.
Tick anything you already have and the total updates.
12 V 1/4 inch direct-acting solenoid valve, normally closed
Capacitive soil moisture sensor
MOSFET switch module for the valve
Follow the colours: red is power, dark grey is ground, blue is a signal.
Needs a 12 V DC supply of at least 2 A for the valve. The ESP32 runs from USB or a 5 V supply.
drip_valve.inoVerify & upload in Electrolarkconst int VALVE = 26, SOIL = 34;
const int DRY = 2600; // reading in dry soil; set from your calibration
const unsigned long OPEN_MS = 5000; // valve open time
const unsigned long MIN_GAP_MS = 30UL * 60 * 1000; // wait at least 30 min between waterings
unsigned long lastWater = 0;
void setup() {
pinMode(VALVE, OUTPUT);
digitalWrite(VALVE, LOW);
Serial.begin(115200);
lastWater = millis() - MIN_GAP_MS;
}
void loop() {
int v = analogRead(SOIL); // a capacitive sensor reads higher when dry
Serial.println(v);
if (v > DRY && millis() - lastWater >= MIN_GAP_MS) {
digitalWrite(VALVE, HIGH); delay(OPEN_MS); digitalWrite(VALVE, LOW);
lastWater = millis();
}
delay(5000);
}
Check the 12 V supply and the MOSFET module output with a multimeter while the pin is high.
The DRY value is set wrong. Print the reading and set DRY between the wet and dry numbers you measured.
Dirt may be holding the seat open. Flush the line, and fit a small inline filter.
A direct-acting valve like this opens at zero pressure, so a raised tank works. Larger pilot-type valves need a minimum pressure.
Yes, with a 24 V supply and a MOSFET module rated for it. The sketch does not change.
Check the valve's materials. This build is for garden water.
8 parts: ESP32-WROOM-32 38-Pin Development Board, DC 12V Solenoid Valve 1/4'' 2-Way Normally Closed Direct-Acting for Water, Air, Gas, Capacitive Soil Moisture Sensor – 3.3V/5V Analog Output, PH2.54-3P Interface, MOSFET Switch Module, Relay Replacement (D4184 / LR7843), 1N4007 Rectifier Diode (Pack of 10), 12V 2A (24W) Wall Power Adapter - BIS Certified, Silicone Pump Tube (1 m) 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 2 hours. The build on this page has 5 steps.
No. This page has the complete, tested code (drip_valve.ino).
About ₹1,829 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.
How a normally closed direct-acting solenoid valve works; Switching a 12 V coil from a 3.3 V pin with a MOSFET; Why a flyback diode is needed; Limiting how often the valve can open.
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.