Cost-effective Evaluation, Monitoring, and Warning System for Water Quality based on Internet of Things

This paper proposes an evaluating, monitoring, and warning system for water quality for taking care of fish that includes an Arduino Mega2560 board and a sensor system with wireless communication technologies based on IoT technology. Not only the temperature but also the pH and dissolved oxygen (DO) content of water are acquired through the Arduino Mega2560 board. These measurement data are transferred to the server through ESP8266 and SIM800A modules integrated on the board. The stored temperature, pH, and DO values are displayed on a ThingSpeak server. Furthermore, the fault detection of water quality under real working conditions is handled and displayed on the platform or a cellphone-based web service and short messaging service (SMS). The accuracy and reliability of the system for the functions of monitoring, evaluation, and fault detection were demonstrated. Compared with established systems, the proposed system has the advantages of (1) reduced cable use for the monitoring system, (2) a warning system via a cellphone-based SMS cellphone or web service, (3) cost-effectiveness, and (4) portability.


Introduction
Internet of Things (IoT) technology is now widespread and popular, and it is transforming traditional agriculture into smart agriculture. The adoption of sensors and wireless communication in agriculture makes the production process more synchronized and monitored. It also automatically optimizes production activities. Wireless network control technology such as radio frequency identification (RFID) automatically receives radio signals and is capable of storing and receiving data remotely through micro-frequency transmitters, but the technology requires a card and a card reader for signal feedback. Modern Bluetooth wireless data communications devices, which can be connected to mobile devices, operate in the 2.4-2.48 GHz frequency range. However, the small operating range of only 10-100 m (1) is a drawback of Bluetooth technology. The 802.15.4 standard uses shortwave radio signals, and the structure of 802.15.4 has two layers: a physical layer and a medium access control (MAC) layer. (2) In addition, the development of IoT technologies for use in agriculture has been accelerating. There have been many IoT-based studies in this field, as reviewed in Table 1. (1)(2)(3)(4)(5)(6)(7) In recent years, low-cost IoT systems (8,9) have been used for detection systems including for gas detection and environment monitoring. (10)(11)(12) In addition, the low-cost ESP8266 Wi-Fi module has been used by many researchers in their IoT systems, (13)(14)(15) in which the accuracy and long-term working modes of the sensors and Wi-Fi module have been demonstrated.
This paper proposes an evaluating, monitoring, and warning system for water quality for taking care of fish that is based on the Arduino Mega2560 board and an IoT system based on wireless communication technologies using the SIM800A module and the ESP8266 Wi-Fi module. The rest of this study is organized as follows. In Sect. 2, the system is described. In Sect. 3, the methodology is presented. The results of experiments and analysis are provided in Sect. 4. The final section presents the conclusion.

System Description
The system consists of three types of hardware: the sensor system, the Arduino Mega2560 board, and the wireless communication module, as shown in Fig. 1. The sensor system includes temperature, pH, and dissolved oxygen (DO) sensors. The Arduino Mega2560 is used as the motherboard; it receives signals from the temperature, pH, and DO sensors and transmits their values to a ThingSpeak server or cellphone through a SIM800A module and an ESP8266 module. In addition, a warning system sends a warning to a farmer by short messaging service (SMS) or the SIM800A module if the temperature, pH, or DO content of the water being monitored is dangerous to fish.

