Autonomous Water Quality Monitoring and Water Surface Cleaning for Unmanned Surface Vehicle

Water is one of the most precious resources. However, industrial development has made water pollution a critical problem today and thus water quality monitoring and surface cleaning are essential for water resource protection. In this study, we have used the sensor fusion technology as a basis to develop a multi-function unmanned surface vehicle (MF-USV) for obstacle avoidance, water-quality monitoring, and water surface cleaning. The MF-USV comprises a USV control unit, a locomotion module, a positioning module, an obstacle avoidance module, a water quality monitoring system, a water surface cleaning system, a communication module, a power module, and a remote human–machine interface. We equip the MF-USV with the following functions: (1) autonomous obstacle detection, avoidance, and navigation positioning, (2) water quality monitoring, sampling, and positioning, (3) water surface detection and cleaning, and (4) remote navigation control and real-time information display. The experimental results verified that when the floating garbage located in the visual angle ranged from −30° to 30° on the front of the MF-USV and the distances between the floating garbage and the MF-USV were 40 and 70 cm, the success rates of floating garbage detection are all 100%. When the distance between the floating garbage and the MF-USV was 130 cm and the floating garbage was located on the left side (15°~30°), left front side (0°~15°), front side (0°), right front side (0°~15°), and the right side (15°~30°), the success rates of the floating garbage collection were 70%, 92%, 95%, 95%, and 75%, respectively. Finally, the experimental results also verified that the applications of the MF-USV and relevant algorithms to obstacle avoidance, water quality monitoring, and water surface cleaning were effective.


Introduction
Covering approximately 71% of the Earth's surface, oceans and rivers are home to billions of types of aquatic life, yet humans have not treated the aquatic environment in a friendly manner [1]. Because of human negligence, water pollution has accumulated for decades. The pollutants in water include industrial waste, sewage, radioactive materials, and plastic waste [2]. Therefore, it is necessary for researchers to develop unmanned surface vehicles (USVs), autonomous surface vehicles (ASVs), and autonomous underwater vehicles (AUVs) with lower development costs and higher resolution in time and space measurements for hydrographic measurement [3], path planning and navigation [4], obstacle avoidance [5], water quality monitoring [6], and water surface cleaning [7]. In terms of obstacle detection and avoidance, Villa et al. [5] designed a USV with a light detection and ranging (LiDAR) model to provide the obstacle information in Cartesian coordinates and proposed a line-of-sight (LOS)-based guidance, navigation, and control (GNC) algorithm to avoid obstacles. Wang et al. [8] used a navigation radar embedded on the USV to detect unknown obstacles and proposed an improved ant colony optimization (IACO) Sensors 2021, 21, 1102 3 of 21 robot to clean rubbish floating on a lake surface and utilized the Maneuvering Model Group (MMG) model approach to model hydrodynamics of the robot. Ruangpayoongsak et al. [24] developed a floating waste scooper robot for collecting plastic bottles floating on a water surface. Li et al. [25] designed a vision-based water surface garbage capture robot with the modified YOLOv3 algorithm for real-time garbage detection in dynamic aquatic environments.
In this study, we have designed a multi-function unmanned surface vehicle (MF-USV) with obstacle avoidance, water quality monitoring, and water surface cleaning functions. The MF-USV is a robotic system which is composed of a USV control unit, a locomotion module, a positioning module, an obstacle avoidance module, a water quality monitoring system, a water surface cleaning system, a communication module, a power module, and a remote human-machine interface. The MF-USV is equipped with the following functions: (1) autonomous obstacle detection, avoidance, and navigation positioning: navigating the vehicle by using the USV control unit to control the locomotion module, adopting the obstacle avoidance module to detect and avoid obstacles, and employing the positioning module to record the movement trajectory of the MF-USV. (2) Water quality monitoring, sampling, and positioning: detecting real-time water pH values, collecting water samples, and positioning the sampling points by using the water quality monitoring system. (3) Water surface detection and cleaning: detecting and collecting floating garbage on water surfaces by using the water surface cleaning system. (4) Remote navigation control and real-time information display: enabling monitors to navigate the MF-USV through the Bluetooth wireless module. In addition, the movement trajectory recorded by the global positioning system (GPS), water pH values, and positions of sampling points can be transmitted back through the communication module in real time and displayed on the remote human-machine interface. Finally, functions, types of sensors, and related obstacle avoidance, water quality monitoring, and water surface cleaning algorithms are information extracted from the existing published papers and summarized in Table 1 for straightforward comparison. Obviously, most of the existing USVs or ASVs focus on only one function of obstacle avoidance, water quality monitoring, and water surface cleaning. Hence, the purpose of this paper is to develop a MF-USV which can perform the obstacle avoidance, water quality monitoring, and water surface cleaning functions simultaneously. Table 1. Function comparison of the proposed multi-function unmanned surface vehicle (MF-USV) with some existing USVs/autonomous surface vehicles (ASVs).

Water quality monitoring
Chl-a turbidity, water dissolved oxygen, water conductivity, oxidation-reduction potential, water temperature, salinity, pH sensors -Ferri et al. [6] Obstacle avoidance Laser scanner, Sonar, Altimeter VFH + algorithm Water quality monitoring Chemical sensors (Hg, Cr, Cd, and dispersed oil) -Madeo et al. [13] Water quality monitoring pH sensor, ORP sensor, salinity sensor, dissolved oxygen probe -Cao et al. [14] Water quality monitoring pH sensor, TDS sensor, turbidity sensor Ensemble learning algorithm The rest of this paper is organized as follows. In Section 2, we introduce the prototype design of the proposed USV. The water quality monitoring and water surface cleaning methods are then described in Sections 3 and 4, respectively. The experimental results are presented in Section 5. Finally, conclusions are given in Section 6.

