New sensor detects contaminants in water in real time