A sensor including a substrate and a sensing element disposed on a
substrate is provided. The sensing element includes a sensing matrix in
contact with a flow of water, an indicator for one or more chemical
species in the flow of water, and a selectivity component that reacts
reversibly with the one or more chemical species. The sensor also
includes a light source configured to direct light through the substrate
and the sensing element. The sensor further includes a light detector
configured to receive transmitted light from the substrate and the
sensing matrix and to generate a signal representative of selective
wavelengths of the light indicative of the one or more chemical species
in the flow of water.