Touchless soap dispenser

A touchless soap dispenser: an FC-51 infrared sensor beside the spout and a gear pump under the bottle, with a hand you slide under it.

Drag the hand under the spout, run the pump, and soap drops into it. Take the hand away and it takes its soap with it.

Pins

Pin What it does
VCC, GND 3.3 to 5 V for the sensor.
OUT The sensor's output: LOW while a hand is in range.
M+, M- The pump's motor. Current from M+ to M- pumps. Drive it from a transistor, with a diode across it.

The sensor and the pump are the parts a home build uses, on the pins they have on the bench, so a sketch written for the loose parts runs the dispenser unchanged.

How it works

The slider is how far under the spout the hand is, 1 to 80 cm, where 80 is nobody there. The swatch beside it puts a black glove on the hand. The sensor is the FC-51: with its trimmer in the middle (threshold) a white card would trip it at about 13 cm, and a bare hand, which sends back about two thirds as much infrared, at about 11 cm. A black glove has to come within about 3 cm.

The pump is a small gear motor with the DC motor's ratings, 6 V and 200 rpm, and it moves 0.5 ml a turn (ml_per_turn). A 0.7 s dose from a transistor on 5 V is just under two turns: about 1 ml. Soap leaves the spout in drops of a fifth of a milliliter. A hand within 15 cm of the spout catches them; otherwise they fall into the basin. A hand that leaves takes its soap with it.

The bottle holds bottle ml (30) and the window shows how much is left. An empty bottle pumps nothing. The round arrow fills it and wipes the basin.

What the model gets right

  • The sensor is the FC-51 model: the inverse square, white against black, and the trimmer.
  • The pump loads its transistor exactly as the DC motor does: a 6 ohm winding, a back EMF at speed, and 120 ms to get going.
  • Everything is deterministic.

What it does not model

  • Sunlight, which makes a real FC-51 see hands that are not there.
  • The soap's thickness, the pump priming, and the last slow drop.

See it in a project