Hardware development
The hardware of the evaluation, monitoring, and warning system for water quality consists of the sensor system, motherboard, and communication board. The temperature, pH, and DO sensors are integrated in the sensor system. The specifications of the pH and temperature sensors and the DO sensor are respectively shown in Tables 2 and 3.
Hua-Jie Cao (6) Arduino IDE Classic MSP430F149 NRF24L01 x None Kutila Gunasekera (7) DGLux5 In addition, the motherboard is based on an Arduino Mega2560 board, which is equipped with a 54-pin I/O on the digital side, 15 pins of which are used for pulse-width modulation (PWM), 16 inputs on the analog side, and 256 KB flash memory. Its operating voltage is 5 V and four sets of UARTs are used to read the voltage signal values of the sensor. (19) The wireless communication board includes SIM800A and ESP8266 modules. The SIM800A is a communication module UART. It is a quad-band GSM/GPRS module that operates at frequencies of GSM 850 MHz, EGSM 900 MHz, DCS 1800 MHz, and PCS 1900 MHz. The SIM800A-DS features an optional GPRS multislot of class 10/class 12 and supports the GPRS coding schemes CS-1, CS-2, CS-3, and CS-4. (20) The ESP8266 module is a Wi-Fi module UART. It integrates a TCP/IP protocol stack and it can give any microcontroller access to the Wi-Fi network.     Figure 2 shows the flowchart of the algorithm used for the evaluation, monitoring, and warning system for water quality. First, the system checks the hardware connections including the sensor system, SIM module, and ESP8266 module. If a connection error is detected, it will be displayed on the LCD; otherwise, the system will measure the temperature, pH, and DO content of the water. All of the measurement data from the sensor system are displayed on the LCD and/or sent to the server through the SIM800A and ESP8266 modules for storage and/or display. Furthermore, the temperature, pH, and DO content are compared with setting values. If they are outside the system settings, the warning system will send a message to the user that displays the temperature, pH, and DO content.

Experimental setup
The setup of the experimental system is shown in Fig. 3. The experimental setup includes an Arduino Mega2560, a DS18B20 sensor for measuring the temperature of water, a v1.1 pH meter for measuring the pH, a DFRobot (SU:SEN2037) DO sensor for measuring the DO content of water, and a computer running Arduino serial monitor software. The reference system includes a pH2700 pH meter, a HANNA oxygen-water temperature meter, and a HANNA Oxy-check H2700 oxygen meter, and tests were conducted at Dong Nai river, Vietnam.

Analysis results
Experimental measurements of temperature, pH, and DO content of Dong Nai river were conducted at Lac Hong University's environmental technology laboratory on 10 July 2019. The system was operated from 08:00 to 09:20 during the measurement. All temperature, pH, and DO parameters were set using the Arduino Mega2560 board. The temperature, pH, and DO content were measured using a HANNA Oxy-check H2700 oxygen meter for reference. The measured results were displayed in the Arduino serial monitor every 1 min. The measured pH, temperature, and DO content are shown in Fig. 4.
To easily assess the accuracy of the system, we used the difference between the measured results and reference results [Eqs. (1) to (3)]. Here, y i and ˆ are the ith measurement result and reference result, respectively, and n is the total number of measurements. The differences between the measured and reference values of pH, temperature, and DO content are shown in Fig. 5. The differences between the measured and reference values of pH, temperature, and DO content are −0.4-0.22, −0.26-0.64 °C, and −0.2-0.25 mg/l, respectively. The mean differences between the measured and reference values of pH, temperature, and DO content are 0.02, 0.005, and 0.02%, and the mean square errors are 0.025, 0.15 °C, and 0.13 mg/l, respectively, as shown in Table 4.

Warning system
The warning system was triggered by the divergence of the measured temperature, pH, and DO output from the ranges of set values. In this work, the ranges of set values for the pH, temperature, and DO of the testing system were respectively 6-8, 23 to 27 °C, and 10-12 mg/l. If a measured value diverges from the corresponding range, the system will send a message to the farmer's phone through the SIM800A module.

Monitoring by server
All measured temperature and pH data are sent to the ThingSpeak server. The web interface of the monitoring and warning system in the ThingSpeak server is shown in Fig. 6. The data collected from the system are stored in the server and can be downloaded in Excel format.
As shown in Fig. 6, the main parameters of the water quality monitoring system are displayed based on a web interface. It is a flexible monitoring system that can be displayed on mobile devices such as laptops, smartphones, and tablets connected to the internet. It is easy for users to access the system and monitor the indicators of water quality.

Conclusions
This paper deals with an evaluation, monitoring, and warning system for water quality based on IoT. This system is a combination of Internet and wireless communication technology with wireless communication and wireless data transmission via a SIM800A module. The data collected is sent to the server via cloud computing and used to monitor the temperature and pH in a ThingSpeak server. Furthermore, a warning system is built in to alert users when it detects that the water temperature, pH, and DO diverge from their set ranges. The system can be operated online and is reliable, efficient, and easy to improve. The proposed system has many practical advantages including (1) a reduced length of cable for the monitoring system, (2) a warning system via a cellphone SMS or a web service, (3) cost-effectiveness, and (4) portability.