Skip to main content
Heliyon logoLink to Heliyon
. 2020 Jul 1;6(7):e04096. doi: 10.1016/j.heliyon.2020.e04096

Smart water quality monitoring system with cost-effective using IoT

Sathish Pasika 1,, Sai Teja Gandla 1
PMCID: PMC7334377  PMID: 32642574

Abstract

Wireless communication developments are creating new sensor capabilities. The current developments in the field of sensor networks are critical for environmental applications. Internet of Things (IoT) allows connections among various devices with the ability to exchange and gather data. IoT also extends its capability to environmental issues in addition to automation industry by using industry 4.0. As water is one of the basic needs of human survival, it is required to incorporate some mechanism to monitor water quality time to time. Around 40% of deaths are caused due to contaminated water in the world. Hence, there is a necessity to ensure supply of purified drinking water for the people both in cities and villages. Water Quality Monitoring (WQM) is a cost-effective and efficient system designed to monitor drinking water quality which makes use of Internet of Things (IoT) technology. In this paper, the proposed system consists of several sensors to measure various parameters such as pH value, the turbidity in the water, level of water in the tank, temperature and humidity of the surrounding atmosphere. And also, the Microcontroller Unit (MCU) interfaced with these sensors and further processing is performed at Personal Computer (PC). The obtained data is sent to the cloud by using IoT based ThinkSpeak application to monitor the quality of the water.

Keywords: Electrical engineering, Environmental science, Systems engineering, Control systems, Wireless network, Communication system, Water treatment, WQM, Temperature, Wireless communication, Turbidity, Humidity, pH, MCU., IoT


Electrical engineering; Environmental science; Systems engineering; Control systems; Wireless network; Communication system; Water treatment; WQM; Temperature; Wireless communication; Turbidity; Humidity; pH; MCU.; IoT.

1. Introduction

Freshwater is a world resource that is a gift of nature and important to farming, manufacturing, and the life of human beings on earth. Currently, drinking water facilities face new real-world problems (Shafi et al., 2018) (Siregar et al., 2017). Due to the limited drinking water resources, intensive money requirements, growing population, urban change in rural areas, and the excessive use of sea resources for salt extraction has significantly worsened the water quality available to people (Chen & Han, 2018) (Meng et al., 2017). The high use of chemicals in manufacturing, construction and other industries, fertilizers in farms and also directly leaving the polluted water from industries into nearby water bodies have made a huge contribution to the global water quality reduction, which has become an important problem (Cloete et al., 2014). Even due to containment water various water born are increasing day by day, due to which many human beings are losing their lives.

Traditionally, detection of water quality was manually performed where water samples were obtained and sent for examination to the laboratories which is time taking process, cost and human resources (Das & Jain, 2017) (He & Zhang., 2012). Such techniques do not provide data in real-time. The proposed water quality monitoring system is consisting of a microcontroller and basic sensors, is compact and is very useful for pH, turbidity, water level detection, temperature and humidity of the atmosphere, continuous and real-time data sending via wireless technology to the monitoring station (Sugapriyaa et al., 2018) (Barabde & Danve., 2015).

2. Literature survey

Lambrou et al. (2014) discussed the development and implementation of a portable, mobile, cost-efficient and reliable water level control system. Here the authors used two transceivers of radio frequency (RF) and a transmitter mounted on the tank and sump at the place where they wanted to check the quality of water. The RF transceivers used for wireless communication to the internet server. With the help of a microcontroller, the system is fully programmed of the user unless the water the bottle is drained or overflowed. The sensor array is used to measure various parameters such as dissolved Oxygen, Tumble, pH, Temperature, etc. Sensor array. Costs of installation are reduced because of the wireless system.

Prasad et al. (2015) the smart Water Quality Monitoring (WQM) device for Fiji using IoT and remote sensing technologies is shown in this article. The Pacific Islands of Fiji require regular collection and analysis of collected data for the water quality monitoring and uploading this data into the server. In order to monitor water quality, the authors have used IoT and remote sensing technologies. The current measurements can be enhanced by remote sensing. During the entire test period, the system has been proved worth by delivering accurate and consistent data using IoT for water monitoring in real-time. The system proposed by these authors also used a GSM module to forward the data to the mobile user via SMS.

