Electrochemical detection of calcium and magnesium in water bodies