**Intelligent Wide-Area Water Quality Monitoring and Analysis System Exploiting Unmanned Surface Vehicles and Ensemble Learning**

#### **Huiru Cao <sup>1</sup> , Zhongwei Guo <sup>2</sup> , Shian Wang 1,\*, Haixiu Cheng 2,3 and Choujun Zhan <sup>4</sup>**


Received: 27 December 2019; Accepted: 25 February 2020; Published: 2 March 2020

**Abstract:** Water environment pollution is an acute problem, especially in developing countries, so water quality monitoring is crucial for water protection. This paper presents an intelligent three-dimensional wide-area water quality monitoring and online analysis system. The proposed system is composed of an automatic cruise intelligent unmanned surface vehicle (USV), a water quality monitoring system (WQMS), and a water quality analysis algorithm. An automatic positioning cruising system is constructed for the USV. The WQMS consists of a series of low-power water quality detecting sensors and a lifting device that can collect the water quality monitoring data at different water depths. These data are analyzed by the proposed water quality analysis algorithm based on the ensemble learning method to estimate the water quality level. Then, a real experiment is conducted in a lake to verify the feasibility of the proposed design. The experimental results obtained in real application demonstrate good performance and feasibility of the proposed monitoring system.

**Keywords:** unmanned surface vehicle; water monitoring; ensemble learning; dynamic power management

#### **1. Introduction**

High-quality water supply is essential for human survival [1,2]. Therefore, water protection has been a hot topic in academic and industrial domains [3,4]. With the rapid development of industry and urbanization, industrial and sanitary sewage has severely affected fresh-water sources worldwide, especially in developing countries, and thus has significantly influenced the living conditions of human beings [5]. In water protection, water quality monitoring is a key task. Therefore, in smart cities, it is extremely important to monitor the quality of water resources effectively [6,7].

In recent years, the evolution of high-resolution sensors and Internet of Things (IoT) technologies has significantly improved water quality monitoring technologies [8–10]. Various WQMSs have been designed to solve the problems related to the water quality monitoring of lakes [11,12], rivers [13,14], and groundwater [15,16]. Generally, water quality can be accurately determined by laboratory analysis, but spatial resolution and rapid assessment cannot be obtained with efficiency, simultaneously.

Significant progress has been made in the water quality monitoring field by the introduction of the IoT [17] and unmanned techniques [18,19] that can reduce the monitoring cost and improve the intelligence of the WQMS [20,21]. On the one hand, the new measurement technologies, such

as ship-borne measurements [22] and IoT system [23], have been used to monitor water quality. Particularly, [24,25], an unmanned surface vehicle (USV) was used to monitor water quality. On the other hand, various water analysis methods have been used to improve water quality estimation systems [26–28]. However, there are still many challenges, such as those related to low cost, high efficiency, and good real-time performance. Motivated by these studies, in our work we integrate the USVs into water quality monitoring at different depths. However, there are still many challenges, such as those related to low cost, high efficiency, and good real-time performance. Motivated by these studies, in our work we integrate the USVs into water quality monitoring at different depths. In this work, an intelligent three-dimensional wide-area water monitoring and analysis system and a dynamic energy-saving system are proposed. For the purpose of convenient reference, acronyms used in this paper are given in Table 1. The conceptual diagram of the proposed design is

[24,25], an unmanned surface vehicle (USV) was used to monitor water quality. On the other hand, various water analysis methods have been used to improve water quality estimation systems [26–28].

*Water* **2020**, *12*, x FOR PEER REVIEW 2 of 15

Significant progress has been made in the water quality monitoring field by the introduction of the IoT [17] and unmanned techniques [18,19] that can reduce the monitoring cost and improve the intelligence of the WQMS [20,21]. On the one hand, the new measurement technologies, such as ship-

In this work, an intelligent three-dimensional wide-area water monitoring and analysis system and a dynamic energy-saving system are proposed. For the purpose of convenient reference, acronyms used in this paper are given in Table 1. The conceptual diagram of the proposed design is shown in Figure 1. Most of the traditional water quality monitoring devices can obtain only the water quality parameters related to the water surface [29,30]. However, due to the sewage spreading problem, the traditional methods have the shortcoming of collecting water quality monitoring data with limited precision; instead, water quality should preferably be monitored at different depth levels. Therefore, a device that can realize three-dimensional water quality monitoring at different depth levels is designed in this work. In the proposed system, a sensor node collects the water quality data and uploads it to the cloud, and then a water quality monitoring model based on ensemble learning is used to determine the water quality level. shown in Figure 1. Most of the traditional water quality monitoring devices can obtain only the water quality parameters related to the water surface [29,30]. However, due to the sewage spreading problem, the traditional methods have the shortcoming of collecting water quality monitoring data with limited precision; instead, water quality should preferably be monitored at different depth levels. Therefore, a device that can realize three-dimensional water quality monitoring at different depth levels is designed in this work. In the proposed system, a sensor node collects the water quality data and uploads it to the cloud, and then a water quality monitoring model based on ensemble learning is used to determine the water quality level. **Table 1.** Acronyms used in this paper. **Acronym Description Acronym Description** 


**Table 1.** Acronyms used in this paper. ADC Analog digital converter PVC Polyvinyl chloride

**Figure 1.** The overview of the proposed three-dimensional water quality monitoring system. USV, unmanned surface vehicle. **Figure 1.** The overview of the proposed three-dimensional water quality monitoring system. USV, unmanned surface vehicle.

The rest of the paper is organized as follows. Section 2 presents the overall design of the USV and automatic cruising strategy. Section 3 describes the proposed water quality monitoring system. Section 4 introduces the water quality analysis algorithm. The experimental results of the proposed system are presented in Section 5. Section 6 concludes the paper.

#### **2. USV Design 2. USV Design**

This section introduces the architecture design of the proposed USV and an automatic positioning cruise system. This section introduces the architecture design of the proposed USV and an automatic positioning cruise system.

system are presented in Section 5. Section 6 concludes the paper.

*Water* **2020**, *12*, x FOR PEER REVIEW 3 of 15

The rest of the paper is organized as follows. Section 2 presents the overall design of the USV and automatic cruising strategy. Section 3 describes the proposed water quality monitoring system.