Omar Faruq et al. (2017) A water quality monitoring system based on microcontrollers for people living in Bangladesh's outskirts, where safe drinking water is not available, is provided in this paper. The device has been designed with a high degree of accuracy and is sensitive to several water parameters such as temperature, turbidity and hydrogen potential. (pH) displayed on the LCD monitor. Finally, in this paper, each of the parameter values is compared with the predefined equipment, and sensor values and error are calculated.

3. Measurement parameters of WQM system

Basically, there are many parameters that are needed to be measured for water quality analysis. However, the WQM system proposed measures the key water parameters:

  • Water's pH value.

  • Turbidity of the water.

  • Water level present in the tank.

  • Temperature and humidity of the surrounding atmosphere.

4. Methodology of the proposed system

The proposed system uses four sensors which are pH, turbidity, ultrasonic, DHT-11, microcontroller unit as the main processing module and one data transmission module ESP8266 Wi-Fi module (NodeMCU). The microcontroller unit is a significant part of the system developed for water quality measurement because The Arduino Mega consumes low power, and it is a small size, where the size is a good use for a crucial point-of-sale technology criterion. Among four sensors, two of the sensors collect the data in the form of analog signals; the MCU has an on-chip ADC that translates the sensor analog signals into the digital format for further study. So, to get this analog output from the sensor, the sensor's analog output of will be connected to the MCU's analog pins. Whereas the other two sensors output directly connected to the digital pins of the MCU units. All the sensors data processed by the MCU and updated to the ThingSpeak server using the Wi-Fi data communication module ESP8266 (NodeMCU) to the central server (Daigavane & Gaikwad, 2017). The block diagram of the system proposed for water quality measurement is shown in Figure 1.

Figure 1.

Figure 1

System block diagram.

The whole system is designed in Embedded-C and simulating the written code using Arduino IDE. In order to collect data on pH, turbidity, level of water, temperature, and humidity of the surrounding atmosphere, the water quality monitoring system employs sensors (Moparthi et al., 2018). Authorized users can access these data using a user ID and password for accessing data on the ThingSpeak server by logging into their accounts. The information is gathered, stored, analyzed and transmitted in real-time.

The ESP8266 is a low-cost Wi-Fi module consists of a full TCP/IP stack Wi-Fi chip and microcontroller chip which is manufactured by M/S Espino. The code boots from external flash directly during the processing of the program, thereby increasing the system performance and the storage requirements due to their optimized cache capacity. ESP8266 uses Tx and Rx serial transceiver pins for sending and receiving data, for changing wireless module settings, for changing serial query commands. Two pins (Tx/Rx) are required to communicate, but only attached, between a Wi-Fi module and a microcontroller but connected oppositely. It is easy to set up an IoT application via Wi-Fi Module via SPI and UART.

4.1. Target boards

The target board is a device on which a microcontroller, ADC, DAC, crystal oscillator, etc. are fabricated on it. The two target boards are Arduino Mega and NodeMCU which are used in the proposed system.

4.1.1. Arduino Mega

The Arduino Mega is an ATmega2560-based microcontroller. There are 54 input/output digital pins, 14 of which were used as PWM output. In addition, it has 16 analog inputs, a USB connection, 4 USARTs, and a clock generator crystal oscillator of 16 MHz. It is easy to connect or link it with an AC/DC adapter or battery to a device with a USB cable (Siddula et al., 2018).

4.1.2. NodeMCU

It's an IoT platform open-source. It consists of the Espressif System's ESP8266 Wi-Fi Chip (SoC) on-chip and ESP-12 modulus-based hardware. With Wi-Fi, analog pins, digital pins and serial communication Protocols, the NodeMCU Development Board has been featured. The board is used for wireless communication since this technology has evolved to such a level that largenetworks of low-cost devices are used to track infrastructure in real-time (Whittle et al., 2013).

4.2. Sensors

The various sensors used in this work are explained in the following section.

4.2.1. pH sensor