Prototype Design of Multi-Function Unmanned Surface Vehicle (MF-USV)
The overall architecture design of the proposed MF-USV is shown in Figure 1. The MF-USV weights 3.025 kg, and its dimension is 0.74 m (length) × 0.3 m (width) × 0.28 m (height). The draft of the USV is 0.15 m and its maximum cruise speed is 0.15 m/s. The MF-USV architecture is composed of: (1) a main control unit, (2) a locomotion module, (3) a positioning module, (4) an obstacle avoidance module, (5) a water quality monitoring system, (6) a water surface cleaning system, (7) a communication module, (8) a power module, and (9) a remote human-machine interface, as shown in Figure 2. The different modules of the proposed MF-USV are detailed in Table 2. The rest of this paper is organized as follows. In Section 2, we introduce the prototype design of the proposed USV. The water quality monitoring and water surface cleaning methods are then described in Sections 3 and 4, respectively. The experimental results are presented in Section 5. Finally, conclusions are given in Section 6.

Prototype Design of Multi-Function Unmanned Surface Vehicle (MF-USV)
The overall architecture design of the proposed MF-USV is shown in Figure 1. The MF-USV weights 3.025 kg, and its dimension is 0.74 m (length) 0.3 m (width) 0.28 m (height). The draft of the USV is 0.15 m and its maximum cruise speed is 0.15 m/sec. The MF-USV architecture is composed of: (1) a main control unit, (2) a locomotion module, (3) a positioning module, (4) an obstacle avoidance module, (5) a water quality monitoring system, (6) a water surface cleaning system, (7) a communication module, (8) a power module, and (9) a remote human-machine interface, as shown in Figure 2. The different modules of the proposed MF-USV are detailed in Table 2.

USV Main Control Unit
The main control unit used in the MF-USV are two Arduino MEGA 2560 microcontrollers which are based on an AVR®8-Bit Microcontroller at 16 MHz. The first Arduino MEGA 2560 microcontroller is responsible for locomotion, obstacle avoidance, and water surface cleaning tasks, while the second one is responsible for navigation positioning and water quality monitoring tasks. The MF-USV control unit is directly connected to the locomotion module, positioning module, obstacle avoidance module, water quality monitoring system, water surface cleaning system, communication module, and power module. Moreover, the MF-USV can transmit the multi-sensing data to the remote human-machine interface through two Bluetooth wireless modules for monitoring the movement trajectory of the MF-USV, the water pH values, and the water sampling positions.

Locomotion Module
The locomotion module mounted on the MF-USV is composed of an electric propeller controlled by a direct current (DC) motor (HMS-RF-240) and a rudder controlled by a servo motor (MG996R), as shown in Figure 3. The DC and servo motors are both driven by a motor drive module (L298N) through the Arduino MEGA 2560 microcontroller. The DC motor connects with the electric propeller through the coupling for controlling the propulsion speed. The servo motor controls the steering blade connected to the rudder for controlling the propulsion direction.
peller controlled by a direct current (DC) motor (HMS-RF-240) and a rudder controlled by a servo motor (MG996R), as shown in Figure 3. The DC and servo motors are both driven by a motor drive module (L298N) through the Arduino MEGA 2560 microcontroller. The DC motor connects with the electric propeller through the coupling for controlling the propulsion speed. The servo motor controls the steering blade connected to the rudder for controlling the propulsion direction.

Positioning Module
The positioning module mounted on the MF-USV is the GY-GPS6MV2 GPS Module (as shown in Table 3), which is used to generate the movement trajectory of the MF-USV during the voyage and record the position coordinates of the water sampling points. The GPS module utilizes the NEO-6M GPS receiver manufactured by U-Blox to provide time-to-first-fix (TTFF) acquisition of less than 1 second, which is composed of an antennae

Positioning Module
The positioning module mounted on the MF-USV is the GY-GPS6MV2 GPS Module (as shown in Table 3), which is used to generate the movement trajectory of the MF-USV during the voyage and record the position coordinates of the water sampling points. The GPS module utilizes the NEO-6M GPS receiver manufactured by U-Blox to provide time-to-first-fix (TTFF) acquisition of less than 1 second, which is composed of an antennae and a radio frequency (RF) satellite signal receiver, an interface device equipped with a microprocessor, and a base band processor for processing GPS signal. The Arduino MEGA 2560 microcontroller can read GPS coordinates of the MF-USV and water sampling points through the UART protocol and then send them to the remote human-machine interface through the communication module in real time. For our propose, we used the Recommended Minimum Specific GPS/TRANSIT Data ($GPRMC) output sentence to extract the travel time and local coordinates (latitude and longitude). and a radio frequency (RF) satellite signal receiver, an interface device equipped with a microprocessor, and a base band processor for processing GPS signal. The Arduino MEGA 2560 microcontroller can read GPS coordinates of the MF-USV and water sampling points through the UART protocol and then send them to the remote human-machine interface through the communication module in real time. For our propose, we used the Recommended Minimum Specific GPS/TRANSIT Data ($GPRMC) output sentence to extract the travel time and local coordinates (latitude and longitude).

Obstacle Avoidance Module
The obstacle avoidance module used in this paper is composed of two HC-SR04 ultrasonic sensors (as shown in Table 3), which are mounted on the left and right front of the MF-USV and provide a sensor detecting 15 degrees in front of it, as shown in Figure 4. The Arduino MEGA 2560 microcontroller can obtain the distance between the vehicle and obstacles in real time, which are detected by the ultrasonic sensors. Once the distance is greater or less than the threshold values, the MF-USV executes a threshold-based obstacle avoidance algorithm to avoid obstacle collision. The proposed threshold-based obstacle avoidance algorithm is shown in Figure 5