#### *2.1. USV Architecture 2.1. USV Architecture*

The overall architecture design of the USV is shown in Figure 2. The USV weighs 5 kg, and its length, width, and height are 0.8 m, 1.8 m, and 0.6 m, respectively. The draft of the vehicle is 0.1 m. Meanwhile, the catamaran is equipped with two brushless DC (direct current) motors, which can provide thrust from 1 kg to 2 kg. The hull structure of the USV adopts the structure based on the catamaran. Both hulls adopt a pontoon made of a PVC (polyvinyl chloride) mesh cloth, and the connecting bridge has a PVC composite frame. The frame of the connecting bridge is covered with a plexiglass panel to prevent damages to the system components caused by external factors. The entire USV system mainly consists of three parts: an MCU (micro control unit), an automatic positioning cruise system, and a wireless communication transmission module. The overall architecture design of the USV is shown in Figure 2. The USV weighs 5 kg, and its length, width, and height are 0.8 m, 1.8 m, and 0.6 m, respectively. The draft of the vehicle is 0.1 m. Meanwhile, the catamaran is equipped with two brushless DC (direct current) motors, which can provide thrust from 1 kg to 2 kg. The hull structure of the USV adopts the structure based on the catamaran. Both hulls adopt a pontoon made of a PVC (polyvinyl chloride) mesh cloth, and the connecting bridge has a PVC composite frame. The frame of the connecting bridge is covered with a plexiglass panel to prevent damages to the system components caused by external factors. The entire USV system mainly consists of three parts: an MCU (micro control unit), an automatic positioning cruise system, and a wireless communication transmission module.

**Figure 2.** The overall architecture design of the unmanned service vehicle (USV). GPRS, general packet radio service; MCU, micro control unit; GPS, global position system; TDS, total dissolved solids; ARM, advanced reduced instruction-set computer machine. **Figure 2.** The overall architecture design of the unmanned service vehicle (USV). GPRS, general packet radio service; MCU, micro control unit; GPS, global position system; TDS, total dissolved solids; ARM, advanced reduced instruction-set computer machine.

#### *2.2. USV Embedded Control Unit 2.2. USV Embedded Control Unit*

The USV control unit is based on a 32-bit ARM microcontroller. An image of the USV is shown in Figure 3. The USV MCU is directly connected to the cruise system, power control module, and two wireless communication modules, as demonstrated in Figure 3. The USV MCU can establish wireless links to the communication module. The MCU of the USV is responsible for power control, cruising, and other tasks. Since the USV is sailing, an alterable power consumption mode is adopted according to the distance between the current and target locations. For instance, a USV is in the working and position modifying mode when the distance from the target location is less than or equal to 50 m, and when the distance is greater than 50 m the USV will go to the standby mode. The USV control unit is based on a 32-bit ARM microcontroller. An image of the USV is shown in Figure 3. The USV MCU is directly connected to the cruise system, power control module, and two wireless communication modules, as demonstrated in Figure 3. The USV MCU can establish wireless links to the communication module. The MCU of the USV is responsible for power control, cruising, and other tasks. Since the USV is sailing, an alterable power consumption mode is adopted according to the distance between the current and target locations. For instance, a USV is in the working and position modifying mode when the distance from the target location is less than or equal to 50 m, and when the distance is greater than 50 m the USV will go to the standby mode.

*Water* **2020**, *12*, x FOR PEER REVIEW 4 of 15

*Water* **2020**, *12*, x FOR PEER REVIEW 4 of 15

**Figure 3.** Structural distribution map of the USV. PVC, polyvinyl chloride. **Figure 3.** Structural distribution map of the USV. PVC, polyvinyl chloride. **Figure 3.** Structural distribution map of the USV. PVC, polyvinyl chloride.

#### *2.3. Automatic Positioning Cruise System 2.3. Automatic Positioning Cruise System 2.3. Automatic Positioning Cruise System*

The simplified block diagram of an automatic positioning cruise system of a USV is presented in Figure 4. The positioning cruise system includes a nine-axis sensor MPU9250 (three-axis gyroscope, three-axis acceleration, and three-axis magnetometer) and a GPS positioning module, which are used for positioning and USV moving direction determination. The nine-axis sensor and the positioning module are connected to the MCU (STM32F103ZET6) via SPI and UART interference, as shown in Figure 4. The simplified block diagram of an automatic positioning cruise system of a USV is presented in Figure 4. The positioning cruise system includes a nine-axis sensor MPU9250 (three-axis gyroscope, three-axis acceleration, and three-axis magnetometer) and a GPS positioning module, which are used for positioning and USV moving direction determination. The nine-axis sensor and the positioning module are connected to the MCU (STM32F103ZET6) via SPI and UART interference, as shown in Figure 4. The simplified block diagram of an automatic positioning cruise system of a USV is presented in Figure 4. The positioning cruise system includes a nine-axis sensor MPU9250 (three-axis gyroscope, three-axis acceleration, and three-axis magnetometer) and a GPS positioning module, which are used for positioning and USV moving direction determination. The nine-axis sensor and the positioning module are connected to the MCU (STM32F103ZET6) via SPI and UART interference, as shown in Figure 4.

**Figure 4.** The architecture of the automatic positioning cruise system. GPS, global positioning system; VCC, volt current condenser; GND, ground; TX, transport; RX, receive; CS, chip select; SCLK, serial clock; MOSI, master out slave in; MISO, master in slave out; SDI, serial data input; SDO, serial data output. **Figure 4.** The architecture of the automatic positioning cruise system. GPS, global positioning system; VCC, volt current condenser; GND, ground; TX, transport; RX, receive; CS, chip select; SCLK, serial clock; MOSI, master out slave in; MISO, master in slave out; SDI, serial data input; SDO, serial data output. **Figure 4.** The architecture of the automatic positioning cruise system. GPS, global positioning system; VCC, volt current condenser; GND, ground; TX, transport; RX, receive; CS, chip select; SCLK, serial clock; MOSI, master out slave in; MISO, master in slave out; SDI, serial data input; SDO, serial data output.

