1. Introduction
Rivers are identified as main water resources in Malaysia for their fresh water and nutrients while also supporting human activities and balancing the aquatic environment for flora and animals. Rapid urbanization, industrialization, and population growth instigate high demand for clean water to meet casual needs [
1]. Water contamination in river systems can have a long-term impact on economic losses and the quality of life.
Consequently, Malaysia has adopted Integrated Water Resources Management (IWRM) and Integrated River Basin Management (IRBM) programs to regulate water resources, predominantly rivers, because they are its main water resources [
2]. However, only 47% of the water resources in Malaysia are classified as clean, while the remaining 43% are slightly polluted, and the remaining 10% are polluted due to poor management of water resources. Even during the COVID-19 pandemic between the years 2020 and 2021, the rivers of Sungai Gong and Sungai Semenyih in Selangor were polluted by hazardous chemicals and agricultural waste [
3]. Unscheduled water supply due to a water shortage affects the economy and productivity, as it drives water plants to cease operations for cleaning purposes.
Therefore, monitoring the water quality conditions based on physical, chemical, and biological characteristics is the primary operation to support IWRM and IRBM [
4,
5]. The analysis of qualitative data on water quality characteristics was supervised to classify water bodies based on the water quality index (WQI) and National Water Quality Standards (NWQS) in Malaysia [
6]. The classification of water through water quality monitoring serves a broad purpose in water resource conservation based on the assessment of pollution control, ensuring the sanctuary of ecology and health status for living organisms, and evaluating the current water quality trends, efficiency of waste management, and water treatment. However, the conventional method for monitoring the water quality requires a period of laboratory analysis. The assistance of autonomous water quality monitoring can provide an analysis of water quality properties that can vary over time [
7]. Reliable data from proficient water quality monitoring build trust among stakeholders and give insight to policymakers to make expedient decisions for river resource management. However, due to the geographical and scattered population in Malaysia, it difficult to build an absolute network of sensors and monitoring stations.
Development of an IoT smart system implementing real-time tracking water quality parameters and contamination levels will enable early detection of potential issues and proactive maintenance to prevent waterborne diseases and reduce treatment costs [
8]. The significance of determining the types of wireless networks to be implemented in a water quality monitoring system reflects the capabilities and limitations of the application objectives. Effective IoT execution includes balancing power, cost, efficiency, and maintenance [
9]. To enable cloud computing for storing and analyzing enormous amounts of data in the water quality monitoring process, the type of network to be utilized must be chosen based on the requirements and type of data involved during transmission between nodes and towards the gateway [
10].
Adopting various types of wireless networks into the water quality monitoring system, IoT has been proposed and evaluated by previous researchers. Zhang et al. used Zigbee as their personal area network (PAN) radio frequency module for continuous water quality monitoring [
11]. Data were transmitted through GPRS from the GSM version, extending the communication range. Signified by water quality data rates, the merger of two networks for extension unnecessarily consumes additional energy and cost, as a SIM card is required for communication activation.
Wi-Fi is another notorious network technology in IoT applications owing to its high data rates and low-cost antennas. Hossain et al. and Naj et al. implemented Wi-Fi as a communication network for a water quality monitoring system [
12,
13]. The vast amount of data transmitted improved the accuracy of water quality analysis with low latency. However, the limited range of Wi-Fi requires additional Wi-Fi extenders for river environments, which increases operational and power costs.
Samantha et al. subscribed to the 3G network as a communication medium for water quality monitoring applications that transmit data to a remote database through the short message service (SMS) [
14]. The use of a cellular network extended from the GSM version is secure and has low latency. However, it is more suitable for IoT applications with high data throughput and overwhelmingly low-type data sensors. In Stockholm, Ericsson collaborated with municipal councils and universities to deploy IoT systems with massive sensors and narrowband NB-IoT to monitor water quality throughout Stockholm City [
15]. This system can increase the efficiency of sensors in larger areas while delivering direct feedback for water quality classification.
The invention of long-range (LoRa) networks in the wireless network community has become a game changer in IoT applications [
16]. LoRa is a derivation of chirp spread spectrum (CSS) technology that operates at long range using an air interface [
17]. Relating to the ability of LoRa, this research is intended to study the design of a continuous water quality monitoring system with the LoRa approach to performance evaluation.
The aim of this paper is to demonstrate LoRa abilities based on setup properties while analyzing water quality classification for autonomous water quality monitoring as system validation. The results from LoRa performance evaluation also give insight for future design of network properties to be implemented in smart water quality monitoring systems for urban environments. Zhang et al. and Patel et al. created an autonomous water quality monitoring system with LoRaWAN and tested it in a garden pool and laboratory [
18,
19]. Analysis and status provided in the IoT platform resulted in the success of the system objective while being cost effective, although modification is necessary in geographical areas due to bandwidth constraints and sight-to-sight factors, especially in urban areas [
20].
A flood warning system based on a wireless sensor network (WSN) developed by Leon et al. based on an ultrasonic sensor alerts users on Twitter with LoRa as a data exchanger and found no loss of packet data, but it had a 1 cm margin error of the water level [
21]. Codeluppi et al. built an ad hoc-level module with a LoRaWAN architecture, and transmitted sensor data to provide advanced information to farmers [
22]. The results differed based on its location in the greenhouse and vineyard and weather effects.
Abbasi et al. utilized LoRa in smart grid applications and found that LoRa is sensitive to an increase in the number of nodes, thereby increasing the energy consumption [
23]. Furthermore, the employment of a directional antenna approximately fixed the data extraction rate (DER). Prakosa et al. monitored the soil state based on IoT with LoRa for smart agriculture applications in rural areas and concluded that the large coverage influenced by high SF increased delays in data transfer [
24]. The recent epidemic of the SARS-CoV-2 virus prompted Lousado and Antunes to monitor the health of elderly people using LoRa; they perceived that high repetition was influenced by constant connection and LoRa capability was limited owing to its low coverage in that region [
25].
Different applications and scenarios result in differences in the LoRa performance. A LoRa network can be modified and enhanced for effective utilization based on its application.
Parameter optimization and tuning are used to improve the accuracy of several machine learning models that can be used to predict WQI [
26]. Concluded predictive modeling offers an alternative method for calculating WQI and water quality classification (WQC) based on current data [
27]. Kozyrskyi et al. developed a machine learning framework that accurately assessed the water quality index of the Southern Bug River with 92.3% accuracy using random forest, showing the efficiency of machine learning algorithms in predicting water quality indicators [
28]. Parra et al. have developed a novel optical sensor for quantifying and classifying turbidity levels, using an RGB light source and detector, which achieves high accuracy (R2 = 0.979) for quantification and 91.23% accuracy for classification through calibration and testing with exponential Gaussian process regression and K-nearest-neighbor classification [
29]. Zhang et al. propose a novel method that uses image recognition to establish a relationship between pollutant concentration and color and has achieved high accuracy, with four machine learning models achieving an increase of up to 95.9% in the coefficient of determination (R2) compared to principal component analysis (PCA) [
30]. This paper integrates the results of water quality testing with LoRa network properties and packet loss to identify the abnormality of the system, to improve the management of system validation and maintenance requirements.
The remainder of this paper is organized as follows. The parameters, development, and design of autonomous water quality monitoring are elaborated in
Section 2, including descriptions of the LoRa network parameters to be evaluated. The results of the experiment were analyzed and discussed in
Section 3. Lastly, the conclusions and recommendations for future reference were disclosed in
Section 4.
2. Materials and Methods
The laboratory analysis procedure, as described in this study, represents an enhancement of the method initially outlined in IoT architecture-based water resources conservation management using LoRa. The specific modifications made to this procedure are novel and have not been reported in our previous work [
31]. The development process of this system involves selecting water sensor types to be operated with end nodes based on the WQI element and its capability to operate independently in a river environment. The end nodes were integrated into the gateway, and the water quality data transmitted to the LoRa server were verified. The LoRa network performance with different network properties of SF and antenna gains was also evaluated before refining the final network property design to be implemented in a water quality monitoring system. In this study, the gateway server was encoded to connect to ThingsSpeak. Water quality monitoring stations designated for outdoor purposes and monitoring dashboards for user interfaces were built for display and information delivery. The process of this study is summarized in
Figure 1.
2.1. Water Quality Monitoring System Built
The type of water quality sensor was selected based on water characteristics regulated by the WHO. The robustness and reliability of the water quality sensors embedded in the water quality monitoring station were based on the specifications and datasheets supplied. The water quality sensors that were used are listed in
Table 1.
The water sensors (DFRobots, Shanghai, China) were connected to a microcontroller board (TTGO ESP32-LoRa32, Lilygo, Shenzhen, China) at an operating frequency of 868/915 MHz, which is suitable for the Malaysian region [
37]. The end nodes deployed the frequency shift keying (FSK) modulation mode, equipped with a data rate of 1.2 kbps to 300 kbps. The antenna installed at the water station was of the whip 915 MHz omnidirectional type.
Table 2 and
Table 3 describe the LoRa end-node parameter setup with different SF for antenna gains of 2.1 dBi and 3 dBi.
The prototype water quality monitoring station was powered by a polycrystalline solar panel of 6 W/6 V, as shown in
Figure 2.
2.2. Study Setting
The prototype setup was executed at two rivers in Universiti Malaya, Kuala Lumpur, which were Sungai Anak Air Batu and Sungai Pantai, as shown in
Figure 3.
Sungai Anak Air Batu, a tributary of Sungai Pantai, flows from the Damansara area and eventually merges with Sungai Pantai for a total length of 1.93 km. Sungai Pantai is located upstream of the varsity lake and flows for about 1.75 km from the external residential area through a concrete channel inside the campus before passing the varsity lake. Both rivers are connected to the Klang River and finally flow to the ocean; thus, it is important to maintain the cleanliness of these rivers. As Malaysia located in a tropical climate, these rivers have a temperature of between 24.6 °C and 30.6 °C all year. Furthermore, rainfall also remains high year-round, causing less distinction between dry and wet seasons which affecting the condition of the rivers almost daily.
Water stations P1, P2, and P3 were located at three different locations in the rivers at the Universiti Malaya, Sungai Anak Air Batu and Sungai Pantai, at distances of 117 m, 1560 m, and 566 m, respectively, from the gateway, as shown in
Figure 4.
2.3. LoRa Gateway Configuration
The Raspberry Pi HAT (Pimoroni, Sheffield, UK) was assembled using an LPWAN concentrator module deployed as the LoRa gateway. The gateway module included a GPS module and a heat sink. The package was based on the Semtech transceiver concentrator (Camarillo, CA, USA), and the S1257/58 front-end chirps allowed the management of packets from the scattered endpoints [
38].
The gateway operated with the support of the global license-free frequency AS920-923, which corresponds to the location of Malaysia within the Asian region. The antenna gain used for the gateway was 5.8 dBi for a larger spread and better perception in an urban environment.
The gateway was integrated with Balena.io and connected to Thing Stack V3.16.2, using the latest Semtech packet forward protocol. The water quality data and performance of LoRa on the received signal strength indicator (RSSI), signal-to-noise ratio (SNR), downlink, uplink, and packet data can be directly monitored from the server, The Thing Stack.
The system does not require a full-time alert for the end nodes and allows them to fall into the sleep mode. Its purpose is to minimize the power consumption of the end nodes and prolong battery life.
The gateway was positioned on the rooftop of Block C of the Faculty of Engineering at an estimated height of 25 m from the ground, as shown in
Figure 5.
2.4. Water Quality Monitoring Dashboard
The Thing Stack server was programmed to interconnect with the IoT analytic platform, ThingSpeak. ThingSpeak was trained as a cloud to observe, record, and store daily water quality monitoring activities. The recorded water quality data were extracted from the cloud and analyzed for water quality status classification.
An Android APK application was developed using MIT Inventor Developer integrated with ThingSpeak as the GUI. This allows users to acquire and monitor the water quality status of Sungai Anak Air Batu and Sungai Pantai daily. The display includes pH, total dissolved solids (TDS), dissolved oxygen (DO), temperature, and NTU values from the water stations at Sungai Pantai and Sungai Anak Air Batu. The GUI of the Android version of the water quality monitoring dashboard is shown in
Figure 6.
2.5. Evaluation of LoRa Performance
Several network performance indicators were evaluated to verify the implementation of LoRa in a continuous water quality monitoring design. This section discusses the network performance that was evaluated in this study.
First, the commonly inspected network characteristic (Received Strength Signal Indicator) RSSI estimates the strength of the radio signal received during transmission to determine the capability of the device to listen to a signal. The value of the RSSI is affected by the location, the line of sight (LOS) variable, n, and distance between the node and receiver, d, as shown in Equation (1). In addition, the background noise energy influences signal strength, causing communication errors. The expected signal power (ESP), referring to Equation (2), eliminates the impact of the noise effect on the RSSI in Equation (1) and acts as an indicator to measure the exact received power.
The Signal Noise Ratio (SNR) in (2) differentiates the received signals within the spectrum from unfeasible background signals. The SNR is simplified in (3).
where
is the signal power, and
is the noise power. A higher signal power can demodulate the noise signal, thereby eliminating the potentially corrupted signals. The corrupted signals below the noise floor initiate retransmission. Nevertheless, the LoRa technology can demodulate the minimum signal below the noise floor based on its spreading factor.
Next, the observed network characteristic packet loss is usually affected by errors in the lack of signal strength at the receiver, severe system noise, overload of network nodes, network congestion, hardware issues, and distances. Degrading communication from packet loss reduces throughput, security of communication, and causes inadequate data transmission, thereby causing loss in data encryption.
In this study, LoRa is a wireless network that applies the UDP protocol. Although it tolerates packet loss, the sender cannot detect whether packets have been received. The monitoring of packet loss was observed and recorded through the gateway log. Packet loss can be defined by Equation (5),
where PL is the packet loss defined over time with
, sent packet and
, the received packet.
In this study, the conclusion from the K-means clustering result of water quality properties was integrated with packet loss to assist in detecting patterns in network traffic data. This pattern allows the deduction of various possible factors during transmission, such as hardware failure, network congestion, and signal interference.
Reflecting the condition of non-line-of-sight (NLOS) and multipath propagation factors in urban environments requires authentication in wireless medium characterization, such as path loss, shadowing, and multipath fading. Furthermore, the signal values obtained by the IoT platform must adapt to the sensitivity of the transceivers.
Equation (6) defines the corresponding losses and gains of the received power,
at the receiver:
where
is the transmission power, and the gains at the transmitter and receiver are denoted as
and
respectively. The
and
are the expressions of the loss antenna and cable connectors at the transmitter and receiver, respectively, including the loss from environmental influence,
. M is the fading margin between the sensitivity of the receiver and the signal strength level.
In free space propagation, attenuation occurs as the power spreads over the areas. Equation (7) defines received power in free space.
Path loss is generally defined as in Equation (8):
Substitute Equation (7) in (8):
In free space, as
λ (in km) = 0.3/f turn Equation (9) into Equation (10):
The propagation path loss model of the earth plane entailed attenuation from the earth plane influence in Equation (11).
Although there is still a non-definite path loss model for LoRa evaluation, the empirical formulation of the Okumura–Hata model, which can derive the propagation loss in an urban environment, is given by (12).
where
and
are the heights of the receiver and transmitter, respectively; f is the operating frequency (MHz); d is the distance between the transmitter and receiver; and
is the correction parameter that is affected by the type of environment for a large city environment. It can be determine by Equation (13)).
Following the limitation of the Okumura–Hata model, which is applicable to land mobile services with a frequency range of 100–1500 MHz, distances of 1–20 km, and base station height of 30–200 m, Petajajarvi et al. obtained the maximum range for different transmitted powers with a constant variable height from the Okumura–Hata model [
39]. Furthermore, the received power obtained was as low as −120 dBm for the two transceivers, resulting in a lower signal translation. The analysis by Oliveira et al. on the LoRa communication ranges impacted by surroundings resulted in maximum communication ranges of 5.6 km and 2 km in rural and urban environments, respectively [
40]. Furthermore, the received power obtained was as low as −120 dBm for the two transceivers, resulting in a lower signal translation. Rizzi et al. used the Okumura–Hata model to calculate the path loss in an urban environment, requiring a reduction in the signal-to-noise ratio with a higher antenna gain to increase the transmission range [
41].
In a free-space damping propagation application, the usual logarithm extended from (10) and (11) amalgamates with the energy spread and antenna fault, as given by Equation (14).
where
and
are the transmitter antenna gains, and the antenna receiver gain includes feeder losses. The performance of LoRa in an urban environment was evaluated using propagation measurement by Parades et al., who were able to predetermine the interference that occurs during transmission [
42]. The increment in distance increased the loss in free space by 6 dB. Reflection, refraction, and penetration of radio waves affected by the attenuation structure are also significant for the impact of energy losses on the budget link.
The last network performance analyzed is the received power because its quantification links the performance from the link budget. The determination of the received sensitivity corresponds to the minimum power received by the receiver node to decode the transmitted bit promptly. The receiver sensitivity,
applied Equation (15) tolerance to thermal noise.
where BW is the bandwidth and NF is the noise factor, referring to Equation (15). The received power declines as it passes through the channel over a distance and in the environment. The received sensitivity in LoRa can be below −130 dBm to allow interpretation of the lower signal. The received power accumulates all losses and gains, as referred to in Equation (6). Furthermore, setting the value of SF also affects the sensitivity, as it is used to set the data transfer against the range. The setup bandwidth of the receiver operated at 922 MHz and the noise level generated in this study also affected the receiver power level.
3. Results and Discussion
The monitored water quality data were collected and analyzed to validate the compatibility of LoRa as a linkage for autonomous water quality monitoring systems. This section also analyzes and verify the trend of the LoRa performance based on the network characteristics selected in the previous section.
3.1. Water Quality Data
Users accessed the water quality status from the application dashboard, as shown in
Figure 6 in the previous section. The trend of water quality data for each water quality property for the station, as mentioned in the previous section, could be previewed on the Thing Speak monitor dashboard, as shown in
Figure 7.
For further analysis, water quality data were extracted from Thing Speak, which acted as a cloud for data storage. Water quality data were analyzed based on WQI and NWQS by Malaysia for pH, dissolved oxygen (DO), turbidity, temperature, and total dissolved oxygen (TDS).
Table 4 shows the results of the K-means preprocessing of raw water quality data for one month’s observation. Moreover, K-means allowed for the detection of abnormalities in unsupervised water quality data during data collection. The observation relating the K-means results of water quality data and network performance is further discussed in
Section 3.2.2.
Based on the tabulated data in
Table 4, the status of water quality at each station was classified based on the WQI and NWQS standard guide, as shown in
Table 5 [
43].
The pH values for all water stations had similar ranges, with near-neutral pH values of 7. Referring to the WQI and NWQS, the pH of all stations qualified to be included in Class Ⅰ because the range remained within 6.5–8.5. For turbidity, which measures the haziness of water, the value obtained from station P1 was slightly different from that of P2 and P3, with an estimated difference of 30 NTU. However, the water status from all stations classified was included in Class Ⅲ because the turbidity standard tabulated at 0 NTU-50 NTU was above Class ⅡB.
The standard river water temperature in Malaysia ranges from 22.0 °C to 31.7 °C, depending on the seasonal effect. The tabulated data in
Table 4 show that the temperature of river water from all locations fell within the standard range; hence, the class of water temperature based on the WQI and NWQS remained Class Ⅰ. However, the water temperature at station 2 was 2 °C higher than that at the other stations. Therefore, according to NWQS Malaysia, an additional 2 °C from the current average temperature at that time classified the water as Class Ⅱ.
Although the total dissolved solids contained in the water from all water stations fluctuated marginally from each other, their quality remained within Class Ⅰ because the range still fell below 500 mg/L. The last water quality property monitored in this study, dissolved oxygen, was constant at all locations, with a total volume of 8 mg/L. Based on the WQI and NWQS guidelines, the total volume of dissolved oxygen in the river water in this study was suitable for aquatic organisms and labeled as Class Ⅰ.
The conclusions from the analyzed water quality properties were used to classify water into water quality classes based on the WQI and NWQS benchmarks. The class of river at each water station at Sungai Anak Air Batu and Sungai Pantai, Universiti Malaya, was summarized in a pentagonal shape as five parameters of water quality monitored in this study, as shown in
Figure 8. The shape and blue color of the pentagon effectively visualize the summarization of real-time monitoring of water quality to support the study of sampling site data [
44].
Based on the summary pentagonal shape shown in
Figure 8, the water bodies at all locations exhibited a similar trend. The full pentagonal shape classified the water body as Class Ⅰ, but the trend of water in the figures above for all stations had an imperfect shape, as it was affected by the water quality class of turbidity. Water bodies at station 2 were affected by the temperature and turbidity class. In conclusion, the water bodies at Sungai Pantai and Sungai Anak Air Batu at Universiti Malaya are classified as class ⅡB, which are suitable for recreational purposes but are undrinkable. Furthermore, conventional treatments are required for the water supply.
The absolute conclusion based on the WQI calculation of the water quality properties subindex (SI), as shown in (16), cannot be defined as the presence of water quality elements such as ammoniacal nitrogen (AN), biochemical oxygen demand (BOD), and chemical oxygen demand (COD), which cannot be obtained with real-time methods and require laboratory analysis.
While 0 ≤ WQI ≤ 100,
where SIDO is the subindex of dissolved oxygen, SIBOD is the subindex of biochemical oxygen demand, SICOD is the subindex of chemical oxygen demand, and SIAN and SIpH are the subindices of ammoniacal nitrogen and pH, respectively.
The result of river water classification at Universiti Malaya from the early prediction in this study is significant compared to a previous study by Gafri et al., who concluded that the study area contained a moderate level of pollution due to urban activities.
Nonetheless, early prediction from real-time systems allows water environmentalists to periodically monitor the health of water bodies as an early step toward conserving clean river water.
3.2. LoRa Network Performance
The importance of monitoring LoRa network performance during water quality data transmission corresponds to the efficiency of LoRa as a communication bridge for water quality monitoring in real time. The analysis of the network performance for the radio coverage of LoRa is discussed in this section based on the setup of different transmitter antennas, as discussed in the previous section.
3.2.1. RSSI and SNR
The recorded RSSI and SNR from the Thing Stack were measured through standard deviation to observe its spread variance, which was affected by differences in the antenna gain, spread factor (SF), distances, and NLOS.
Table 6 lists the maximum, minimum, and mean RSSI for each LoRa node at all water stations.
The measurement of RSSI determines the quality of the received signal. The minimum acceptable range value of the RSSI for LoRa was −120 dBm, and a low RSSI indicated that the signal was weak.
Table 5 shows that the lowest RSSI recorded was −118 dBm at the second node, P2, which was located farthest from the receiver for SF of 7 and 9. The lowest recorded RSSI was still above the minimum KPI for the RSSI of LoRa and wireless networks. The difference in the antenna gains and spread factors influenced the trend of the RSSI for each distance.
Figure 9 and
Figure 10 show the mean, maximum, and minimum trends of RSSI based on each antenna gain.
As shown in
Figure 9 and
Figure 10, the trends of the minimum and maximum values from the mean RSSI value are spread over certain distances. The increment of antenna gains by 0.9 dBi from 2.1 dBi based on
Figure 10, affected the increment of the maximum and minimum RSSI for all SF from all locations.
The use of a 3 dBi antenna increased the minimum value from the farthest location of node P2 at 1560 m from the receiver with the lowest SF of 7. The minimum and maximum values obtained were −116 dBm, and −110 dBm, respectively. The RSSI of the nearest end node at 117 m from the receiver also showed its best performance antenna gain of 3 dBi, as it reached above −90 dBm even when implied with SF 7.
Furthermore, the spread value of the RSSI was affected by distance, urban environmental influences, weather, interruption of other radio frequencies, and other variables. It can be concluded that the RSSI value of LoRa decreased as the distance increased with the effect of NLOS. In addition, the higher gain of the antenna strengthened the received signal while reducing interference during transmission [
45].
Although the SNR of LoRa can operate below the noise floor, the higher the SNR during data transmission, the higher is the quality of the signal transferred. The SNR collected simultaneously with the RSSI shown in
Table 7 falls below the noise floor for all the minimum, maximum, and mean values from all locations for each implied spread factor.
The accumulated SNR sample value was slightly different from the implied SF value for each distance. The capability of LoRa to allow the signal to travel below the noise floor constructed the KPI of the LoRa demodulator to translate the received signal for SF of 7, 9, and 12 as −7.5 dB, −12.5 dB, and −20 dB, respectively. The recorded SNR value stayed above the KPI of the LoRa demodulator except for that of station P2, which was located 1560 m away from the receiver when SF 7 was implied for both antennas gain of 2.1 dBi and 3 dBi with its mean values of −13.41 and −12, respectively. Although the signal travelled below the noise floor, it could not be interpreted by the demodulator; therefore, it affected the packet data. Further aspects of the SNR are also monitored in
Figure 11 and
Figure 12, which illustrate the minimum, maximum, and mean over distances.
Based on
Figure 11 and
Figure 12, antenna gains of 3 dBi increased all SNR values from station P1 above the noise floor, even with the implementation of SF 7. Nonetheless, SF 7 was inapplicable for station P2, as mentioned previously, because its SNR value did not surpass its KPI of −7.5 dB. Meanwhile, at water station P3, the use of SF 7 and an antenna gain of 3 dBi exceeded its KPI, with a minimum SNR value of −6 dB. Furthermore, the dispersion trend of the SNR for an antenna gain of 3 dBi was smaller and more stable compared with the implementation of an antenna gain 2.1 dBi.
The stability of the SNR trend supported by an antenna gain of 3 dBi can improve the optimization of the transmission and reduce undesirable signals. The increase in antenna gain also increased the signal power to overcome the NLOS and temperature factors. High and stable SNR values reduced packet loss, thus increasing throughput.
Relating the RSSI and SNR is significant to the expected signal power, as shown in Equation (2). ESP information estimates the average desired signal in a noisy environment.
3.2.2. Packet Loss
The execution of the RSSI and SNR corresponds to the dropped packet data.
Table 8 lists the daily average packet losses for each period in which the end node transmits data to the receiver.
Referring to
Table 8, packet loss from both stations P1 and P3 remained below 10% for all conditions, whereas the highest average packet data dropped by 22% from location P2, which was embedded with an antenna gain of 2.1 dBi and SF of 7.
The occurrence of high packet loss was heavily affected by a low SNR that could not be demodulated by the receiver, and the NLOS effect in the urban environment.
The effects of high packet loss degraded the network throughput and increase latency, thereby influencing the accuracy of the water quality data. In addition, the increment in SF increased the latency, thereby affecting the time delay and packet loss, depending on the density of the environment [
46]. However, the packet loss from station P2 was reduced with changes in SF and antenna gain, reaching a maximum of 5.4%.
Nonetheless, absolute prevention of packet loss in any network condition is impossible, but it can be minimized through preventive measures. Sudden changes in data packets support the prediction of network abnormalities.
Anomalies in water quality data caused by high packet loss corrupt and reduce the accuracy of the generated result. A previous method by Jáquez et al. detected an anomaly with a scalar-type program using a Boolean value [
47]. They detected errors in the data owing to malfunctioning hardware from the sensor and the water pump.
In this study, packet loss was integrated with the results of K-means from water quality data to predict anomalies in the data. The observation of K-means from the water quality data integrated with packet loss from all water stations is shown in
Figure 13,
Figure 14 and
Figure 15.
While the trend of K-means of turbidity trends at station 1 was stable as referred to in
Figure 13, TDS had constant fluctuation between 150 and 250 mg/L. However, its packet data operated with a stable trend and a low packet loss rate, which were below 1%. Hence, it can be concluded that the water bodies at station 1 varied in salinity and dissolved content. Water bodies at Station 2 based on
Figure 14 showed stable fluctuations in turbidity and TDS throughout the experimental timeline. There was a high packet loss at Station 2 recorded between November and December 2022 because of the affected transmitted packet data caused by the seasonal change in the monsoon season in Malaysia. At station 3, TDS increased from October 2022 and had the highest record at 250 mg/L in early 2023 with high cloudiness at 400 NTU as shown in
Figure 15. The recorded packet loss at station 3 stayed within acceptable range; hence, water quality properties observed in the data were not affected by the network performance, though the increment of salinity and turbidity were affected by the increment speed of the river during monsoon season in Malaysia. Observations of packet loss and water quality data allow environmentalists to inspect and maintain the condition of water sensors and network performance. By using packet loss as an additional input feature, the proposed solution can better distinguish between true and false positives, resulting in improved overall performance. The integration analysis resulted in enhancements in the water quality monitoring and network performance analysis.
Although the trend of packet loss from Station 2 had a high loss compared to the other stations, the packet loss rates were still within acceptable ranges for low packet data. A previous study by Wei et al. concluded that an increase in communication distance increases the packet loss rate [
48].
Thus, monitoring packet loss in this study was important for troubleshooting the network performance and ensuring the efficiency of operational tasks.
3.2.3. Path Loss
Identifying path loss for wireless network applications in urban environments with possible power attenuation is important for defining the budget link. The path losses in this study were analyzed using the propagation of free space (FSDP), referring to (10), and the Okumura–Hata (Oku–Hata) model, referring to (12). The path losses are presented in
Table 9.
Because the FSDP method includes antenna gain and feeder losses, the path loss with an antenna gain of 3 dBi showed a slight decline from each end node compared to the implementation of an antenna gain of 2.1 dBi. However, there were no differences in path loss when the antenna gain changed with the Oku–Hata method because its significant elements were the height of the transmitter and receiver, frequency, and distances. However, the Oku–Hata method results in a higher path loss than the FSDP method because it accounts for the effects of diffraction, penetration, and reflection of multiple obstacles in the exterior realm. The obtained FSDP for distance with an estimation of 1 km in this study was significant, as calculated by Ali et al. for a similar omnidirectional antenna used for both the receiver and transmitter [
49].
Nevertheless, the use of the FSDP model can provide information for modifications to reduce the average free-space path loss.
3.2.4. Received Power
The computation of the transmission power, gains, and losses influencing the amount of received power has a significant effect on the total budget link. Correlating to the link budget, the findings of the received power and received sensitivity are significant in concluding the value of the fading margin. The result of the fading margin allows the design specification to ensure the system performance level.
This parameter was not widely discussed in a previous study of the LoRa monitoring system, as it is known that the receiver sensitivity of LoRa can operate below −130 dBm. Hence, it allows the interpretation of lower signals; however, it is crucial to determine the minimum strength to be detected and processed for transmission quality assurance.
Table 10 shows a comparison of the total received sensitivity and received power.
The received power gain from all locations could be perceived by the gateway, because the received sensitivity was distributed at a minimum of −129.1 dBm. The received power analyzed from all locations remained below the received sensitivity values. The low value of the received sensitivity in this study allowed the receiver to interpret the weak signals transmitted from the LoRa nodes at each water station. The use of a higher antenna gain in this design system allowed it to maintain a minimum fading margin with an estimation of 10 dB from all distances.
The proposed method for classifying water bodies using K-means on filtered and raw water quality data was found to be effective in real-time classification of water bodies. Additionally, the method provided a simple and informative summary of water quality conditions through a pentagon shape based on the standard water quality index (WQI) provided illustration information and allowed the normal user to understand. The evaluation of LoRa network performance based on antenna comparison showed the ability of LoRa network to adapt to its condition and environment, though the highest packet loss rates exceeded the undesirable value of 3%. The path loss determination provides insight for designing the network properties considering the reflection, diffraction, and penetration effects in non-line-of-sight (NLOS) settings. The design is also able to achieve the good minimum of received sensitivity that allows hearing weak signals in urban areas.
4. Conclusions
The objective of this study was to monitor water quality data in an urban environment using the LoRa network as the primary communication method. Real-time analysis of water quality data allows for a quick decision-making system for water environmentalists to prevent pollution outbreaks. Therefore, evaluating the LoRa network performance for developing an autonomous system signifies its adaptability to operate in an urban environment. A detailed analysis of the RSSI, SNR, packet loss, path loss, and received power demonstrated the LoRa compatibility for independent operation. Changes in the network properties of LoRa, such as SF and antenna gain, heavily impact the performance of the LoRa network. The increase in SF and antenna gain increases the distance, receiver sensitivity, and ability to overcome obstacles within the transmission line. The results can assist different configurations for environmental monitoring with an IoT-based LoRa network in urban settings. Furthermore, the large distance between the end-nodes can reduce the redundancy of packet data. The integration of observations of water quality data from the K-means method and packet loss can be used to analyze the anomaly deduction on instruments, changes in water quality properties, and network performance. Although LoRa is known for its capability to operate below −130 dBm, enhancement of its network properties, such as bandwidth, can improve its efficiency in terms of its and data type.
Finally, this study demonstrates the real-world performance of LoRa as a water quality monitoring communication system, highlighting its various network properties, within an urban area on campus. Future work can focus on the design of water stations and can be adjusted to provide more durable structures. Additionally, analysis of water quality sensor data with water quality data from laboratories can also be investigated further to attain higher accuracy in water categorization for each characteristic.