Obstacle Avoidance Module
The obstacle avoidance module used in this paper is composed of two HC-SR04 ultrasonic sensors (as shown in Table 3), which are mounted on the left and right front of the MF-USV and provide a sensor detecting 15 degrees in front of it, as shown in Figure 4. The Arduino MEGA 2560 microcontroller can obtain the distance between the vehicle and obstacles in real time, which are detected by the ultrasonic sensors. Once the distance is greater or less than the threshold values, the MF-USV executes a threshold-based obstacle avoidance algorithm to avoid obstacle collision. The proposed threshold-based obstacle avoidance algorithm is shown in Figure 5. The first of the threshold-based algorithms calculates the distances of the obstacle in the left and right front of the vehicle (DL and DR) using the ultrasonic sensors mounted on the left and right front of the MF-USV. Subse-

Obstacle Avoidance Module
The obstacle avoidance module used in this paper is composed of two HC-SR04 ultrasonic sensors (as shown in Table 3), which are mounted on the left and right front of the MF-USV and provide a sensor detecting 15 degrees in front of it, as shown in Figure 4. The Arduino MEGA 2560 microcontroller can obtain the distance between the vehicle and obstacles in real time, which are detected by the ultrasonic sensors. Once the distance is greater or less than the threshold values, the MF-USV executes a threshold-based obstacle avoidance algorithm to avoid obstacle collision. The proposed threshold-based obstacle avoidance algorithm is shown in Figure 5. The first of the threshold-based algorithms calculates the distances of the obstacle in the left and right front of the vehicle (DL and DR) using the ultrasonic sensors mounted on the left and right front of the MF-USV. Subsequently, there are four situations for obstacle collision avoidance: (1) go straight ahead:

Obstacle Avoidance Module
The obstacle avoidance module used in this paper is composed of two HC-SR04 ultrasonic sensors (as shown in Table 3), which are mounted on the left and right front of the MF-USV and provide a sensor detecting 15 degrees in front of it, as shown in Figure 4. The Arduino MEGA 2560 microcontroller can obtain the distance between the vehicle and obstacles in real time, which are detected by the ultrasonic sensors. Once the distance is greater or less than the threshold values, the MF-USV executes a threshold-based obstacle avoidance algorithm to avoid obstacle collision. The proposed threshold-based obstacle avoidance algorithm is shown in Figure 5. The first of the threshold-based algorithms calculates the distances of the obstacle in the left and right front of the vehicle (DL and DR) using the ultrasonic sensors mounted on the left and right front of the MF-USV. Subsequently, there are four situations for obstacle collision avoidance: (1) go straight ahead:

Obstacle Avoidance Module
The obstacle avoidance module used in this paper is composed of two HC-SR04 ultrasonic sensors (as shown in Table 3), which are mounted on the left and right front of the MF-USV and provide a sensor detecting 15 degrees in front of it, as shown in Figure 4. The Arduino MEGA 2560 microcontroller can obtain the distance between the vehicle and obstacles in real time, which are detected by the ultrasonic sensors. Once the distance is greater or less than the threshold values, the MF-USV executes a threshold-based obstacle avoidance algorithm to avoid obstacle collision. The proposed threshold-based obstacle avoidance algorithm is shown in Figure 5. The first of the threshold-based algorithms calculates the distances of the obstacle in the left and right front of the vehicle (D L and D R ) using the ultrasonic sensors mounted on the left and right front of the MF-USV. Subsequently, there are four situations for obstacle collision avoidance: (1) go straight ahead: when (D L > 65 cm or D L ≤ 10 cm) and (D R > 65 cm or D R ≤ 10 cm), the algorithm determines that there is no any obstacle on the front of the vehicle, and then the MF-USV goes straight ahead. (2) Turn right: when (10 cm < D L ≤ 65 cm) and (D R > 65 cm or D R ≤ 10 cm), the algorithm determines that there is an obstacle on the left front side of the vehicle, and then the MF-USV drives the servo motor (MG996R) in the locomotion module to control the rudder to turn right. (3) Turn left: when (D L > 65 cm or D L ≤ 10 cm) and (10 cm < D R ≤ 65 cm), the algorithm determines that there is an obstacle on the right front side of the vehicle, and then the MF-USV drives the servo motor (MG996R) in the locomotion module to control the rudder to turn left. (4) Turn around: when (10 cm < D L ≤ 65 cm) and (10 cm < D R ≤ 65 cm), the algorithm determines that there is an obstacle on the front of the vehicle, and then the MF-USV drives the servo motor (MG996R) in the locomotion module to control the rudder to turn around 180 • .

Power Module and Communication Module
The MF-USV is powered by a 6 V lead-acid battery with a nominal capacity of 2.3 ampere-hour (Ah). The communication module includes two HC-08 Bluetooth wireless modules, which have low-power data transmission property and are operated in the V4.0 BLE Bluetooth protocol. The Arduino MEGA 2560 microcontroller embedded on the

Power Module and Communication Module
The MF-USV is powered by a 6 V lead-acid battery with a nominal capacity of 2.3 ampere-hour (Ah). The communication module includes two HC-08 Bluetooth wireless

Power Module and Communication Module
The MF-USV is powered by a 6 V lead-acid battery with a nominal capacity of 2.3 ampere-hour (Ah). The communication module includes two HC-08 Bluetooth wireless modules, which have low-power data transmission property and are operated in the V4.0 BLE Bluetooth protocol. The Arduino MEGA 2560 microcontroller embedded on the MF-USV transmits the GPS coordinates of the MF-USV and water sampling points, and the water pH values in different water sampling points to the remote human-machine interface through the Bluetooth wireless modules.