The pH of the ion of the hydrogen is the negative measure. The calculation is an acidity balancing test or the alkaline content of the ions of hydrogen in the water (Cloete et al., 2014). The source of pH natural for water is about 7; pH ranges from 6.5 to 9.5 which can be considered safe water for drinking (Bande & Nandedkar, 2016). The source of pH is low (0) for acidic and high (14) for alkaline solutions. For each increase in several ph values, the concentration of hydrogen ion decreases ten-fold, and water becomes less acidic. A pH sensor has an electrode of measurement and reference. The ion of hydrogen is sensitive to electrode measurement that has a potential directly linked to the hydrogen solution ion concentration. The electrical differential tension depends on the temperature so that the temperature sensor is also needed to correct the voltage shift (Zin Myint et al., 2017).

4.2.2. Turbidity sensor

Turbidity is the calculation of the water clearness, i.e. the number of particles suspended in the water. It uses light to detect suspended particles to evaluate light transmit and dispersion rate. The calculation measures the numbers of water particles floating in the water, for example, plant waste, sand, silt and clay, impacting the sunlight in water (Daigavane & Gaikwad, 2017). Excess turbidity can reduce marine life reproduction and lead to various types of human illness (Srishaila Mallikarjuna Swamy & Mahalakshmi, 2017). The rate changes with the total number of particles suspended in water. Total Suspended Solids (TSS) increases in water with increasing turbidity. The sensor produces both digital and analog mode output (Shafi et al., 2018). The input voltage of the sensor is 5V with an analog output voltage ranging from 0 to 4.5V. It can withstand a maximum temperature of 100 C–900 C. The NTU (Nephelometric Turbidity Units) is its units. In essence, the sensor is positioned to the side of the beam. When light reaches the sensor, if many small particles are dispersed in the water, this small particle will be detected by the source beam.

4.2.3. Ultrasonic sensor

The ultrasonic sensor provides a 2cm - 4m measurement range. The sensor fabricated on a module that includes an ultrasonic transmitter (Trigger pin), receiver (Eco pin) and a control circuit. It generates a high-frequency sound wave of frequency 40 kHz, and it will be the valuation of the echo received by the sensor measures the interval between signal transmission from the pin trigger and receiving it back to the echo which further determines the distance to an object (Zin Myint et al., 2017).

4.2.4. DHT-11 sensor

The DHT11 commonly used for the measurement of temperature and humidity values of the surrounding atmosphere. The sensor comes with a Negative Temperature Coefficient (NTC) for temperature measurement and has an 8-bit microscope to output so that the temperature and humidity values sent to the microcontroller are serial data. The sensor has the same temperature and humidity value. It is also calibrated by the factory so that it doesn't need to be calibrated again and thus easy to interface. The sensor can calculate temperatures of between 0 °C to 50 °C and humidity levels between 20% and 90%, with an exactness of between ±1 °C and ±1% (Zin Myint et al., 2017). The sensor is used to determine the temperature of the atmosphere so that the pH and turbidity sensors are worked correctly over a long time. Temperature measurement can also determine the kinds of marine organisms that can survive in the water (Cloete et al., 2014).

4.2.5. ThingSpeak server

ThingSpeak is an IoT data collection application for analysis of various sensors, e.g. pH, turbidity, voltage, temperature, moisture, distance, etc. The data collector collects data from edge node devices (this happens with the NodeMCU/ESP8266) and also allows the data to be modified for historical data analysis in a software environment. First, the user must log in with details on his/her server. The channel containing data fields and a status field is the primary component of ThingSpeak activity. After a ThingSpeak channel has been developed, data is modified, processed, and interpreted with MATLAB code, and the data is reacted by tweets and other alerts (Das & Jain, 2017).

5. Algorithm of the proposed system

The proposed system's entire algorithm is shown in Figure 2. Initially, the serial monitor of Arduino is initialized with 115200 baud rate. Later the ESP Wi-Fi module and the Thing Speak Server is also initialized. The four sensors are being connected and the values are read into the sensors. The algorithm flow of the ultrasonic and DHT 11 sensor flow is explained. The Ultrasonic sensor reads the digital value directly so it is considered as the duration of time in seconds. With the help of the duration, distance is calculated using Eq. (1). The DHT 11 Sensor reads the analog values of temperature and humidity. Later the same values are sent into the Thing Speak server and the same values are updated in the Serial monitor.

