Neural Network-Based Electrochemical Sensors for Free Chlorine Detection
Authors: Yamanouchi Mayano , Watanabe Takeshi , Dohi Masakazu , Yokoshiki Yasufumi , Sanari Nobuyuki , Hiyama Isao , Takazawa Yasuyuki , Enomoto Takanori , Tokuda Takashi , Koh Shinji 
Published: December 2024

Free chlorine which refers to all chlorine present in water as Cl2, hypochlorous acid (HOCl), and hypochlorite ion (ClO-), is a widely used disinfectant in tap and swimming pool water, as well as for washing raw vegetables and other foods. The lack of disinfection of such water sources can lead to the outbreak of infectious diseases. Therefore, the World Health Organization (WHO) has developed guidelines for drinking water quality using Hazard Analysis and Critical Control Point (HACCP) principles for the food industry, and monitoring of free chlorine is becoming increasingly important.[1] Traditional methods for measuring free chlorine concentration, such as absorption spectrophotometry and the iodine method, face challenges in providing accurate continuous measurements. Similarly, electrochemical measurement methods face challenges in accuracy due to the variability in the electrochemical response of free chlorine. This variability is influenced by electrode surface conditions and pH variation, as the ratio of hypochlorous acid and hypochlorite ion present depends on pH. To overcome these challenges, we explored the potential of neural network-based machine learning techniques utilizing electrochemical responses to estimate free chlorine concentration. In this study, we developed a free chlorine sensor utilizing machine learning, employing a current-potential curve as input to estimate free chlorine concentration, regardless of pH variations.

To collect data for training the neural network model, we built and employed an automated measurement system based on Raspberry Pi. This system facilitated the sequential preparation of various solutions using NaH2PO4, Na2HPO4, and sodium hypochlorite solutions, followed by electrochemical measurements using linear sweep voltammetry (LSV). A total of 480 LSV curves were generated, covering pH values ranging from 5.3 to 8.8, free chlorine concentrations from 0 ppm to 55 ppm, and scanning speeds of 100 mV/s with a range of 0.7 V to -1.5 V. Each measurement sequence consisted of 12 LSV curves representing various free chlorine concentrations. These concentrations were varied in constant increments at similar pH levels. In total, 40 sequences were performed through this process.

Figures 1 and 2 show LSV curves obtained at pH 5.7 and pH 8.9, respectively. Under both pH conditions, the current increases with increasing free chlorine concentration. However, variations in curve shapes, particularly the reduction peak observed around -0.4 V, illustrate the influence of pH on the electrochemical response. This peak, attributed to the reduction of hypochlorous acid, becomes suppressed at higher pH levels due to the decreased proportion of hypochlorous acid relative to hypochlorite ion.

Machine learning was conducted using 360 LSV curves for training and the remaining 120 LSV curves for validation, employing a neural network structure consisting of 5 affine layers with rectified linear unit (ReLU) as the intermediate layer and mean squared error (MSE) function as the output layer. Current value columns from LSV curves and corresponding free chlorine concentrations were utilized as inputs and outputs, respectively. The average error was low at 2.26 ppm, albeit with a maximum error of 15.4 ppm, attributed partly to variations in electrode surface conditions during measurements. To address this, we focused on the initial 0 ppm LSV curve in each sequence, which provides crucial information about changes in electrode surface conditions. Taking into account this insight, we performed a new approach. In this approach, we concatenated the current value columns from all LSV curves with the current value column from the corresponding 0 ppm LSV curve in the input data. This approach allowed us to effectively incorporate information about the electrode surface condition into machine learning, resulting in a significant improvement in accuracy. Figure 3 illustrates the predicted concentration plotted against actual concentration values, showing an average error of 1.04 ppm and a maximum error of 8.75 ppm, highlighting the efficacy of our machine learning approach.

In conclusion, our developed sensor, which employs a neural network, demonstrates outstanding accuracy in estimating free chlorine concentration, even when the pH level is unknown.

[1] World Health Organization, Guidelines for Drinking-Water Quality, 4th edn incorporating the first and second addenda, 2022.

Figure 1