Remote Human-Machine Interface
The remote human-machine interface shown in Figure 6 is developed with the Lab-VIEW graphical programming environment, which can receive the GPS coordinates of the MF-USV and water sampling points, and the water pH values in different water sampling points from the MF-USV through the Bluetooth wireless modules. The remote humanmachine interface is divided into the following operation interfaces: (1) system operating interface: the user can choose a series COM port to receive the measurement signals and set a storage path for storing them. In addition, the travel time of the MF-USV is also displayed. (2) Manual control interface: the user can manually control the MF-USV to go ahead, turn left, turn right, and turn around, respectively. In addition, the user can click the stop button to stop the MF-USV sailing.

Water Quality Monitoring System
The water quality monitoring system consists of a SEN0161 pH sensor (as shown in Table 3), a GPS module, and a water sample collection device, as shown in Figure 7. The water sample collection device is designed for collecting water samples, which is composed of a water pump (R385), two electromagnetic valves, and two sampling bottles, as shown in Figure 8. Figure 9 shows the circuit diagram of the water quality monitoring system mounted on the MF-USV. The water quality monitoring process is shown in Figure 10. The pH sensor mounted on the MF-USV is used to detect the pH value of the water during sailing, which is then sent to the remote human-machine interface in real

Water Quality Monitoring System
The water quality monitoring system consists of a SEN0161 pH sensor (as shown in Table 3), a GPS module, and a water sample collection device, as shown in Figure 7. The water sample collection device is designed for collecting water samples, which is composed of a water pump (R385), two electromagnetic valves, and two sampling bottles, as shown in Figure 8. Figure 9 shows the circuit diagram of the water quality monitoring system mounted on the MF-USV. The water quality monitoring process is shown in Figure 10. The pH sensor mounted on the MF-USV is used to detect the pH value of the water during sailing, which is then sent to the remote human-machine interface in real time. According to the surface water classification and water quality standards of the Taiwan Environmental Protection Administration (EPA), the pH values of the water quality should be between 6.5 and 8.5, which comply with the class A terrestrial surface water quality standards [26]. Once the water pH value is higher than 8.5 or lower than 6.5, that means that the water on the present position is contaminated, the water pump is driven to extract the water for cleaning residual liquid in the pumping pipe. Subsequently, the water in the present position is sampled by the water pump through the pumping pipe. Then, the first electromagnetic valve is turn on for collecting the sampling water into the first sampling bottle. Simultaneously, the position coordinate of the present water sampling point measured by the GPS module is also recorded and sent to the remote human-machine interface through the Bluetooth wireless module. When the present water sampling task is finished, the water pump and the first electromagnetic valve are turned off, and the MF-USV leaves the present water sampling point to search the next contaminated water point. Once the pH value of the water in the next position is abnormal, the water sampling procedure is the same as the first sampling procedure. After the water quality monitoring task is completed, the MF-USV can automatically return to the initial location. The collected water samples are later analyzed in specialized laboratories. present water sampling point measured by the GPS module is also recorded and sent to the remote human-machine interface through the Bluetooth wireless module. When the present water sampling task is finished, the water pump and the first electromagnetic valve are turned off, and the MF-USV leaves the present water sampling point to search the next contaminated water point. Once the pH value of the water in the next position is abnormal, the water sampling procedure is the same as the first sampling procedure.
After the water quality monitoring task is completed, the MF-USV can automatically return to the initial location. The collected water samples are later analyzed in specialized laboratories.  present water sampling point measured by the GPS module is also recorded and sent to the remote human-machine interface through the Bluetooth wireless module. When the present water sampling task is finished, the water pump and the first electromagnetic valve are turned off, and the MF-USV leaves the present water sampling point to search the next contaminated water point. Once the pH value of the water in the next position is abnormal, the water sampling procedure is the same as the first sampling procedure.
After the water quality monitoring task is completed, the MF-USV can automatically return to the initial location. The collected water samples are later analyzed in specialized laboratories.

Water Surface Cleaning System
The water surface cleaning system shown in Figure 11 consists of a Pixy CMUcam5 vision sensor (as shown in Table 3) and a water surface cleaning device. The Pixy CMUcam5 vision sensor is composed of a dual core processor NXP LPC4330 at 204MHz, an OmniVision image sensor, a 264K bytes RAM, and a 1M bytes Flash, with UART, SPI,

Water Surface Cleaning System
The water surface cleaning system shown in Figure 11 consists of a Pixy CMUcam5 vision sensor (as shown in Table 3) and a water surface cleaning device. The Pixy CMUcam5 vision sensor is composed of a dual core processor NXP LPC4330 at 204MHz, an OmniVision image sensor, a 264K bytes RAM, and a 1M bytes Flash, with UART, SPI,