In some of the previous studies [31,32], an automatic positioning achieved by a nine-axis sensor and a GPS (global position system) module was presented. Therefore, based on the circuit architecture displayed in Figure 4, an APCS (automatic positioning cruise system) is proposed. The flowchart of the APCS working principle is shown in Figure 5. In some of the previous studies [31,32], an automatic positioning achieved by a nine-axis sensor and a GPS (global position system) module was presented. Therefore, based on the circuit architecture displayed in Figure 4, an APCS (automatic positioning cruise system) is proposed. The flowchart of the APCS working principle is shown in Figure 5. In some of the previous studies [31,32], an automatic positioning achieved by a nine-axis sensor and a GPS (global position system) module was presented. Therefore, based on the circuit architecture displayed in Figure 4, an APCS (automatic positioning cruise system) is proposed. The flowchart of the APCS working principle is shown in Figure 5.

positions by:

*Water* **2020**, *12*, x FOR PEER REVIEW 5 of 15

**Figure 5.** Flowchart of the APCS. ( , ) *s s x y* , the starting position; ( , ) *N N x y* , the next position; *DN*, the distance between the next and starting positions; *N* , the angle between the next and starting positions; *C* , the current heading angle; , the angle deviation; , the angle resolution; ( , ) *C C x y* , the current position; *D*, the distance deviation; <sup>0</sup> *d* , the distance resolution; *t*, moving time. **Figure 5.** Flowchart of the APCS. (*xs*, *ys*), the starting position; (*xN*, *yN*), the next position; *DN*, the distance between the next and starting positions; α*N*, the angle between the next and starting positions; α*C*, the current heading angle; α, the angle deviation;ε, the angle resolution; (*xC*, *yC*), the current position; *D*, the distance deviation; *d*0, the distance resolution; *t*, moving time.

The main APCS working steps are as follows. First, the coordinate system is set up such that the starting point of the monitoring denotes the origin, the east-west axis represents the *x*-axis, and the north-south axis represents the *y*-axis. The MCU of a USV obtains the starting position by a GPS module and uses a wireless communication module to obtain the information on the next position, which are respectively denoted as ( , ) *s s x y* and ( , ) *N N x y* , from the cloud server for the water monitoring task. Then, the MCU calculates distance *DN* and angle *<sup>N</sup>* between the next and starting The main APCS working steps are as follows. First, the coordinate system is set up such that the starting point of the monitoring denotes the origin, the east-west axis represents the *x*-axis, and the north-south axis represents the *y*-axis. The MCU of a USV obtains the starting position by a GPS module and uses a wireless communication module to obtain the information on the next position, which are respectively denoted as (*x<sup>s</sup>* , *ys*) and (*xN*, *yN*), from the cloud server for the water monitoring task. Then, the MCU calculates distance *D<sup>N</sup>* and angle α*<sup>N</sup>* between the next and starting positions by:

$$D\_N = \sqrt{(\mathbf{x}\_s - \mathbf{x}\_N)^2 + (y\_s - y\_N)^2} \tag{1}$$

$$\alpha\_N = \arctan \frac{y\_N - y\_s}{x\_N - x\_s} \tag{2}$$

arctan *N s N N s x x* (2) After obtaining the distance and angle of the next position, the MCU makes the USV move to the next position. During the USV's movement, the APCS periodically drives the sensor of MPU9250 and GPS module weighted fusion algorithm and sends the current heading angle *C* to the MCU by weighted fusion algorithm. Then, the MCU calculates the angle deviation between *C* and *N* After obtaining the distance and angle of the next position, the MCU makes the USV move to the next position. During the USV's movement, the APCS periodically drives the sensor of MPU9250 and GPS module weighted fusion algorithm and sends the current heading angle α*<sup>C</sup>* to the MCU by weighted fusion algorithm. Then, the MCU calculates the angle deviation between α*<sup>C</sup>* and α*N*, and makes the USV change direction until the angle deviation becomes smaller than a predefined value ε, which is given by:

$$\alpha = |a\_{\mathbb{C}} - a\_{\mathbb{N}}| \le \varepsilon \tag{3}$$

value , which is given by: | |  *C N* (3) Then, before the USV reaches the next position, the MCU periodically acquires the information on USV current position ( , ) *C C x y* and calculates distance deviation *D* of the next position by Then, before the USV reaches the next position, the MCU periodically acquires the information on USV current position (*xC*, *yC*) and calculates distance deviation *D* of the next position by Equation (4). The presented steps are repeated until distance deviation *D* satisfies the condition given by Equation (4), i.e., until the USV reaches the target position.

$$D = |D\_{\mathbb{C}} - D\_{N}| \le d\_{0} \tag{4}$$


0

by Equation 4, i.e., until the USV reaches the target position.

Finally, when the USV reaches the next position, the water quality parameters are collected by the WQMM (water quality monitoring module).

In practice, a USV is placed on a lake, and its starting point is set at a specified location. Then, water quality monitoring is completed in the cruise mode. The USV stops at each measurement point until the water quality monitoring at different depths is completed. In the above automatic cruise steps, there may be a deviation at the position level. Therefore, by comparing the position information from a GPS module and that of the nine-axis sensor with α*<sup>N</sup>* and *D<sup>N</sup>* intermittently, the USV's position is modified by adjusting the angle α and distance *D*.

#### *2.4. Wireless Communication Transmission Modules*

Two different types of wireless modules are adopted to connect to the cloud server and the WQMS, respectively. The first module uses the GPRS (general packet radio service) to realize wireless communication transmission between USV and cloud server. This technology is built based on a cellular network with a long communication distance, and it can be directly used in GSM (global system for mobile communications) or LTE (long term evolution) network. The other wireless communication transmission system is a Wi-Fi module intended for the USV and WQMM, and it uses the IEEE (institute of electrical and electronic engineers) 802.11n communication protocol.

#### **3. Water Quality Monitoring System**

The WQMS represents the key component in this study. This section introduces the main modules of the WQMS, which are the water quality monitoring module, a lifting device, and data transmission and storage system. *Water* **2020**, *12*, x FOR PEER REVIEW 7 of 15

#### *3.1. Water Quality Monitoring Module* solution to detect the hydrogen ion concentration in the solution and to determine the pH value of the solution.

*3.2. WQMM Lifting Device* 

box, which is given by:

