Multiparametric System For Measuring Physicochemical Variables Associated To Water Quality Based On The Arduino Platform
Multiparametric System For Measuring Physicochemical Variables Associated To Water Quality Based On The Arduino Platform
ABSTRACT Traditionally, the estimation of water quality is realized through laboratory analysis which is
time-consuming and requires specialized installations, equipment, and personnel. Nowadays, it is possible to
make real-time water monitoring through electrochemical sensors, microcontrollers, and central processing
units to detect water pollutants. This work proposes a system based on the Arduino platform for monitoring
parameters associated with water quality, such as oxidation-reduction potential, pH, total dissolved solids,
turbidity, temperature, electrical conductivity, and dissolved oxygen. A critical criterion for the sensor
selection was its cost and availability, resulting in sensors from different companies. They were integrated
without much complexity, thanks to the selected platform. In addition, a proposal is made for a signal
conditioning circuit for the oxidation-reduction potential electrode. A stage of filtering is added to the pH
and turbidity commercial circuits to improve their performance. Remote access to the data is done through
a mini-PC with WIFI connectivity and a MySQL database. All the sensors were calibrated with reference
solutions or against other commercial meters. Through the proposed system, time series having a sampling
period of 20 s of all parameters were recorded for more than a week-long exhibiting circadian patterns for the
same water sample. Pearson correlation for the parameters was carried on. The results show that the system
successfully monitored the seven physicochemical variables through low-cost sensors. It also has remote
access capabilities.
INDEX TERMS Arduino, dissolved oxygen, electrical conductivity, MySQL, oxidation-reduction potential,
PC, pH, temperature, time-series, total dissolved solids, turbidity, water quality monitoring.
This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/
69700 VOLUME 10, 2022
J. Fonseca-Campos et al.: Multiparametric System for Measuring Physicochemical Variables
of physicochemical parameters is an alternative for estimat- connected directly to the single-board computer general
ing the water quality and might complement the laboratory purpose input/output (GPIO) [5]. They showed a print screen
analysis of water. of the system accessed from a mobile device. Reference [6]
References [1], [2] suggest the recommended physico- reported a potentiostat and a Bluetooth transceiver shield
chemical parameters which should be monitoring for estimat- and electrochemical sensors of pH, free chlorine, and tem-
ing water quality because they are closely related to biological perature, all of them are attached to an Arduino board for
and chemical pollutants. These are the oxidation-reduction- measuring water samples.
potential (ORP), temperature, pH, electrical conductivity, dis- The actual technology permits sensing water quality
solved oxygen, turbidity, free residual chlorine, and nitrates. parameters in rivers, lakes, or sea, though compact aquatic
Measuring nitrates and free residual chlorine with sensors is vehicles [7]. Also, recently has been proved that microelec-
costly and requires frequent calibration [1], [2]. Therefore, trodes are promising sensors for monitoring water [8]–[10].
they are usually not considered in most proposals to estimate Furthermore, systems based on Arduino demonstrated their
water quality based on electrochemical sensors. success for monitoring water parameters [6], [7], [11], [12].
High values of ORP in water mean that its oxygen content This work proposes a system for measuring seven parame-
is high, and degradation of pollutants is more efficient. The ters related to water quality. The Arduino platform is suitable
ORP units are mV. The temperature influences the rate of the for developing prototypes because its hardware and software
reactions, the response of most physicochemical parameters, are open and free. Also, a large active community develops
and the rate of biological activity. The electrical conductivity software and hardware for this microcontroller, making it
provides a measure of the ions present in water. It is related cost-effective for several applications. Because there are just
to variables as salinity. The dissolved oxygen in water is a few options for getting commercial low-cost ORP signal
essential for most aquatic animals, and a low value might be conditioning circuits (SCC), in this work, there is a proposal
present in waters with high algae concentrations. for solving this drawback. The components chosen in this
Availability of cost-effective systems for remote moni- work are from different companies, although some provide
toring in real-time parameters associated with water qual- analog signals. Others offer digital signals, which commu-
ity is possible because the market offers an ample variety nicate with different protocols such as the serial peripheral
of sensors, electronics boards based on microcontrollers, interface (SPI), and the inter-integrated circuit, eye-squared-
small-size computers with Internet capabilities. Their mass C (I2 C). It is demonstrated that the Arduino platform per-
production might help administrate better this invaluable mits the integration of all the selected sensors without much
resource. complexity. Remote access to the data is done through a
Water is an essential resource for human beings; for this mini-PC with WIFI connectivity and a MySQL database. The
reason, there is an extensive research community offering organization of the document is the following: The section
solutions for monitoring water quality parameters in real- on material and methods includes a description of the sensors
time. For example, O’Flynn et al. were one of the pio- and the electrical connections of the signal conditioning cir-
neers of the development of a wireless sensor network for cuits. This section also explains the proposal of the ORP SCC
measuring water quality parameters like temperature, depth, and describes the software and connectivity of the system.
pH, temperature, conductivity, and phosphates [3]. They The results section includes the electrical characterization
reported 14 days of records for the River Lee in Cork. The of the ORP SCC, the calibration results, and a time series
Reference [1] proposed a system for measuring Turbidity, of the system. The latter part of the document covers the
ORP, pH, Electrical Conductivity, and Temperature based on conclusions, acknowledgments, and bibliography.
the sensors of SensoreX Corp with their respective signal
conditioning circuits. Their design offers remoting sensing II. MATERIALS AND METHODS
capabilities through an RF Xbee transceiver module sending Fig. 1 shows the block diagram of the system architecture.
water quality data every 5s. The central node corresponds pH, ORP, turbidity, and total dissolved solids (TDS) sensors
to an ARM/Linux-based system. Reference [2] reported a provide an analog output read by an analog to digital con-
prototype for real-time monitoring of water quality. This verter (ADC). A 16-bit-ADC module increases the resolution
work provides the design of signal conditioning circuits for of 10 bits offered by the Arduino Mega native ADC. The tem-
sensing water flow, temperature, electrical conductivity, pH, perature sensor is based on a commercial signal conditioning
and ORP. They used ZigBee technology for their wireless circuit communicated to the Arduino board through the SPI
communication. The logic level of the signal conditioning protocol. The electric conductivity (EC) and the dissolved
circuits proposed in this work corresponds to 3.3 V, which oxygen (DO) use the I2 C protocol to establish communication
is not the standard level employed in most Arduino boards. with the microcontroller unit (MCU). The user interacts with
Other works related to this topic include the measurement a graphical user interface (GUI) written in the programming
of pH and conductivity with embedded microsensors [4]. language of C# to decide how many parameters are read by
Gopavanitha and Nagaraju have shown a water quality mon- the system. A fixed sampling rate ts = 20 s is exclusively
itoring prototype based on a Raspberry PI with temperature, employed. The C# software incorporates the connector/NET
conductivity, pH, turbidity, flow, sensors, and solenoid valves program to provide the option to store the information in a
FIGURE 1. Block diagram from the system architecture. SCC stands for
signal conditioning circuit.
FIGURE 2. Schematic diagram of the ORP signal conditioning circuit.
B. pH SENSOR
The pH electrodes follow a linear transfer function known as
Nernst equation [6], [8], [14], [17], [18]. pH sensitivity is sen- FIGURE 5. Block diagram and electrical wiring of turbidity signal
sor dependent, but at 25 ◦ C its value is around 59 mV/pH [17], conditioning circuit.
[18]. Some reported values on the literature are 57 mV/pH,
59.14, and 59.18 mV/pH in the references [6], [8], [14]; keyestudio, and others. These measure up to 1000 pm. Higher
respectively. Considering the sensitivity of 59 mV/pH a very values are unsafe for human consumption.
strong acid with pH 0 will create a potential in the electrode Fig. 4 shows the block diagram with the electrical con-
of 413 mV. For a very strong base with pH 14 the voltage will nections for TDS measuring with the Keyestudio module.
correspond to −414 mV. pH measurement requires tempera- It has an analog output A, linearly correlated to TDS ranging
ture compensation. Reference [2] reported an equation which from 0 to 2.3 V. vout is wired to one of the ADC inputs.
corrects this effect. The compensated pH value pHc is given Turbidity is an optical property describing how much light
by is scattered or absorbed for a water sample [20]. The most
complex and precise turbidimeters measure light at two con-
pHc = pH − (0.003 · (T − T0 ) · (pH0 − pH )) , (6)
figurations. An infrared (IR) light source, like a light-emitting
where pH is the pH read value, pH0 is the central value diode (LED), sends light into a water sample. One IR optical
given by 7, T is the temperature in ◦ C, and T0 is the central detector located in a straight line to the IR source (180◦ )
temperature of 25 ◦ C. measures light coming from it. The other IR detector is
Fig. 3 shows the block diagram of the pH signal condition- perpendicular to the straight-line trajectory of light (90◦ ) [1],
ing circuit, which reads the signal coming from a generic pH [21], [22]. The great majority of the inexpensive turbidime-
electrode with a Bayonet Neill–Concelman (BNC) connector. ters measure this parameter with the configuration of one
The SCC is a commercial circuit from DIY MORE model photodetector [23]–[27].
PH-4502C having an analog output (PO) and works in the There are low-cost commercial options if there is no need
temperature range from −10 to 50 ◦ C. Terminal labeled as to measure turbidity with very high accuracy or when its
TO provides an analog signal for temperature compensating value is less than 1000 NTU. For example, the Robot Gravity
the pH, having a soldered sensor directly in the printed board turbidity sensor and the TS-300B sensor [28].
circuit (PCB) of the SCC. DO is a digital output whose thresh- Fig. 5 shows the block diagram and the electrical wiring
old is modified with a potentiometer. The TO pin was left of the turbidity SCC. This circuit and the sensor correspond
unconnected to the system because the temperature sensor to the model TSW-20M. It works in the 180◦ configuration
didn’t contact the water. vout is the terminal connected to the and measures the turbidity in the range of 0 − 4550 NTU.
ADC. The addition of a three-pole low-pass filter having a The signal output vout is in the voltage interval of 0 − 4.5 V,
cut-off frequency of 5 Hz attenuated high-frequency noise. which suits well with the ADC range of the Arduino Mega.
U1 corresponds to the TLV2472 op amp. Also, it incorporates a digital signal (DO) whose threshold
is controlled with a potentiometer. The addition of a three-
C. TDS SENSOR pole low-pass filter having a cut-off frequency of 5 Hz
TDS provides a measure of the water salinity, and it is related attenuated high-frequency noise. U1 corresponds to the
to the EC of water [19]. Inorganic salts are the main contrib- TLV2472 op amp.
utors to TDS, and a small contribution is due to inorganic
matter. Its measurement helps to identify the intrusion of D. 16-BIT ADC
seawater in groundwater. Recently, cheap SCC and sensors The Arduino Mega has an ADC of 10 bits. Incorporating
based on the same design for measuring TDS with microcon- the module ADS1115 from Adafruit, having a 16-bit ADC
troller boards are available from some distributors as gravity, with a programmable gain amplifier improves the system
FIGURE 8. Block diagram and electrical wiring of the SCC: (a) dissolved
oxygen, and (b) electric conductivity.
FIGURE 11. The plot of the ORP, where the vertical and horizontal axes
correspond to the magnitude in mV and the time in seconds, respectively.
FIGURE 16. Bode plot of the SCC for ORP circuit. Solid and dashed lines FIGURE 17. ORP experimental points in terms of the reference solutions
correspond to the transfer function and the simulation, respectively. Solid voltage. Circles, crosses, and triangles refer to the GE, AS, and 169E
circles are experimental data. sensors. Solid, dashed, and dotted lines represent the linear fitting for the
GE, AS, and the 169E electrodes, respectively.
FIGURE 19. TDS readings and linear fitting of the sensor and the
FIGURE 20. Sensor and equipment turbidity readings and parabolic
commercial tester.
fitting.
TABLE 4. Fitting coefficients for the TDS electrode considering the linear
model TDS = a0 + a1 TDSv 1 ppm. TABLE 5. Fitting coefficients for the turbidity considering the parabolic
2 NTU.
model turbidity = a0 + a1 vtur + a2 vtur
TABLE 6. Fitting coefficients for the RTD PT100 sensor TABLE 7. Fitting coefficients for the linear model between the EC sensor
Tbulb = a0 + a1 TPT 100 ◦ C. and the reference solutions.
FIGURE 22. Linear model for the experimental data obtained during the
calibration of the electrical conductivity sensor of AS.
FIGURE 23. Scatter plot and fitting of the electric conductivity of the
sensor of Atlas Scientific and the commercial tester.
Fig. 21 shows a deviation of the experimental data from
the straight-line relationship. In fact, in the application report TABLE 8. Fitting coefficients for the linear model between the EC sensor
SBAA275–June 2018 called ‘‘A Basic Guide to RTD Mea- and the commercial meter for the equation ECext = a0 + a1 ECAS_cal .
surements’’ of Texas Instruments and in the MAX31865
datasheet, they expose a nonlinear behavior of the RTD
resistance in terms of temperature, but in the region from
0 to 100 ◦ C where readings are likely to be made they assume
a linear relationship. The discrepancy between the model and
the experimental points might be related to the length of
the sensor 16 cm and the measured water volume of 19 L.
On the one hand, the bulb thermometer provided a point
measurement, which was not guaranteed with the other sonde. Fig. 22 shows a good agreement between the AS sensor and
Also, water temperature gradients were likely to be present. the straight-line model. Fig. 23 does not show a perfect linear
relationship. However, the slope of the model is very near to
F. ELECTRICAL CONDUCTIVITY SENSOR CALIBRATION unity. The resolution of ±2% of both electrodes might cause
Three-point calibration was carried on with reference solu- some error.
tions of 1.413, 12.88, and 150 mS, which were compared
with the readings of the electrical conductivity sensor of Atlas G. DISSOLVED OXYGEN SENSOR CALIBRATION
Scientific. A straight line relationship fitted the experimental The dissolved oxygen sensor was calibrated by comparing its
data with good agreement. Fig. 22 shows the behavior of both readings with the Milwaukee MW600 PRO DO Meter. A fit-
variables following the equation ECcal = a0 + a1 ECAS mS, ting between both quantities follows the equation DOMW =
where ECAS is the value read by the sensor in µS and the a0 + a1 DOAS , where DOAS corresponds to the magnitude
ECcal is the electrical conductivity of the solutions. Table 7 provided by the sensor of Atlas Scientific and DOMW is
shows the fitting coefficients. the measure of the commercial meter. Fig. 24 shows the
An additional calibration consisted of comparing the elec- experimental data and the linear fitting. Table 9 shows the
tric conductivity of a few solutions measured with the EC sen- coefficients of the model.
sor and the commercial tester ExStik II EC500 from Extech Cloete and colleagues avoided the measurement of dis-
company. Fig. 23 shows the linear fitting by the least square solved oxygen due to cost, maintenance, and the requirement
method of the readings of both sensors. The equation is given of frequent calibration [2]. During the performance of the
by ECext = a0 + a1 ECAS_cal mS, where ECext is the value experiments, a few minutes for reading stabilization was
of the tester and ECAS_cal is the magnitude of the sensor of required in both sensors, and the uncertainty of the measure-
Atlas Scientific after being linearly fitted with the coefficients ment shown in Fig. 24 in the AS sensor was not negligible.
of the Table 7. Table 8 shows the fitting coefficients of the last Nevertheless, the linear relationship in both readings shows
calibration. good agreement.
TABLE 9. Fitting coefficients for the linear model between the DO sensor
and the commercial meter.
APPENDIX
PSEUDOCODE FOR ARDUINO PROGRAM
A further explanation of the Arduino program is realized in
the pseudocode shown below.