Water Surface Cleaning System
The water surface cleaning system shown in Figure 11 consists of a Pixy CMUcam5 vision sensor (as shown in Table 3) and a water surface cleaning device. The Pixy CMU-cam5 vision sensor is composed of a dual core processor NXP LPC4330 at 204MHz, an OmniVision image sensor, a 264K bytes RAM, and a 1M bytes Flash, with UART, SPI, I 2 C, and universal serial bus (USB) communication interfaces. The Pixy CMUcam5 vision sensor is utilized to detect objects by using a hue-based color filtering algorithm, which is called the color connected components (CCC) algorithm and implemented in the C/C++ programming language and on the processor NXP LPC4330. Since the hue-based color filtering methods are fast, efficient, and relatively robust, they are popular. The hue-based color filtering algorithm calculates the hue (color) and saturation of each red, green, and blue (RGB) pixel derived from the image sensor and uses these as the primary filtering parameters. The hue of the object remains basically unchanged under changes in lighting and exposure [27]. In this paper, a red color object is selected to represent the floating garbage to perform the water surface cleaning task because of its distinct colour for it can be easily distinguished from its surroundings. Hence, when the hue-based color filtering algorithm is utilized to detect the floating garbage, the MF-USV can detect it correctly. The water surface cleaning device is designed for cleaning and collecting the floating garbage, which is composed of two DC gear motors (HN35GBE-1640Y) and a salvage net. The DC gear motors are driven by a motor drive module (L298N) through the Arduino MEGA 2560 microcontroller, which are utilized to control the salvage net to rise and drop via the bobbins for collecting the floating garbage. Figure 12 shows the circuit diagram of the water surface cleaning system mounted on the MF-USV.
Sensors 2021, 21, x FOR PEER REVIEW 12 of 21 I 2 C, and universal serial bus (USB) communication interfaces. The Pixy CMUcam5 vision sensor is utilized to detect objects by using a hue-based color filtering algorithm, which is called the color connected components (CCC) algorithm and implemented in the C/C++ programming language and on the processor NXP LPC4330. Since the hue-based color filtering methods are fast, efficient, and relatively robust, they are popular. The hue-based color filtering algorithm calculates the hue (color) and saturation of each red, green, and blue (RGB) pixel derived from the image sensor and uses these as the primary filtering parameters. The hue of the object remains basically unchanged under changes in lighting and exposure [27]. In this paper, a red color object is selected to represent the floating garbage to perform the water surface cleaning task because of its distinct colour for it can be easily distinguished from its surroundings. Hence, when the hue-based color filtering algorithm is utilized to detect the floating garbage, the MF-USV can detect it correctly. The water surface cleaning device is designed for cleaning and collecting the floating garbage, which is composed of two DC gear motors (HN35GBE-1640Y) and a salvage net. The DC gear motors are driven by a motor drive module (L298N) through the Arduino MEGA 2560 microcontroller, which are utilized to control the salvage net to rise and drop via the bobbins for collecting the floating garbage. Figure 12 shows the circuit diagram of the water surface cleaning system mounted on the MF-USV.   Sensors 2021, 21, x FOR PEER REVIEW 12 of 21 I 2 C, and universal serial bus (USB) communication interfaces. The Pixy CMUcam5 vision sensor is utilized to detect objects by using a hue-based color filtering algorithm, which is called the color connected components (CCC) algorithm and implemented in the C/C++ programming language and on the processor NXP LPC4330. Since the hue-based color filtering methods are fast, efficient, and relatively robust, they are popular. The hue-based color filtering algorithm calculates the hue (color) and saturation of each red, green, and blue (RGB) pixel derived from the image sensor and uses these as the primary filtering parameters. The hue of the object remains basically unchanged under changes in lighting and exposure [27]. In this paper, a red color object is selected to represent the floating garbage to perform the water surface cleaning task because of its distinct colour for it can be easily distinguished from its surroundings. Hence, when the hue-based color filtering algorithm is utilized to detect the floating garbage, the MF-USV can detect it correctly. The water surface cleaning device is designed for cleaning and collecting the floating garbage, which is composed of two DC gear motors (HN35GBE-1640Y) and a salvage net. The DC gear motors are driven by a motor drive module (L298N) through the Arduino MEGA 2560 microcontroller, which are utilized to control the salvage net to rise and drop via the bobbins for collecting the floating garbage. Figure 12 shows the circuit diagram of the water surface cleaning system mounted on the MF-USV.   For the water surface cleaning task, we utilize the Pixy CMUcam5 vision sensor to detect the floating garbage (red color objects). When the vision sensor mounted on the front of the MF-USV detects floating garbage, the MF-USV can automatically track and collect the floating garbage through the water surface cleaning algorithm. The Pixy CMUcam5 vision sensor defines that the X and Y coordinates of the image ranged from 0 to 319 and from 0 to 199, as shown in Figure 13. The water surface cleaning algorithm is shown in Figure 14 In this way, the floating garbage will be on the front of the vehicle until that is collected by the water surface cleaning device. Finally, once the floating garbage is collected in the salvage net, the water surface cleaning task is completed. For the water surface cleaning task, we utilize the Pixy CMUcam5 vision sensor to detect the floating garbage (red color objects). When the vision sensor mounted on the front of the MF-USV detects floating garbage, the MF-USV can automatically track and collect the floating garbage through the water surface cleaning algorithm. The Pixy CMUcam5 vision sensor defines that the X and Y coordinates of the image ranged from 0 to 319 and from 0 to 199, as shown in Figure 13. The water surface cleaning algorithm is shown in Figure 14 x 319, the algorithm determines that there is floating garbage on the right side of the vehicle, and then the MF-USV drives the servo motor (MG996R) in the locomotion module to control the rudder to turn right about 30°. In this way, the floating garbage will be on the front of the vehicle until that is collected by the water surface cleaning device. Finally, once the floating garbage is collected in the salvage net, the water surface cleaning task is completed.

Experimental Results
The MF-USV was designed to avoid the obstacles, monitor the water quality, and clean the floating garbage. Field experiments were conducted on 15-18 January 2019 in the shallow Chia-Ming Lake, Taichung, Taiwan, to evaluate the performance of the MF-USV.
The tests were divided into four parts: obstacle avoidance, water quality monitoring, water surface cleaning, and autonomous navigation. These tasks could be performed separately or simultaneously. Figure 15 shows the boat body of the MF-USV which is composed of the main control unit, locomotion module, positioning module (GPS module), obstacle avoidance module (ultrasonic sensors), water quality monitoring system (pH sensor and water sample collection device), water surface cleaning system (vision sensor and water surface cleaning device), communication module (Bluetooth wireless module), power module, and remote human-machine interface.