monitoring.

desired rotating speed while the device is running.

*3.3. Sensing Data Transmission and Storage* 

transmission is shown in Figure 7.

In the proposed system, the WQMM consists of an MCU, power, sensors, wireless communication module, and plastic enclosure, as demonstrated in Figure 6a. As already mentioned, the MCU of the WQMM is based on a 32-bit ARM microcontroller. The main water quality values, including the pH value, total dissolved solids (TDS) value, and turbidity value, are monitored [33]. The parameters of sensors used to measure these values, such as sensing range, accuracy, and working voltage, are presented in Table 2. The MCU of the WQMM mainly controls the water quality monitoring sensor. After obtaining the relevant water quality data, the collected data are transmitted to the main control board via the wireless module. TDS sensor: The working voltage of the TDS sensor is 3.3~5 V, while its measurement range and accuracy are 0~1000 ppm and ±5% F.S (full scale) (25 °C), respectively. There is a difference between the measured value and the true value of the TDS sensor, which is closely related to the water temperature. Therefore, the TDS sensor should be modified during practical application. Turbidity sensor: The turbidity value is monitored based on the light transmittance and scattering rate of a liquid solution. The turbidity information is obtained by the AD (analog to digital) conversion interface in the dynamic monitoring environment. The working voltage and accuracy of turbidity sensor are 5 V and 0.75%, respectively. The response time is shorter than 500 ms.

**Figure 6.** (**a**) Arrangement of sensors of water quality monitoring system (WQMM), (**b**) Lifting device. **Figure 6.** (**a**) Arrangement of sensors of water quality monitoring system (WQMM), (**b**) Lifting device.

In order to realize a three-dimensional water quality monitoring system, the proposed design uses the ZS-RE81.3i DC (direct current) motor (ZHENG KE ELECTROMOTOR, Wenzhou, China) to

the value of 60. The PID (proportion integration differentiation) algorithm is used to obtain the

2 *d r l n R* 

Because the WQMM is initially flush with the bottom of a USV, the starting position is determined by the USV's draft. The USV MCU stops the WQMM descent by stopping the motor working. When the USV arrives at a predefined location, the USV MCU computes the sinking time and the standing time of the WQMM. The water quality parameters are transmitted before the water

The water sensing data are stored in the local memory of a monitoring module. After the probe box leaves the water body, the WQMM MCU activates the wireless module to establish a wireless connection with the UVS. Then, the sensing data are transmitted to the USV via wireless links. The USV transmits the sensing data to the remote cloud server via the GPRS. The diagram of data

(5)

The upgrade device can reach different depths in the range of 0~2 m. Meanwhile, the number of revolutions (*nr*) of the motor can be calculated using the number of pulses. Assume *R* denotes the radius of the lifting gear shaft. In addition, the system can obtain the descending depth *ld* of the probe


**Table 2.** Parameters of sensors. **Table 2.** Parameters of sensors.

**Table 2.** Parameters of sensors.

**Table 2.** Parameters of sensors.

*Water* **2020**, *12*, x FOR PEER REVIEW 6 of 15

*Water* **2020**, *12*, x FOR PEER REVIEW 6 of 15

*Water* **2020**, *12*, x FOR PEER REVIEW 6 of 15

the WQMM (water quality monitoring module).

the WQMM (water quality monitoring module).

the WQMM (water quality monitoring module).

position is modified by adjusting the angle

position is modified by adjusting the angle

position is modified by adjusting the angle

**3. Water Quality Monitoring System** 

**3. Water Quality Monitoring System** 

**3. Water Quality Monitoring System** 

transmission and storage system.

transmission and storage system.

transmission and storage system.

*3.1. Water Quality Monitoring Module* 

*3.1. Water Quality Monitoring Module* 

*3.1. Water Quality Monitoring Module* 

*2.4. Wireless Communication Transmission Modules* 

*2.4. Wireless Communication Transmission Modules* 

*2.4. Wireless Communication Transmission Modules* 

from a GPS module and that of the nine-axis sensor with

from a GPS module and that of the nine-axis sensor with

from a GPS module and that of the nine-axis sensor with

Finally, when the USV reaches the next position, the water quality parameters are collected by

Finally, when the USV reaches the next position, the water quality parameters are collected by

Finally, when the USV reaches the next position, the water quality parameters are collected by

In practice, a USV is placed on a lake, and its starting point is set at a specified location. Then, water quality monitoring is completed in the cruise mode. The USV stops at each measurement point until the water quality monitoring at different depths is completed. In the above automatic cruise steps, there may be a deviation at the position level. Therefore, by comparing the position information

In practice, a USV is placed on a lake, and its starting point is set at a specified location. Then, water quality monitoring is completed in the cruise mode. The USV stops at each measurement point until the water quality monitoring at different depths is completed. In the above automatic cruise steps, there may be a deviation at the position level. Therefore, by comparing the position information

In practice, a USV is placed on a lake, and its starting point is set at a specified location. Then, water quality monitoring is completed in the cruise mode. The USV stops at each measurement point until the water quality monitoring at different depths is completed. In the above automatic cruise steps, there may be a deviation at the position level. Therefore, by comparing the position information

and distance *D*.

and distance *D*.

and distance *D*.

Two different types of wireless modules are adopted to connect to the cloud server and the WQMS, respectively. The first module uses the GPRS (general packet radio service) to realize wireless communication transmission between USV and cloud server. This technology is built based on a cellular network with a long communication distance, and it can be directly used in GSM (global system for mobile communications) or LTE (long term evolution) network. The other wireless communication transmission system is a Wi-Fi module intended for the USV and WQMM, and it uses the IEEE (institute of electrical and electronic engineers) 802.11n communication protocol.

Two different types of wireless modules are adopted to connect to the cloud server and the WQMS, respectively. The first module uses the GPRS (general packet radio service) to realize wireless communication transmission between USV and cloud server. This technology is built based on a cellular network with a long communication distance, and it can be directly used in GSM (global system for mobile communications) or LTE (long term evolution) network. The other wireless communication transmission system is a Wi-Fi module intended for the USV and WQMM, and it uses the IEEE (institute of electrical and electronic engineers) 802.11n communication protocol.