Distance = (Duration) / 58.8 (1)

Figure 2.

Figure 2

Overall Algorithm for the proposed system.

As shown in Figure 3, the algorithm for pH sensor data processing is initialized with the required parameters. In the flow, the value of i will be assigned with zero initially and the analog values of 10 samples will be considered. Later all the 10 samples will be calculated as a single average value. The pHVol and pHValue will be calculated. Later the same values are sent into the Thing Speak server and the same is shown on the Serial monitor.

Figure 3.

Figure 3

Algorithm for pH sensor data processing.

As shown in Figure 4, the algorithm for turbidity sensor data processing is initialized with the required parameters. In the flow, the value of the parameter sensor Value is read with analog value. The voltage value (volt) should be converted into a digital value. If Volt <2.5 either of NTU value will be considered. Later the same value is sent into the Thing Speak server and the same is displayed on the Serial monitor.

Figure 4.

Figure 4

Turbidity sensor algorithm.

6. Results and discussion

The experimental setup consists of an MCU with a sensor network that takes samples for every 10s from the water storage tank and the parameters are displayed on the Arduino IDE serial display. For the real-time monitoring, a Wi-Fi module used which will be updating the ThingSpeak server forever 20s with different parameters. The water sample from Hyderabad Metropolitan water supply and sewerage board and groundwater tested. The entire hardware setup of the WQM system is shown in Figure 5.

Figure 5.

Figure 5

Hardware setup of WQM system.

6.1. A. pH sensor results

As shown in Figure 6, the two fields in the ThingSpeak Server are updated with their corresponding values. The server is getting updated every 20 s. Infield 1 the voltage of water is being calculated from the sensor and being updated. Whereas in field 2 the pH value of water is being updated. According to the Nernst equation, as shown in Eq. (2), the pH of water is directly proportional to the voltage water.

E = EO + (RT/zF) pH (2)

Figure 6.

Figure 6

pH output in ThingSpeak Server with field 1 voltage vs. Time and field 2 pH vs. Time.

In Eq. (2), E is the cell potential in the conditions that prevail, Eo is the cell potential in the standard temperature and pressure conditions, R is the universal gas constant, T is the temperature, z is the number of electric moles that are transferred to the reaction, and F is the constant Faraday. The voltage of water is linearly related to the pH value of water by comparing the two graphs. is the practical proof for Eq. (2). It is noticed that the voltage of water is 2.39V at 20:28h and for that the corresponding pH value is 5.74pH. The output of the pH sensor also observed in the serial monitor of the Arduino IDE as shown in Figure 7.

Figure 7.

Figure 7

pH values on the serial monitor.

6.2. Turbidity sensor results

The turbidity values in NTU, as well as the voltage of water, are being calculated and updated in the Server, as shown in Figure 8. It is observed that the value of field 3 at time 21:08h is 4.0V and its corresponding value of turbidity is 676 NTU as shown in field 4. As shown in Figure 8, the server data is updated with the voltage of water and turbidity value of water in field 3 and field 4 respectively. According to Eq. (3), the Turbidity of water is inversely proportional to the voltage water.

y = -1120.4 x2 + 5742.3x – 4352.9 (3)

Figure 8.

Figure 8

Turbidity output in ThingSpeak Server with field 3 voltage vs. Time and field 4 Turbidity vs. Time.

In Eq. (3), y is the turbidity value and x is the voltage. The practical proof for the above Eq. (3) is verified by using field charts 3 and 4 the relationship between turbidity of water and the voltage of water is inversely proportional. The turbidity sensor output also monitored in the serial monitor of Arduino IDE as shown in Figure 9.

Figure 9.

Figure 9

Turbidity values on the serial monitor.

6.3. Ultrasonic sensor results