Experimental Results
The MF-USV was designed to avoid the obstacles, monitor the water quality, and clean the floating garbage. Field experiments were conducted on 15-18 January 2019 in the shallow Chia-Ming Lake, Taichung, Taiwan, to evaluate the performance of the MF-USV.
The tests were divided into four parts: obstacle avoidance, water quality monitoring, water surface cleaning, and autonomous navigation. These tasks could be performed separately or simultaneously. Figure 15 shows the boat body of the MF-USV which is composed of the main control unit, locomotion module, positioning module (GPS module), obstacle avoidance module (ultrasonic sensors), water quality monitoring system (pH sensor and water sample collection device), water surface cleaning system (vision sensor and water surface cleaning device), communication module (Bluetooth wireless module), power module, and remote human-machine interface.

Obstacle Avoidance
The test was conducted to check the capability of the obstacle avoidance of the MF-USV. The obstacle avoidance module of the MF-USV composed of two HC-SR04 ultrasonic sensors is designed for detecting and avoiding obstacles. Once the distances measured by the ultrasonic sensors are greater or less than the threshold values, the MF-USV executes a threshold-based obstacle avoidance algorithm to avoid obstacle collision. When ( 65 cm) and ( 65 cm), the threshold-based obstacle avoidance algorithm determines that there is no any obstacle on the front of the vehicle, and then the MF-USV goes straight ahead, as shown in Figure 16a. Subsequently, when ( > 65 cm) and (10 cm < ≤ 65 cm), the threshold-based obstacle avoidance algorithm determines that there is an obstacle on the right front side of the vehicle, as shown in Figure  16b. Then, the MF-USV drives the servo motor (MG996R) in the locomotion module to control the rudder to turn left, as shown in Figure 16c,d. Once the MF-USV has avoided the obstacle successfully, the distances are measured as ( 65 cm) and ( 65 cm), the threshold-based obstacle avoidance algorithm determines that there is no any obsta-

Obstacle Avoidance
The test was conducted to check the capability of the obstacle avoidance of the MF-USV. The obstacle avoidance module of the MF-USV composed of two HC-SR04 ultrasonic sensors is designed for detecting and avoiding obstacles. Once the distances measured by the ultrasonic sensors are greater or less than the threshold values, the MF-USV executes a threshold-based obstacle avoidance algorithm to avoid obstacle collision. When (D L > 65 cm) and (D R > 65 cm), the threshold-based obstacle avoidance algorithm determines that there is no any obstacle on the front of the vehicle, and then the MF-USV goes straight ahead, as shown in Figure 16a. Subsequently, when (D L > 65 cm) and (10 cm < D R ≤ 65 cm), the threshold-based obstacle avoidance algorithm determines that there is an obstacle on the right front side of the vehicle, as shown in Figure 16b. Then, the MF-USV drives the servo motor (MG996R) in the locomotion module to control the rudder to turn left, as shown in Figure 16c

Water Quality Monitoring
The test was conducted to check the capability of water quality monitoring and water sample collection by the MF-USV. The water quality monitoring system of the MF-USV composed of the pH sensor, GPS module, and water sample collection device is designed for monitoring water quality and collecting water samples. The pH sensor and GPS module mounted on the MF-USV were used to detect the pH values of the water and position coordinates during sailing in real time, respectively. When the water quality was normal (6.5 pH 8.5), the MF-USV can automatically or manually sail on the lake and the sailing position coordinates measured by the GPS module was recorded and sent to the remote human-machine interface through the Bluetooth wireless module, as shown in Figure 17. When the water pH value at the first location (as shown in Figure 17b) was higher than 8.5 or lower than 6.5, which represented that the present water field was contaminated and the water pump was driven to extract the water for cleaning residual liquid in the pumping pipe. Then, the water on the present position was sampled by the water pump through the pumping pipe and the first electromagnetic valve was turned on to collect the sampling water in the first sampling bottle. The water level of the first sampling bottle was increased from Figure 18a to Figure 18b. In addition, the position coordinate of the present water sampling point measured by the GPS module was simultaneously recorded and sent to the remote human-machine interface. Finally, the water pump and first electromagnetic valve were turned off to finish the first water sampling task. The MF-USV leaved the present water sampling point and went ahead to search the next contaminated water point, as shown in Figure 17c,d. Once the contaminated water field at the second location (as shown in Figure 17e) was detected by the pH sensor, whose pH value was higher than 8.5 or lower than 6.5, the residual liquid in the pumping pipe was cleaned by the water extracted by the water pump. Subsequently, the water on the second water sampling position was sampled by the water pump through the pumping pipe and the second electromagnetic valve was turned on to collect the sampling water in the second sampling bottle. The water level of the second sampling bottle was increased from Figure 18c to Figure 18d. Additionally, the position coordinate of the second water sampling point measured by the GPS module was simultaneously recorded and sent to the remote human-machine interface. Finally, the water pump and second electromag-

