IoTBeginnerPRJ-151

IoT Smart Handwash Timer Using ESP8266

Starts a 20-second timer when you put your hands under the tap, then beeps.

Built and tested by Drisya K S · Industrial Robotics Institute

ESP8266 NodeMCU

Arduino IDE

LevelBeginner
Build time1–2 hours
BoardESP8266 NodeMCU
Parts8 components

What is the IoT Smart Handwash Timer?

A handwash timer that makes sure everyone washes for the recommended 20 seconds. An IR sensor near the tap detects hands; the ESP8266 lights an LED for 20 seconds while you wash, then sounds the buzzer to say you are done.

How it works

  1. The IR sensor detects hands under the tap (output LOW).
  2. The LED turns on and a 20-second timer starts.
  3. After 20 seconds the LED turns off and the buzzer sounds for 2 seconds.
  4. "Handwash Completed" is printed to the Serial Monitor.

Parts list

ComponentQty
ESP8266 NodeMCU1
IR Sensor Module1
Buzzer1
LED1
Resistor 220Ω1
Jumper WiresAs needed
Breadboard1
Power Supply1

Software

  • Arduino IDE

Wiring and connections

FromConnect to
IR sensor VCC3.3V
IR sensor GNDGND
IR sensor OUTD1
Buzzer +D2
Buzzer −GND
LED + (via 220Ω)D3
LED −GND

How to build the IoT Smart Handwash Timer

  1. Connect the IR sensor to D1, the buzzer to D2 and the LED to D3.
  2. Upload the code from the Arduino IDE.
  3. Mount the IR sensor near the tap facing where hands go, in a splash-proof case.
  4. Adjust the IR sensor’s range screw so it only detects hands.
  5. Test: place your hands under the tap and wait for the beep.

IoT Smart Handwash Timer code

Complete, tested Arduino C++ code for this project. Copy it into Arduino IDE and upload it to the ESP8266 NodeMCU.

int sensorPin = D1;
int buzzer = D2;
int led = D3;

void setup() {
  pinMode(sensorPin, INPUT);
  pinMode(buzzer, OUTPUT);
  pinMode(led, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  if (digitalRead(sensorPin) == LOW) {   // hand detected
    Serial.println("Hand Detected - Start Washing");

    digitalWrite(led, HIGH);
    delay(20000);                        // 20-second timer
    digitalWrite(led, LOW);

    digitalWrite(buzzer, HIGH);          // done
    delay(2000);
    digitalWrite(buzzer, LOW);

    Serial.println("Handwash Completed");
  }
}

Real-world uses

  • Schools and hostels
  • Hospitals and clinics
  • Restaurants and kitchens
  • Hygiene awareness

Frequently asked questions

What is a IoT Smart Handwash Timer?

A handwash timer that makes sure everyone washes for the recommended 20 seconds. An IR sensor near the tap detects hands; the ESP8266 lights an LED for 20 seconds while you wash, then sounds the buzzer to say you are done.

What components are needed for the IoT Smart Handwash Timer?

You need: ESP8266 NodeMCU (1), IR Sensor Module (1), Buzzer (1), LED (1), Resistor 220Ω (1), Jumper Wires, Breadboard (1), Power Supply (1). Software: Arduino IDE.

Is the IoT Smart Handwash Timer project good for beginners?

Yes. It is rated beginner and takes about 1–2 hours to build, using the ESP8266 NodeMCU. The guide on this page explains every connection and step.

Where can I get the code for the IoT Smart Handwash Timer?

The complete, tested Arduino C++ code is free on this page. Copy it into Arduino IDE and upload it to the board.

Can I buy a kit for the IoT Smart Handwash Timer?

Yes. IRI sells a kit with the parts for this project (PRJ-151). Message IRI on WhatsApp at +91 86060 82634 for the kit price and delivery details.

Industrial Robotics Institute
Logo