The storage tank water level is measured in cm using the ultrasound sensor and the water level is updated into the ThingSpeak Server as shown in Figure 10. The time at which 21:12h the water level is around 44cm in the tank. The water level of the tank is also monitored in the serial monitor of Arduino IDE as shown in Figure 11.

Figure 10.

Figure 10

Ultrasonic Sensor output in ThingSpeak Server with field 5 distance vs. Time.

Figure 11.

Figure 11

Water Level on the serial monitor.

6.4. Temperature and humidity sensor results

Finally, the surrounding environment temperature and humidity calculated from the DHT-11 sensor module and updating it into the ThingSpeak Server as shown in Figure 12. In field 6 the temperature value updates whereas in field 7 the humidity value of the atmosphere is being updated respectively. Temperature measured in degree C, and humidity measured in percentage. The temperature of the surrounding calculated because the pH sensor and turbidity sensor will give accurate value in a specific atmospheric condition. In Figure 12, consider the temperature value at the time instance of 20:26h is 34.2 0C and from field 7 at the same instance of time is 33%. The temperature and moisture of the environment are also monitored in the serial monitor of Arduino IDE as shown in Figure 13.

Figure 12.

Figure 12

DHT-11 output in ThingSpeak Server with field 6 temperature vs. Time and field 7 Humidity vs. Time.

Figure 13.

Figure 13

Temperature and Humidity values on the serial monitor.

6.5. ThingSpeak mobile application

The usage of the ThingSpeak mobile application for monitoring the water quality will be very useful for the water quality commission authorities. After installation, the authorized users can access this information can be accessed using a user identification ID and password to view ThingSpeak data in their account. app as shown in Figure 14 and add the channels that need to be monitored. As shown in Figure 15, after installation of the channels which are to be monitored need to add in the app with its channel ID. After adding the channel ID, all the graphs will be displayed in the application.

Figure 14.

Figure 14

ThingSpeak app installation.

Figure 15.

Figure 15

ThingSpeak mobile app.

The serial monitor of the Arduino IDE with the respective parameter values is updated as shown in Figure 16 where all the WQM system parameters are updated which is further uploaded in the ThingSpeak server with a time delay of 20 s because to upload into the server a minimum of 15 s delay is needed.

Figure 16.

Figure 16

Screenshot of all the parameters on the Serial Monitor.

7. Conclusion

The system proposed in this paper is an efficient, inexpensive IoT solution for real-time water quality monitoring. The developed system having Arduino Mega and NodeMCU target boards are interfaced with several sensors successfully. An efficient algorithm is developed in real-time, to track water quality. The measured pH value ranges from 6.5 to 7.5 for Hyderabad Metropolitan city supply water and 7 to 8.5 for groundwater. The measured value of turbidity ranges from 600 to 2000 NTU for both Hyderabad Metropolitan city supply water and groundwater. A web-based application i.e., ThingSpeak is used to monitor the parameters such as pH value, the turbidity of the water, level of water in the tank, temperature and humidity of the surrounding atmosphere through the webserver. Further, these measured parameters also monitored in ThingSpeak mobile application. Also, this work needs to be carried out to analyse several other parameters like electrical conductivity, free residual chlorine, nitrates, and dissolved oxygen in the water.

Declarations

Author contribution statement

G. Sai Teja & P. Sathish: Conceived and designed the experiments; Performed the experiments; Analyzed and interpreted the data; Wrote the paper.

Funding statement

This research did not receive any specific grant from funding agencies in the public, commercial, or not-for-profit sectors.

Competing interest statement

The authors declare no conflict of interest.

Additional information

No additional information is available for this paper.