Two different types of wireless modules are adopted to connect to the cloud server and the WQMS, respectively. The first module uses the GPRS (general packet radio service) to realize wireless communication transmission between USV and cloud server. This technology is built based on a cellular network with a long communication distance, and it can be directly used in GSM (global system for mobile communications) or LTE (long term evolution) network. The other wireless communication transmission system is a Wi-Fi module intended for the USV and WQMM, and it uses the IEEE (institute of electrical and electronic engineers) 802.11n communication protocol.

The WQMS represents the key component in this study. This section introduces the main modules of the WQMS, which are the water quality monitoring module, a lifting device, and data

The WQMS represents the key component in this study. This section introduces the main modules of the WQMS, which are the water quality monitoring module, a lifting device, and data

The WQMS represents the key component in this study. This section introduces the main modules of the WQMS, which are the water quality monitoring module, a lifting device, and data

In the proposed system, the WQMM consists of an MCU, power, sensors, wireless communication module, and plastic enclosure, as demonstrated in Figure 6a. As already mentioned, the MCU of the WQMM is based on a 32-bit ARM microcontroller. The main water quality values, including the pH value, total dissolved solids (TDS) value, and turbidity value, are monitored [33]. The parameters of sensors used to measure these values, such as sensing range, accuracy, and working voltage, are presented in Table 2. The MCU of the WQMM mainly controls the water quality

In the proposed system, the WQMM consists of an MCU, power, sensors, wireless communication module, and plastic enclosure, as demonstrated in Figure 6a. As already mentioned, the MCU of the WQMM is based on a 32-bit ARM microcontroller. The main water quality values, including the pH value, total dissolved solids (TDS) value, and turbidity value, are monitored [33]. The parameters of sensors used to measure these values, such as sensing range, accuracy, and working voltage, are presented in Table 2. The MCU of the WQMM mainly controls the water quality monitoring sensor. After obtaining the relevant water quality data, the collected data are transmitted

In the proposed system, the WQMM consists of an MCU, power, sensors, wireless communication module, and plastic enclosure, as demonstrated in Figure 6a. As already mentioned, the MCU of the WQMM is based on a 32-bit ARM microcontroller. The main water quality values, including the pH value, total dissolved solids (TDS) value, and turbidity value, are monitored [33]. The parameters of sensors used to measure these values, such as sensing range, accuracy, and working voltage, are presented in Table 2. The MCU of the WQMM mainly controls the water quality monitoring sensor. After obtaining the relevant water quality data, the collected data are transmitted

*N*

*N*

*N*

and *DN* intermittently, the USV's

and *DN* intermittently, the USV's

and *DN* intermittently, the USV's

Note: <sup>1</sup> Shengzhen, China; <sup>2</sup> Luoyang, China; <sup>3</sup> Shengzhen, China. Note: <sup>1</sup> Shengzhen, China; <sup>2</sup> Luoyang, China; <sup>3</sup> Shengzhen, China. Note: <sup>1</sup> Shengzhen, China; <sup>2</sup> Luoyang, China; <sup>3</sup> Shengzhen, China. Note: <sup>1</sup> Shengzhen, China; <sup>2</sup> Luoyang, China; <sup>3</sup> Shengzhen, China.

pH sensor: The pH sensor is used to monitor the pH value of the water. Meanwhile, the determination coefficient *R*<sup>2</sup> of the calibration model of this sensor reaches a value of 0.999. The pH sensor detects the hydrogen ion concentration in a solution using a hydrogen ion glass electrode and a reference electrode that form a primary battery. During the ion exchange process, the potential difference between the electrodes is measured between the glass membrane and the hydrogen pH sensor: The pH sensor is used to monitor the pH value of the water. Meanwhile, the determination coefficient *R*<sup>2</sup> of the calibration model of this sensor reaches a value of 0.999. The pH sensor detects the hydrogen ion concentration in a solution using a hydrogen ion glass electrode and a reference electrode that form a primary battery. During the ion exchange process, the potential difference between the electrodes is measured between the glass membrane and the hydrogen pH sensor: The pH sensor is used to monitor the pH value of the water. Meanwhile, the determination coefficient *R*<sup>2</sup> of the calibration model of this sensor reaches a value of 0.999. The pH sensor detects the hydrogen ion concentration in a solution using a hydrogen ion glass electrode and a reference electrode that form a primary battery. During the ion exchange process, the potential difference between the electrodes is measured between the glass membrane and the hydrogen pH sensor: The pH sensor is used to monitor the pH value of the water. Meanwhile, the determination coefficient *R* <sup>2</sup> of the calibration model of this sensor reaches a value of 0.999. The pH sensor detects the hydrogen ion concentration in a solution using a hydrogen ion glass electrode and a reference electrode that form a primary battery. During the ion exchange process, the potential difference between the electrodes is measured between the glass membrane and the hydrogen solution to detect the hydrogen ion concentration in the solution and to determine the pH value of the solution.

TDS sensor: The working voltage of the TDS sensor is 3.3~5 V, while its measurement range and accuracy are 0~1000 ppm and ±5% F.S (full scale) (25 ◦C), respectively. There is a difference between the measured value and the true value of the TDS sensor, which is closely related to the water temperature. Therefore, the TDS sensor should be modified during practical application.

Turbidity sensor: The turbidity value is monitored based on the light transmittance and scattering rate of a liquid solution. The turbidity information is obtained by the AD (analog to digital) conversion interface in the dynamic monitoring environment. The working voltage and accuracy of turbidity sensor are 5 V and 0.75%, respectively. The response time is shorter than 500 ms.

#### *3.2. WQMM Lifting Device*

In order to realize a three-dimensional water quality monitoring system, the proposed design uses the ZS-RE81.3i DC (direct current) motor (ZHENG KE ELECTROMOTOR, Wenzhou, China) to lift and lower the water quality monitoring device. As shown in Figure 6b, the WQMM lifting device consists of a lifting gear shaft and DC motor. The voltage of the motor is 12 V, and its maximum value of revolutions per minute is 60, which indicates that the number of revolutions per minute can reach the value of 60. The PID (proportion integration differentiation) algorithm is used to obtain the desired rotating speed while the device is running.

