Optical method for measuring water flow with automatic recording