Water Quality Monitoring
The test was conducted to check the capability of water quality monitoring and water sample collection by the MF-USV. The water quality monitoring system of the MF-USV composed of the pH sensor, GPS module, and water sample collection device is designed for monitoring water quality and collecting water samples. The pH sensor and GPS module mounted on the MF-USV were used to detect the pH values of the water and position coordinates during sailing in real time, respectively. When the water quality was normal (6.5 ≤ pH ≤ 8.5), the MF-USV can automatically or manually sail on the lake and the sailing position coordinates measured by the GPS module was recorded and sent to the remote human-machine interface through the Bluetooth wireless module, as shown in Figure 17. When the water pH value at the first location (as shown in Figure 17b) was higher than 8.5 or lower than 6.5, which represented that the present water field was contaminated and the water pump was driven to extract the water for cleaning residual liquid in the pumping pipe. Then, the water on the present position was sampled by the water pump through the pumping pipe and the first electromagnetic valve was turned on to collect the sampling water in the first sampling bottle. The water level of the first sampling bottle was increased from Figure 18a to Figure 18b. In addition, the position coordinate of the present water sampling point measured by the GPS module was simultaneously recorded and sent to the remote human-machine interface. Finally, the water pump and first electromagnetic valve were turned off to finish the first water sampling task. The MF-USV leaved the present water sampling point and went ahead to search the next contaminated water point, as shown in Figure 17c,d. Once the contaminated water field at the second location (as shown in Figure 17e) was detected by the pH sensor, whose pH value was higher than 8.5 or lower than 6.5, the residual liquid in the pumping pipe was cleaned by the water extracted by the water pump. Subsequently, the water on the second water sampling position was sampled by the water pump through the pumping pipe and the second electromagnetic valve was turned on to collect the sampling water in the second sampling bottle. The water level of the second sampling bottle was increased from Figure 18c to Figure 18d. Additionally, the position coordinate of the second water sampling point measured by the GPS module was simultaneously recorded and sent to the remote human-machine interface. Finally, the water pump and second electromagnetic valve were turned off to finish the second water sampling task. After the water quality monitoring task was completed, the water samples were conveyed to the initial location and later analyzed in specialized laboratories, as shown in Figure 17f. netic valve were turned off to finish the second water sampling task. After the water quality monitoring task was completed, the water samples were conveyed to the initial location and later analyzed in specialized laboratories, as shown in Figure 17f.

Water Surface Cleaning
The test was conducted to check the capability of the floating garbage detection and water surface cleaning of the MF-USV. The water surface cleaning system of the MF-USV composed of the vision sensor and water surface cleaning device is designed for detecting and cleaning the floating garbage. The vision sensor and its hue-based color filtering algorithm were used to detect the floating garbage on water surface in real time. When the floating garbage was detected, the MF-USV can automatically track and collect the floating garbage by using the water surface cleaning algorithm. When the vision sensor mounted on the front of the MF-USV detected the first floating garbage, which is on the left front side of the vehicle, the MF-USV could drive the servo motor (MG996R) in the locomotion module to control the rudder to turn left about 15° for tracking the first floating garbage, as shown in Figure 19a. Subsequently, the water surface cleaning device turned on the DC gear motors to control the salvage net for collecting the first floating garbage, as shown in netic valve were turned off to finish the second water sampling task. After the water quality monitoring task was completed, the water samples were conveyed to the initial location and later analyzed in specialized laboratories, as shown in Figure 17f.

Water Surface Cleaning
The test was conducted to check the capability of the floating garbage detection and water surface cleaning of the MF-USV. The water surface cleaning system of the MF-USV composed of the vision sensor and water surface cleaning device is designed for detecting and cleaning the floating garbage. The vision sensor and its hue-based color filtering algorithm were used to detect the floating garbage on water surface in real time. When the floating garbage was detected, the MF-USV can automatically track and collect the floating garbage by using the water surface cleaning algorithm. When the vision sensor mounted on the front of the MF-USV detected the first floating garbage, which is on the left front side of the vehicle, the MF-USV could drive the servo motor (MG996R) in the locomotion module to control the rudder to turn left about 15° for tracking the first floating garbage, as shown in Figure 19a. Subsequently, the water surface cleaning device turned on the DC gear motors to control the salvage net for collecting the first floating garbage, as shown in