The upgrade device can reach different depths in the range of 0~2 m. Meanwhile, the number of revolutions (*nr*) of the motor can be calculated using the number of pulses. Assume *R* denotes the radius of the lifting gear shaft. In addition, the system can obtain the descending depth *l<sup>d</sup>* of the probe box, which is given by:

$$l\_d = 2\mathfrak{n}\_r \pi \mathbb{R} \tag{5}$$

Because the WQMM is initially flush with the bottom of a USV, the starting position is determined by the USV's draft. The USV MCU stops the WQMM descent by stopping the motor working. When the USV arrives at a predefined location, the USV MCU computes the sinking time and the standing time of the WQMM. The water quality parameters are transmitted before the water monitoring.

#### *3.3. Sensing Data Transmission and Storage*

The water sensing data are stored in the local memory of a monitoring module. After the probe box leaves the water body, the WQMM MCU activates the wireless module to establish a wireless connection with the UVS. Then, the sensing data are transmitted to the USV via wireless links. The USV transmits the sensing data to the remote cloud server via the GPRS. The diagram of data transmission is shown in Figure *Water* 7. **2020**, *12*, x FOR PEER REVIEW 8 of 15

**Figure 7.** Diagram of the data transmission process. WQMM, water quality monitoring module. **Figure 7.** Diagram of the data transmission process. WQMM, water quality monitoring module.

On the open-source cloud platform, the unique data access JSON (JavaScript object notation) format message can be obtained, which is then sent to the cloud platform by the wireless module. The cloud platform parses the data and stores it. The protocol format of data access is different for each device. When a device account is created, the system automatically assigns a device ID (identifier) and an interface key (APIKEY) to the device. When data need to be transmitted to the cloud platform, a device is required to store the data. As mentioned, each device has a fixed ID and APIKEY. When sending a data request message to the cloud platform, the device ID number and APIKEY are used to access and transfer the data. On the open-source cloud platform, the unique data access JSON (JavaScript object notation) format message can be obtained, which is then sent to the cloud platform by the wireless module. The cloud platform parses the data and stores it. The protocol format of data access is different for each device. When a device account is created, the system automatically assigns a device ID (identifier) and an interface key (APIKEY) to the device. When data need to be transmitted to the cloud platform, a device is required to store the data. As mentioned, each device has a fixed ID and APIKEY. When sending a data request message to the cloud platform, the device ID number and APIKEY are used to access and transfer the data.

#### **4. Water Quality Analysis Algorithm 4. Water Quality Analysis Algorithm**

a certain class (*xi*) can be defined as follows:

occurs.

The water quality level can be determined relatively straightforward use of various parameters, including the pH value, turbidity, the total number of bacteria, oxygen content, TDS value, and others. The traditional water quality monitoring methods mainly conduct water quality testing based on water quality samples with a large number of parameters, which lacks the features of automation and high efficiency. Therefore, water quality evaluation using a small number of parameters can be an effective alternative. It was shown [34,35] that pH value was significantly positively correlated with the dissolved oxygen value, electrical conductivity, and other parameters. Besides, the turbidity promotes the growth and reproduction of bacteria and adsorption of harmful toxic inorganic and organic substances. The turbidity particles have a certain impact on human and fish health. In the water without electrolysis or acid-base treatment, the salt cations are mainly calcium and magnesium, which coincides with the definition of water hardness. Therefore, water hardness can be indirectly expressed by the TDS value. Namely, when this value changes, the water quality also changes. Therefore, in the water quality analysis system, the three parameters (pH, TDS, and turbidity) are used to assess the water quality. The water quality level can be determined relatively straightforward use of various parameters, including the pH value, turbidity, the total number of bacteria, oxygen content, TDS value, and others. The traditional water quality monitoring methods mainly conduct water quality testing based on water quality samples with a large number of parameters, which lacks the features of automation and high efficiency. Therefore, water quality evaluation using a small number of parameters can be an effective alternative. It was shown [34,35] that pH value was significantly positively correlated with the dissolved oxygen value, electrical conductivity, and other parameters. Besides, the turbidity promotes the growth and reproduction of bacteria and adsorption of harmful toxic inorganic and organic substances. The turbidity particles have a certain impact on human and fish health. In the water without electrolysis or acid-base treatment, the salt cations are mainly calcium and magnesium, which coincides with the definition of water hardness. Therefore, water hardness can be indirectly expressed by the TDS value. Namely, when this value changes, the water quality also changes. Therefore, in the water quality analysis system, the three parameters (pH, TDS, and turbidity) are used to assess the water quality.

The proposed system uses the ensemble learning method [36,37] to predict subsequent changes in water quality by analyzing the collected water quality data in order to determine the correlation between the pH, turbidity, and TDS values. The Random Forest algorithm represents a concrete implementation of the bagging method. This algorithm trains multiple decision trees and combines the results of these trees to obtain the final result. The Random Forest can be used for splitting and regression, which are used to find the best fitting parameters. Its performance mainly depends on the decision tree type. The decision tree type is selected according to the specific task. For instance, in The proposed system uses the ensemble learning method [36,37] to predict subsequent changes in water quality by analyzing the collected water quality data in order to determine the correlation between the pH, turbidity, and TDS values. The Random Forest algorithm represents a concrete implementation of the bagging method. This algorithm trains multiple decision trees and combines the results of these trees to obtain the final result. The Random Forest can be used for splitting and regression, which are used to find the best fitting parameters. Its performance mainly depends on the decision tree type. The decision tree type is selected according to the specific task. For instance, in

$$I(X \quad \mathbf{x}\_i) \qquad \log\_2 P(\mathbf{x}\_i)$$

machine learning, if a set of objects can be classified into multiple categories, then the information on

**5. Results and Analysis** 

*5.1. Sensing Results* 

quality analysis algorithm, and water quality monitoring time.

machine learning, if a set of objects can be classified into multiple categories, then the information on a certain class (*x<sup>i</sup>* ) can be defined as follows:

$$I(X = \mathbf{x}\_{i}) = -\log\_{2}P(\mathbf{x}\_{i})\tag{6}$$

where *I*(*x*) represents the information on a random variable, and *p*(*x<sup>i</sup>* ) refers to the probability that *x<sup>i</sup>* occurs. *Water* **2020**, *12*, x FOR PEER REVIEW 9 of 15

