Automated Public Hand-Washing Station Using Arduino Uno R4 WiFi

In this project, learners explore how technology supports hygiene and public health using Arduino. They build an automated hand-washing station that controls water and soap without physical contact, using sensors and simple code. We have included extra challenges that encourage learners to experiment with timing and sensor placement, making learning fun and hands-on. Through this experience, learners develop creativity, engineering skills, and problem-solving abilities while discovering how automation can reduce the spread of germs and improve safety in schools, markets, and other community spaces.

ItemPurpose
Arduino Uno R4 WiFiControls the hand-washing system
BreadboardUsed to connect low-power components
Infrared (IR) SensorDetects a hand under the tap
Relay Module (5V, 1-Channel)Safely switches the water pump
DC Water Pump (5–12V)Pumps water when activated
External Power Source (for pump)Powers the water pump
LEDIndicates water flow
220Ω ResistorProtects the LED
Jumper WiresConnect all components
USB CablePrograms and powers Arduino

Here’s how different components connect:

Infrared (IR) Sensor

When a hand is detected, the sensor sends a signal to Arduino.

  • VCC → connects to the 5V on the Arduino
  • GND → connects to the GND on the Arduino

  • OUT → connects to digital Pin 2 on the Arduino

The Green LED

Indicates Water Flow

  • Connect the long leg (positive) of the LED to one end of a 220Ω resistor

  • Connect the other end of the resistor to digital pin 7.

  • Connect the short leg (negative) of the LED to GND.

5V Relay Module

The relay has two sides: the control side (Arduino) and the high-current side (pump).

Control Side (Arduino)

  • VCC  → connects to the 5V on the Arduino

  • GND  → connects to the GND on the Arduino

  • IN (Input)  → connects to digital pin 8 on the Arduino.

On the relay output side (the high-current side):

  • The COM terminal connects to the positive terminal of the external battery.
  • The NO (Normally Open) terminal connects to the positive wire of the DC water pump.
  • The pump’s negative wire connects directly to the negative terminal of the external battery.
The DC Pump 

Pumps water when activated

  • Positive (+) terminal → connect to the NO (Normally Open) pin on the relay module
  • Negative (–) terminal → connect to negative (–) terminal of the battery

Important: The DC pump uses a separate power supply and is controlled safely using a relay.

Open the Arduino IDE on your computer and type this code:

int irSensor = 2;
int relayPin = 8;
int ledPin = 7;

void setup() {
pinMode(irSensor, INPUT);
pinMode(relayPin, OUTPUT);
pinMode(ledPin, OUTPUT);

digitalWrite(relayPin, LOW); // Pump OFF
}

void loop() {
int handDetected = digitalRead(irSensor);

if (handDetected == HIGH) {
digitalWrite(relayPin, HIGH); // Pump ON
digitalWrite(ledPin, HIGH); // LED ON
delay(3000); // Wash time
} else {
digitalWrite(relayPin, LOW); // Pump OFF
digitalWrite(ledPin, LOW); // LED OFF
}
}

 

  1. Connect your Arduino Uno to your computer using the USB cable
  2. In the Arduino IDE, go to:
  • Tools → Board → Arduino Uno
  • Tools → Port → (Select your Arduino port)
  1. Click the Upload button (the right arrow icon).
  2. Watch your project come to life!

CodeWhat It Does
IR sensor inputDetects hand presence
Relay outputControls the water pump
LED outputShows water flow
if conditionDecides when to release water
delay(3000)Controls washing duration

  • Pump does not turn ON

    • Check external power supply

    • Ensure relay COM and NO are correct

  • Water flows continuously

    • Adjust IR sensor sensitivity

    • Check sensor alignment

  • LED not lighting

    • Check LED polarity and resistor

  • Relay clicking but pump not running

    • Check pump voltage rating

  • How touch-free systems improve hygiene

  • How sensors detect objects

  • How relays safely control high-power devices

  • How automation saves water

  • Real-world applications in public health and smart cities

  • Add a soap dispenser pump

  • Add a timer display using an LCD

  • Limit water flow per person

  • Send usage data using WiFi

  • Add solar power support