An appliance using water including an incoming water valve is provided.
The appliance also includes a sensor disposed in-line to an incoming flow
of water received from the incoming water valve and is configured to
sense a degree of hardness in the incoming flow of water. The sensor
includes a substrate and a sensing element disposed on the substrate. The
sensing element includes a sensing matrix, an indicator for one or more
chemical species in a flow of water, and a selectivity component that
reacts reversibly with the one or more chemical species in the water. The
sensor also includes a light source configured to direct light through
the substrate and the sensing matrix. 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. The appliance also includes a cleaning volume, a
drain for the cleaning volume and an additive valve for an additive used
for cleaning. The appliance further includes a controller configured to
receive a signal indicative of hardness of the flow of water from the
sensor and output it to control the incoming water valve, the additive
valve and the drain on the cleaning volume.