In Figure 8, the flowchart of the water quality analysis algorithm based on the Random Forest is presented. The steps of this algorithm are as follows. In Figure 8, the flowchart of the water quality analysis algorithm based on the Random Forest is presented. The steps of this algorithm are as follows.

**Figure 8.** Flowchart of the water quality analysis algorithm. *k*, the number of trees; OOB, out-of-bag. **Figure 8.** Flowchart of the water quality analysis algorithm. *k*, the number of trees; OOB, out-of-bag.

Step 1: Raw dataset is obtained by extracting the three features, namely the pH, turbidity, and TDS values. Then, these values are combined with the water quality evaluation results obtained from the historical dataset. The historical data consists of water quality parameters at different depths that are manually collected, and water quality evaluation value obtained by the average method. Step 1: Raw dataset is obtained by extracting the three features, namely the pH, turbidity, and TDS values. Then, these values are combined with the water quality evaluation results obtained from the historical dataset. The historical data consists of water quality parameters at different depths that are manually collected, and water quality evaluation value obtained by the average method.

Step 2: The data obtained in Step 1 is cleaned by retrieving and processing abnormal values of the three parameters and water quality evaluation value. Step 2: The data obtained in Step 1 is cleaned by retrieving and processing abnormal values of the three parameters and water quality evaluation value.

Step 3: The sub training set and test samples are generated for each decision tree by the bootstrap sampling technique. Step 3: The sub training set and test samples are generated for each decision tree by the bootstrap sampling technique.

Step 4: Steps 2 and 3 are repeated *k* times to construct *k* decision trees to generate random forest. Step 4: Steps 2 and 3 are repeated *k* times to construct *k* decision trees to generate random forest.

This section presents and analyzes experimental sensing results, the performance of the water

Step 5: The classification results of each decision tree for the test samples are summarized, and the class with the maximum number of votes is the final classification result. Step 5: The classification results of each decision tree for the test samples are summarized, and the class with the maximum number of votes is the final classification result.

9. For the purpose of accurate measurement of water quality parameters, the water area was gridded. Meanwhile, 100 measuring points were selected, as shown in Figure 9, and the designed USV was used to measure water parameters at three different depths, which were 10 cm, 50 cm, and 100 cm.

#### **5. Results and Analysis**

This section presents and analyzes experimental sensing results, the performance of the water quality analysis algorithm, and water quality monitoring time.

#### *5.1. Sensing Results*

The proposed design was evaluated in the aquaculture zone, and the coordinates of the position where the water quality was measured were at Lat. 21.881131, Long. 110.842761, as shown in Figure 9. For the purpose of accurate measurement of water quality parameters, the water area was gridded. Meanwhile, 100 measuring points were selected, as shown in Figure 9, and the designed USV was used to measure water parameters at three di *Water* fferent depths, which were 10 cm, 50 cm, and 100 cm. **<sup>2020</sup>**, *12*, x FOR PEER REVIEW 10 of 15

**Figure 9.** Locations of the water sample extraction. **Figure 9.** Locations of the water sample extraction.

Meanwhile, for displaying the measurement part results at different depths, we measured the water parameters at points (9, 19, 33, 47, 61, 75) at three different depth values, as shown in Figure 9. There were 18 monitoring points in the 15-square-meter area. Due to the continuity of monitored values, a spline interpolation technique was used to generate the cross-section map of each water parameter. In other words, the cross-section map denoted an objective reflection of the actual parameter values. The cross-section maps of the pH, TDS, turbidity, are presented in Figure 10. In Figure 10, it can be seen that average pH, TDS, and turbidity values were 8, 45 ppm, and 8.5 NTU, respectively. At the width from 10 to 15 m and the depth from 0 to 1 m, the pH value was greater than 9, which was beyond the safe limit. By using the proposed evaluation algorithm, it was found Meanwhile, for displaying the measurement part results at different depths, we measured the water parameters at points (9, 19, 33, 47, 61, 75) at three different depth values, as shown in Figure 9. There were 18 monitoring points in the 15-square-meter area. Due to the continuity of monitored values, a spline interpolation technique was used to generate the cross-section map of each water parameter. In other words, the cross-section map denoted an objective reflection of the actual parameter values. The cross-section maps of the pH, TDS, turbidity, are presented in Figure 10. In Figure 10, it can be seen that average pH, TDS, and turbidity values were 8, 45 ppm, and 8.5 NTU, respectively. At the width from 10 to 15 m and the depth from 0 to 1 m, the pH value was greater than 9, which was beyond the safe limit. By using the proposed evaluation algorithm, it was found that the water quality in this region was slightly polluted.

that the water quality in this region was slightly polluted.




**Depth (m)**

**Figure 10.** Cross-section maps of: (**a**) pH, (**b**) TDS, and (**c**) turbidity.

7

7.5

8

*Water* **2020**, *12*, x FOR PEER REVIEW 10 of 15

**Figure 9.** Locations of the water sample extraction.

Meanwhile, for displaying the measurement part results at different depths, we measured the water parameters at points (9, 19, 33, 47, 61, 75) at three different depth values, as shown in Figure 9. There were 18 monitoring points in the 15-square-meter area. Due to the continuity of monitored values, a spline interpolation technique was used to generate the cross-section map of each water parameter. In other words, the cross-section map denoted an objective reflection of the actual parameter values. The cross-section maps of the pH, TDS, turbidity, are presented in Figure 10. In Figure 10, it can be seen that average pH, TDS, and turbidity values were 8, 45 ppm, and 8.5 NTU, respectively. At the width from 10 to 15 m and the depth from 0 to 1 m, the pH value was greater

**Figure 10.** Cross-section maps of: (**a**) pH, (**b**) TDS, and (**c**) turbidity. **Figure 10.** Cross-section maps of: (**a**) pH, (**b**) TDS, and (**c**) turbidity.

#### *5.2. Intelligent Water Quality Analysis Algorithm*

that the water quality in this region was slightly polluted.

