Head office, Rana Pratap Bagh, Delhi011 2721 1512+91 97116 99511

Science project idea

Touch-free soap dispenser with an ultrasonic sensor, relay and small pump

When a hand comes within about 10 cm, the sensor detects it and the Arduino runs a small pump for a fraction of a second. It shows how sensors, relays and timers are combined in a hygiene device.

What it shows

When a hand comes within about 10 cm, the sensor detects it and the Arduino runs a small pump for a fraction of a second. It shows how sensors, relays and timers are combined in a hygiene device.

The science

The ultrasonic sensor measures the distance every 100 ms. If an object is closer than 10 cm for two readings in a row, the Arduino sets the relay pin LOW and the relay connects the pump to its battery. A relay lets a small Arduino signal switch a larger current in a separate circuit. A diode across the pump absorbs the voltage spike when it switches off. A lockout of two seconds stops continuous pumping if a hand stays near.

Materials

Cost: under Rs 1,500. Many items come from home or from waste; spare parts such as LEDs, motors and wire are in the store.

  • An Arduino Uno or Nano
  • An HC-SR04 ultrasonic sensor
  • A 5 V single-channel relay module
  • A 3 to 6 V mini submersible pump with a short tube
  • A 4 x AA battery holder (6 V) for the pump
  • A 1N4007 diode
  • A plastic bottle for soap solution and a tray
  • A breadboard and jumper wires

Safety

For this project: Low voltage battery only. Use dilute liquid soap for testing, never alcohol sanitiser, as it is flammable. Keep the Arduino and relay away from liquid and use a tray to catch drips. An adult must help with drilling the bottle.

Never use mains electricity: power models with cells, batteries or a low-voltage adapter. Sharp and hot tools, flames and lab chemicals need an adult or your teacher beside you. Keep magnets, button cells and small parts away from young children, and wash your hands after making.

All the safety rules

Step by step

8 steps. Do them in order, and test each part before you go on to the next. Write what you notice in a notebook as you go.

  1. Mount the sensor on the front of the bottle holder facing outward and above the tray.

  2. Connect the sensor: VCC to 5 V, GND to GND, TRIG to pin 9 and ECHO to pin 10.

  3. Connect the relay module: VCC to 5 V, GND to GND and IN to pin 7.

  4. Wire the pump battery positive to the relay COM, the relay NO to the pump red wire, and the pump black wire to battery negative.

  5. Put the 1N4007 across the pump terminals, band on the positive side.

  6. In the sketch, set the relay pin HIGH at start to keep the pump off (many modules turn on with LOW).

  7. When the distance stays under 10 cm for two readings, set the pin LOW for 600 ms to dispense and then wait two seconds.

  8. Test with a hand and adjust the pump time until one pump gives about a teaspoon of dilute soap.

What you should see

A hand placed below the sensor gets a measured squirt of soap solution without any touching, and the dispenser waits before it can fire again.

Viva questions

A teacher or a judge will ask how it works. Try to answer each question before you open it, then compare.

1What does a relay do?

It uses a small control current to switch a separate circuit, with the two kept apart.

2Why is a diode across the pump?

It protects the circuit from the voltage spike when the motor current stops.

3Why is there a lockout time?

It stops continuous pumping when a hand stays under the sensor.

4Why use soap solution for testing?

Alcohol sanitiser is flammable and should not be near electrical parts.

Free ebook: Viva Questions for Science Projects

Take it further

Add a counter on an OLED that shows how many doses were given and a low-level warning.

Change one thing, measure what happens, and add a table or chart of your readings: that is what turns a model into your own investigation.

Free ebooks for this project

WhatsApp us