Water Surface Cleaning
The test was conducted to check the capability of the floating garbage detection and water surface cleaning of the MF-USV. The water surface cleaning system of the MF-USV composed of the vision sensor and water surface cleaning device is designed for detecting and cleaning the floating garbage. The vision sensor and its hue-based color filtering algorithm were used to detect the floating garbage on water surface in real time. When the floating garbage was detected, the MF-USV can automatically track and collect the floating garbage by using the water surface cleaning algorithm. When the vision sensor mounted on the front of the MF-USV detected the first floating garbage, which is on the left front side of the vehicle, the MF-USV could drive the servo motor (MG996R) in the locomotion module to control the rudder to turn left about 15 • for tracking the first floating garbage, as shown in Figure 19a. Subsequently, the water surface cleaning device turned on the DC gear motors to control the salvage net for collecting the first floating garbage, as shown in Figure 19b. Then, the vision sensor mounted on the MF-USV detected the second floating garbage on the left front side of the vehicle, the MF-USV could drive the servo motor (MG996R) in the locomotion module to control the rudder to turn left about 15 • for tracking the second floating garbage, as shown in Figure 19c. Subsequently, the water surface cleaning device was used to collect the second floating garbage, as shown in Figure  19d. Then, the vision sensor mounted on the MF-USV detected the third floating garbage on the left side of the vehicle, the MF-USV could drive the servo motor (MG996R) in the locomotion module to control the rudder to turn left about 30 • for tracking the third floating garbage, as shown in Figure 19e. Finally, the third floating garbage was collected by the water surface cleaning device, as shown in Figure 19f.  Figure 19c. Subsequently, the water surface cleaning device was used to collect the second floating garbage, as shown in Figure 19d. Then, the vision sensor mounted on the MF-USV detected the third floating garbage on the left side of the vehicle, the MF-USV could drive the servo motor (MG996R) in the locomotion module to control the rudder to turn left about 30° for tracking the third floating garbage, as shown in Figure 19e. Finally, the third floating garbage was collected by the water surface cleaning device, as shown in Figure 19f.  Table 4 shows the success rates of floating garbage detection by the Pixy CMUcam5 vision sensor with its hue-based color filtering algorithm. When the floating garbage located in the visual angle ranged from -30° to 30° on the front of the MF-USV and the distances between the floating garbage and the MF-USV were 40 and 70 cm, the success rates of floating garbage detection were all 100%. When the floating garbage was located in front of the MF-USV (visual angle = 0°), we obtained better success rates regardless the distance between the floating garbage and the MF-USV. On the other hand, worse success rates were obtained when the floating garbage was located in a larger visual angle and at a longer distance from the front of the MF-USV. Table 5 shows the success rates of floating garbage collection when the distance between the floating garbage and the MF-USV was 130 cm. When the floating garbage was located on the left side (15°~30°), left front side (0°~15°), front side (0°), right front side (0°~15°), and the right side (15°~30°), the success rates of the floating garbage collection were 70%, 92%, 95%, 95%, and 75%, respectively.  Table 4 shows the success rates of floating garbage detection by the Pixy CMUcam5 vision sensor with its hue-based color filtering algorithm. When the floating garbage located in the visual angle ranged from -30 • to 30 • on the front of the MF-USV and the distances between the floating garbage and the MF-USV were 40 and 70 cm, the success rates of floating garbage detection were all 100%. When the floating garbage was located in front of the MF-USV (visual angle = 0 • ), we obtained better success rates regardless the distance between the floating garbage and the MF-USV. On the other hand, worse success rates were obtained when the floating garbage was located in a larger visual angle and at a longer distance from the front of the MF-USV. Table 5 shows the success rates of floating garbage collection when the distance between the floating garbage and the MF-USV was 130 cm. When the floating garbage was located on the left side (15 •~3 0 • ), left front side (0 •~1 5 • ), front side (0 • ), right front side (0 •~1 5 • ), and the right side (15 •~3 0 • ), the success rates of the floating garbage collection were 70%, 92%, 95%, 95%, and 75%, respectively.

Multi-Function Tests
The test was conducted to check the capability of the obstacle avoidance, water quality monitoring, and water surface cleaning of the MF-USV simultaneously. At first, the MF-USV sailed on the lake automatically and executed the obstacle avoidance task by using the threshold-based obstacle avoidance algorithm, as shown in Figure 20a. Subsequently, when the quality of water was abnormal, the MF-USV could collect the water sample in the water bottle and record the position coordinate at the present water sampling point, as shown in Figure 20b. Then, when the floating garbage was detected, the MF-USV could collect and clean the floating garbage by using the water surface cleaning algorithm, as shown in Figure 20c. Finally, after the water quality monitoring and water surface cleaning tasks were completed, the MF-USV could execute the obstacle avoidance task and return to the initial location automatically, as shown in Figure 20d,e.

Multi-Function Tests
The test was conducted to check the capability of the obstacle avoidance, water quality monitoring, and water surface cleaning of the MF-USV simultaneously. At first, the MF-USV sailed on the lake automatically and executed the obstacle avoidance task by using the threshold-based obstacle avoidance algorithm, as shown in Figure 20a. Subsequently, when the quality of water was abnormal, the MF-USV could collect the water sample in the water bottle and record the position coordinate at the present water sampling point, as shown in Figure 20b. Then, when the floating garbage was detected, the MF-USV could collect and clean the floating garbage by using the water surface cleaning algorithm, as shown in Figure 20c. Finally, after the water quality monitoring and water surface cleaning tasks were completed, the MF-USV could execute the obstacle avoidance task and return to the initial location automatically, as shown in Figure 20d,e.

Conclusions
In this paper, a MF-USV has been creatively developed to avoid obstacles, collect contaminated water samples, and clean garbage floating on the water surface. The architecture of the proposed MF-USV comprises the main control unit, locomotion module, positioning module, obstacle avoidance module, water quality monitoring system, water surface cleaning system, communication module, power module, and remote human-machine interface for the purposes of obstacle avoidance, water quality monitoring, and water surface cleaning. Our experimental results have successfully validated that the MF-USV can successfully execute obstacle avoidance, water quality monitoring, and water surface cleaning tasks. Once the contaminated water field is detected, the MF-USV can collect the water sample for further analysis and send the pH value and GPS coordinates of the water sampling point to the remote human-machine interface for recording and displaying. On the other hand, when the floating garbage is detected, the MF-USV can automatically track and collect the floating garbage through the water surface cleaning algorithm. The success rates of floating garbage detection are all 100% when the floating garbage located in the visual angle ranged from −30 • to 30 • on the front of the MF-USV and the distances between the floating garbage and the MF-USV were 40 and 70 cm. When the distance between the floating garbage and the MF-USV was 130 cm, the success rates of the floating garbage collection were from 70% to 95% in different directions. Based on the above experimental results, we believe that the proposed MF-USV and its associated algorithms will provide a novel and effective contribution to unmanned surface vehicle design. The main contribution of this paper is to develop a low cost USV with multi-functions and its threshold-based algorithms for providing an effective tool for obstacle avoidance, water quality monitoring, and water surface cleaning tasks.
In the future, the MF-USV will be tested in more complicated field environments to develop more robust and stable methodology for water quality monitoring and water surface cleaning. Moreover, extra sensors and algorithms will be added to the MF-USV to improve the functions of obstacle avoidance, water quality monitoring, and water surface cleaning.

Data Availability Statement:
The data presented in this study are available on request from the corresponding author. The data are not publicly available due to further study will be carried out using the same data.

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