Touchless hand sanitiser dispenser
Hold your hand under it and a metal-gear servo presses the pump for you.
Shop by category
Shop all componentsLimit switches are fiddly on a window. A simpler way is to watch the motor current: when the window reaches the end, the motor stalls and its current rises sharply. The DRV8874 driver carrier has a current-sense output (CS) that gives a voltage proportional to the motor current, so the Nano can stop the motor the moment it stalls. A DHT22 decides when to open.
Keep fingers clear of the window while testing; a geared motor is strong.
Tick anything you already have and the total updates.
DRV8874 single motor driver carrier
Follow the colours: red is power, dark grey is ground, blue is a signal.
12 V adapter for the motor; the Nano from VIN.
window_opener.inoVerify & upload in Electrolark#include <DHT.h>
DHT dht(4, DHT22);
const int EN = 9, PH = 8;
const int STALL = 300; // set from your own readings
const float OPEN_AT = 30, CLOSE_AT = 26;
int state = 0; // 0 closed, 1 open
void runUntilStall(bool open) {
digitalWrite(PH, open ? HIGH : LOW);
analogWrite(EN, 200);
delay(300); // ignore the start-up surge
unsigned long t0 = millis();
while (millis() - t0 < 20000) { // safety time limit
int cs = analogRead(A0);
Serial.println(cs);
if (cs > STALL) break;
delay(10);
}
analogWrite(EN, 0);
}
void setup() { pinMode(PH, OUTPUT); Serial.begin(9600); dht.begin(); }
void loop() {
float t = dht.readTemperature();
if (!isnan(t)) {
if (state == 0 && t > OPEN_AT) { runUntilStall(true); state = 1; }
if (state == 1 && t < CLOSE_AT) { runUntilStall(false); state = 0; }
}
delay(5000);
}
The start-up surge looks like a stall; lengthen the 300 ms ignore time or raise STALL.
STALL is above the real stall reading; lower it. The 20 s limit still protects the motor.
OPEN_AT and CLOSE_AT are too close; leave a few degrees between them.
You can; stall sensing just needs fewer wires near a wet window.
Briefly, no; the driver also has its own current limit and the sketch stops quickly.
Add a rain sensor that forces the window closed.
7 parts: Pololu Single Brushed DC Motor Driver Carrier (DRV8874 / DRV8876), 200RPM 12V Low Noise Dc Motor With Metal Gears - Grade A, DHT22 AM2302 Digital Temperature & Humidity Sensor, Generic Nano CH340 Development Board (Soldered), DC Power Adapter (5.5x2.1mm), Solderless Breadboard and Dupont Jumper Wires (40 pcs). On this page you can tick the parts you already have and add only the rest to your cart.
It is a advanced project and takes about 3-4 hours. The build on this page has 7 steps.
No. This page has the complete, tested code (window_opener.ino).
About ₹1,616 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
H-bridge direction control; Current sensing and stall detection; Temperature control with hysteresis.
Keep fingers clear of the window while testing; a geared motor is strong.
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.