Model evaluation results: the Random Forest model was tested using Python 3.6 (Python Software Foundation, Wilmington, DE, USA) programming language. A total of 2870 samples corresponding to five different water quality levels were used in the experiment. The parameters of the proposed algorithm are presented in Table 3. In the learning process of the Random Forest model, 90% of the available data were selected as the training set, whereas the remaining 10% was used to test the developed model. The logistic regression and SVM methods were also used to analyze water quality, and their results were compared with the results obtained by the proposed method. In comparison, the precision, recall, and F1 measure were used because these measures are usually adopted to evaluate the performances of diffident algorithms.


**Table 3.** Random Forest parameters for water quality analysis.

The static random model was trained off-line using different values of pH, TDS, and turbidity at different depth levels as input parameters to estimate the water quality, which represented the output parameter. The evaluation indexes of different methods on the test dataset are presented in Table 4, where it can be seen that Random Forest was superior to the other two methods regarding the precision, recall, and F1 measure (H-mean). The precisions of the Random Forest, logistic regression, and SVM (support vector machine) were 92%, 39%, and 40%, respectively. In other words, among the tested methods, the proposed algorithm best evaluated the water quality on the test dataset.

'


**Table 4.** Model evaluation indexes on the test dataset.

The ROC (receiver operating characteristic) curves of different methods are presented in Figure 11, where it can be seen that the values of the area under the curve (AUC) of the Random Forest, logistic regression, and SVM were 0.6, 0.7 and 0.5, respectively. Furthermore, the AUC value of the Random Forest algorithm was larger than those of the other two methods. Thus, the Random Forest that uses only three parameters (pH, TDS, and turbidity) represents a good water quality classifier.

**Figure 11.** The ROC curves of: (**a**) logistic regression, (**b**) Random Forest, and (**c**) SVM. ROC, receiver operating characteristic; SVM, support vector machine.

Water quality classification precision: a total of two water sample sets denoted as I and II were taken at each position in different time portions, as shown in Figure 9. The water quality of these samples was extracted by laboratory analysis and then compared with the values obtained by the Random Forest, SVM, and logistic regression methods.

The comparison of actual water quality value and water quality values predicted by the SVM, logistic regression, and Random Forest methods is presented in Figure 12. For the sample set I, the precision of the proposed Random Forest algorithm was higher than 92%, and those of the SVM and logistic regression methods were less than 40% and 39.8%, respectively. For the sample set II, the proposed algorithm had a precision of more than 95%, and it outperformed the SVM and logistic regression methods. In Figure 12, it can be seen that the Random Forest algorithm was superior to the other methods regarding the precision rate. The experimental results proved the feasibility of the proposed method. Therefore, the water quality level can be accurately predicted by the Random Forest based on the pH, TDS, and turbidity values.

'

*Water* **2020**, *12*, x FOR PEER REVIEW 12 of 15

**Figure 11.** The ROC curves of: (a) logistic regression, (b) Random Forest, and (a) SVM. ROC, receiver

Water quality classification precision: a total of two water sample sets denoted as I and II were taken at each position in different time portions, as shown in Figure 9. The water quality of these samples was extracted by laboratory analysis and then compared with the values obtained by the

The comparison of actual water quality value and water quality values predicted by the SVM, logistic regression, and Random Forest methods is presented in Figure 12. For the sample set I, the precision of the proposed Random Forest algorithm was higher than 92%, and those of the SVM and logistic regression methods were less than 40% and 39.8%, respectively. For the sample set II, the proposed algorithm had a precision of more than 95%, and it outperformed the SVM and logistic regression methods. In Figure 12, it can be seen that the Random Forest algorithm was superior to

operating characteristic; SVM, support vector machine.

(c)

Random Forest, SVM, and logistic regression methods.

Forest based on the pH, TDS, and turbidity values.

**Figure 12.** Precision rate of different methods in the real experiment. **Figure 12.** Precision rate of different methods in the real experiment.

#### *5.3. Water Quality Monitoring Time 5.3. Water Quality Monitoring Time*

Under normal working conditions, the USV's moving speed could reach 0.5 m/s, and the WQMM's descending speed could reach 0.01 m/s. Therefore, these values were used in the experiment on water quality monitoring. At the above parameters, the experiment of water quality monitoring was constructed. The continuous monitoring was conducted at different depth values at 1 point (donates as C I), 5 points (donates as C II), and points (donates as C III) that were 2 m apart. The average monitoring times were obtained after the experiment was repeated three times under the same conditions. The average monitoring times of C I, C II, and C III were 400 s, 2100 s, and 4100 s, respectively. It only took three minutes from uploading the monitoring data to getting the evaluation results. The proposed system saved more than 60% of time compared with the manual Under normal working conditions, the USV's moving speed could reach 0.5 m/s, and the WQMM's descending speed could reach 0.01 m/s. Therefore, these values were used in the experiment on water quality monitoring. At the above parameters, the experiment of water quality monitoring was constructed. The continuous monitoring was conducted at different depth values at 1 point (donates as C I), 5 points (donates as C II), and points (donates as C III) that were 2 m apart. The average monitoring times were obtained after the experiment was repeated three times under the same conditions. The average monitoring times of C I, C II, and C III were 400 s, 2100 s, and 4100 s, respectively. It only took three minutes from uploading the monitoring data to getting the evaluation results. The proposed system saved more than 60% of time compared with the manual approach.

#### approach. **6. Conclusions**

In this paper, an intelligent wide-area water quality monitoring and analysis system is proposed, which represents a combination of intelligent USV, water quality monitoring module, and online water quality analysis. An unmanned system is designed to control a USV cruise automatically. By integrating the water quality sensor and lifting devices, the WQMM is designed. The ensemble learning method is proposed to analyze water quality, which provides a scientific basis for wide-area water quality testing. The experimental results demonstrate and validate that the proposed system can satisfy the requirements for water quality monitoring while improving the overall work efficiency. In the future, we will study the USV drifting control and the working performance of accuracy under different environmental conditions.

**Author Contributions:** Conceptualization, H.C. and S.W.; methodology, C.Z.; software, H.C.; validation, Z.G. All authors have read and agreed to the published version of the manuscript.

**Funding:** This work is supported by Guangzhou Science and Technology program (No. 201804010427), China.

**Conflicts of Interest:** The authors declare no conflict of interest.

#### **References**


© 2020 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).
