Build an automatic water dispenser that opens a solenoid valve when a container approaches, using a distance sensor and a MOSFET transistor.
Trigger the HC-SR04, measure echo time, and calculate distance with a timeout, while accounting for target angle, surface and air temperature.