HKDSE DAT study materials
HKDSE DAT study resources

Hand-sanitiser dispenser at a school entrance: supply droop, sunlight and a dry-running pump

HKDSE DAT · Put your knowledge to work in context.

All case studies

Hand-sanitiser dispenser at a school entrance: supply droop, sunlight and a dry-running pump

At a Hong Kong secondary school, 1,200 students pass the main entrance between 07:40 and 08:10, and the school installs a no-touch automatic hand-sanitiser dispenser to reduce queuing. The prototype uses a reflective infrared proximity sensor aimed across a 120 mm gap, a 5 V gear pump rated 900 mA, a 5 V microcontroller board, and a 12 V 1 A switching adapter feeding a 5 V linear regulator (LM7805). During trials: (i) the microcontroller resets on roughly one press in eight, always at the moment the pump starts; a multimeter logged on the 5 V rail shows 4.9 V idle, dropping to 3.1 V for about 150 ms; (ii) on sunny mornings the dispenser fires continuously even when nobody is near, but works normally after 16:00 and on cloudy days; (iii) the pump runs dry and burns out when the 1 L tank empties, because the only level sensing is a float switch wired to an indicator LED, not to the controller. The casing is IP22 and mounted 1.2 m above the floor beside a door that is often wet.

1. Explain why the microcontroller resets when the pump starts, and propose fixes with justification.

Read the worked answer

The measurement points to supply droop, not software: 4.9 V falling to 3.1 V for 150 ms is 1.8 V of droop, and the event coincides exactly with pump start. A 5 V geared DC motor rated at 900 mA typically draws two to three times that at stall and during inrush, so a 2 A transient is plausible.

Contributing causes:

  • Linear regulator dissipation. At 12 V in and 5 V out, the 7805 must drop (12 − 5) × 0.9 ≈ 6.3 W even at rated current. A bare TO-220 has a junction-to-ambient thermal resistance of roughly 50 °C/W, so it heats by well over 100 °C and current-limits or shuts down, producing exactly this kind of rail collapse.
  • No bulk capacitance on the 5 V rail to supply the 150 ms transient.
  • Shared return path: pump current flowing through the same ground wire as the microcontroller creates common-impedance noise.
  • No flyback diode, so the inductive kick at switch-off adds a negative spike.

Fixes, best first:

  1. Replace the 7805 with a 5 V/3 A buck converter and give the pump its own rail or its own adapter. This removes both the heat and the shared impedance.
  2. Add 1000 µF low-ESR bulk plus 100 nF at the microcontroller, and a Schottky flyback diode across the motor.
  3. In firmware, lock out inputs for 200 ms during pump start so a brown-out cannot be interpreted as a press.

Test: scope the 5 V rail over 50 consecutive dispenses; accept droop below 0.3 V and no resets.

2. Explain why the sensor triggers continuously on sunny mornings and propose a robust change, including how you would verify it.

Read the worked answer

A simple reflective IR sensor compares the received DC level with a fixed threshold. Sunlight contains a large IR component; at a south-facing entrance the DC ambient level at the photodiode can sit above the threshold permanently, so the comparator stays in the 'detected' state. The 16:00 and cloudy-day correlation is the diagnostic evidence: the fault tracks ambient light, not the presence of hands. Lowering the threshold is not robust - it trades false triggering for missed detection and drifts with temperature, dust and supply voltage.

Robust changes:

  1. Modulate the emitter at 38–40 kHz and detect only the modulated component through a band-pass stage, as a TV remote receiver does. Sunlight is essentially DC and is rejected by roughly 40 dB.
  2. Add time logic: require a valid return for at least 100 ms, then lock out for 1.5 s to give one dose per pair of hands.
  3. Adapt the emitter current using an ambient-light measurement, or change the sensing principle to ultrasonic (insensitive to light) or capacitive proximity behind a plastic window.
  4. Mechanically, hood the sensor, aim it down at 30–45° to the floor and away from the window.

Verification: illuminate the target area with a 100,000 lux source (direct sun equivalent) and test with a white hand and a black hand. Accept detection of the hand in both cases and no triggering with no target for ten minutes.

3. Address the dry-running failure and the wet location. What control and enclosure changes are needed?

Read the worked answer

These are two separate problems and need separate fixes.

Dry running. A float switch that only drives an LED is an indicator, not a control. Wire it to a digital input with a pull-up, poll it before every dispense, and inhibit the pump while displaying a 'refill' message. Add redundancy: monitor pump current with a 0.1 Ω shunt and an op-amp. A pump running dry draws less current and spins faster, so a current window detects the fault within one or two doses. Add a firmware maximum continuous run time of 30 s so a stuck relay cannot destroy the pump.

Wet location. IP22 means protection against fingers and dripping water only, at up to 15° tilt. Beside an often-wet door, splash from wet hands and floor cleaning is likely, so specify at least IPX4 for the casing, a sealed window over the sensor, cable glands rated to the same level, and a drip loop in the cable. Electrically, keep the whole unit on 12 V SELV from a double-insulated adapter; no mains should enter the housing. Mount the adapter at least 300 mm above the floor and protect the circuit with a 30 mA RCD.

Verification: splash test to IPX4, then a functional and insulation test. The judgement being tested is that an indicator is not a safety interlock, and an IP rating must match the actual environment rather than the appearance of the product.