References

  1. Bande Priyanka N., Nandedkar S.J. Low-Cost sensor network for real-time water quality measurement system. Int. J. Innovat. Res. Sci. Eng. Technol. 2016;5:20691–20696. [Google Scholar]
  2. Barabde M.N., Danve S.R. Continuous water quality monitoring system for Water resources at remote places. IJIRCEE. 2015;3:2320–9798. [Google Scholar]
  3. Chen Yiheng, Han Dawei. Water quality monitoring in the smart city: a pilot project. Automat. Construct. J. 2018;89:307–316. [Google Scholar]
  4. Cloete Niel Andre, Malekian Reza, Nair Lakshmi. Design of smart sensors for real-time water quality monitoring. Department of electrical, Electronic and Computer Engineering, University of Pretoria, Pretoria, South Africa. IEEE J. 2014;13:1–16. [Google Scholar]
  5. Daigavane Vaishnavi V., Gaikwad M.A. Water quality monitoring system based on IoT. Adv. Wireless Mobile Commun.. ISSN. 2017;10:1107–1116. [Google Scholar]
  6. Das Brinda, Jain P.C. Real-time water quality monitoring system using the internet of things. Int. Conf. Comput. Commun. 2017:78–82. [Google Scholar]
  7. He Donge, Zhang Li-Xin. Report: Mechanical and Electronic Information Institute, China University of GeoScience, Wu Hen, China. 2012. The water quality monitoring system based on wireless sensor network. [Google Scholar]
  8. Lambrou Theofanis P., Anastasiou Christos C., Panayiotou Christos G., Polycarpou Marios M. A low-cost sensor network for real-time monitoring and contamination detection in drinking water distribution systems. IEEE Sensor. J. 2014;8:2765–2772. [Google Scholar]
  9. Meng F., Fu G., Butler D. Cost-effective river water quality management using integrated real-time control technology. Environ. Sci. Technol. 2017;51:9876–9886. doi: 10.1021/acs.est.7b01727. [DOI] [PubMed] [Google Scholar]
  10. Moparthi Nageswara Rao, Mukesh Ch, Vidya Sagar P. 4th International Conference on Advances in Electrical, Electronics, Information, Communication, and Bio-Informatics. 2018. Water quality monitoring system using IoT. [Google Scholar]
  11. Omar Faruq Md., Hoque Emu Injamamul, Nazmul Haque1 Md., Dey Maitry, Das N.K., Dey Mrinmoy. IEEE Region 10 Humanitarian Technology Conference, Dhaka, Bangladesh. 2017. Design and implementation of a cost-effective water quality evaluation system; pp. 860–863. [Google Scholar]
  12. Prasad A.N., Mamun K.A., Islam F.R., Haqva H. The University of the South Pacific. 2nd Asia-Pacific World congress on Computer Science and Engineering IEEE Conference. 2015. Smart water quality monitoring system. [Google Scholar]
  13. Shafi Uferah, Mumtaz Rafia, Anwar Hirra, Mustafa Qamar Ali, Khurshid Hamza. School of Electrical Engineering and Computer Science, National University of Science and Technology; IEEE Conference: 2018. Surface Water Pollution Detection Using the Internet of Things; pp. 92–96. [Google Scholar]
  14. Siddula Sai Sreekar, Babu Phaneendra, Jain P.C. IEEE, EE Department Shiv Nadar University. 2018. Water level monitoring and management of dams using IoT. [Google Scholar]
  15. Siregar Baihaqi, Menen Krisna, Efendi Syahril, Andayani Ulfi. The International Conference on ICT for Smart Society (ICISS) 2017. Monitoring quality standard of waste water using wireless sensor network technology for smart environment. [Google Scholar]
  16. Srishaila Mallikarjuna Swamy P.M., Mahalakshmi G. Real-Time Monitoring of Water quality using the smart sensor. JETER J. 2017;4:139–144. [Google Scholar]
  17. Sugapriyaa Tha, Rakshaya S., Ramyadevi K., Ramya M., Rashmi P.G. Smart water quality monitoring system for real-time applications. Int. J. Pure Appl. Math. 2018;118:1363–1369. [Google Scholar]
  18. Whittle A.J., Allen M., Preis A., Iqbal M. Coventry University; Coventry, UK: 2013. Sensor Networks for Monitoring and Control of Water Distribution Systems. MIT article. [Google Scholar]
  19. Zin Myint Cho, Gopal Lenin, Lin Aun Yan. Reconfigurable smart water quality monitoring system in an IoT environment. IEEE ICIS. 2017:435–440. [Google Scholar]

Articles from Heliyon are provided here courtesy of Elsevier

RESOURCES