Integration of IoT Technologies for Enhanced Monitoring and Control in Hybrid-Powered Desalination Systems: A Sustainable Approach to Freshwater Production

: In the face of our rapidly expanding global population, the necessity of meeting the fundamental needs of every individual is more pressing than ever. Human survival depends upon access to water, making it a vital resource that demands novel solutions to ensure universal availability. Although our planet is abundant in water, 97.5% of it is saltwater, compelling nations to investigate ways to make it suitable for consumption. Seawater desalination is becoming increasingly vital for water sustainability. While seawater desalination offers a solution, existing methods often grapple with high energy consumption and maintaining consistent water quality. This paper proposes a novel hybrid water desalination system that addresses these limitations. Our system leverages solar energy, a readily available renewable resource, to power the desalination process, significantly improving its environmental footprint and operational efficiency. Additionally, we integrated a network of sensors and the Internet of Things (IoT) to enable the real-time monitoring of system performance and water quality. This allows for the immediate detection and improvement in any potential issues, ensuring the consistent production of clean drinking water. By combining solar energy with robust quality control via IoT, our hybrid desalination system offers a sustainable and reliable approach to meet the growing demand for freshwater.


Introduction
Access to potable water is pivotal for public health, sustainable development, and social equity.Ensuring the universal availability of clean water is not simply a responsibility, but a crucial investment in the well-being and future adaptability of communities.
Unfortunately, even though water covers nearly 70% of our planet, the availability of water resources suitable for drinking, bathing, and sustaining life is remarkably scarce.In reality, a mere 3% of these extensive water resources qualify as fresh water, with two-thirds of this being trapped in glaciers or otherwise unavailable for immediate use.This hard reality results in a global lack of access to fresh water, precipitating serious challenges.Consequently, insufficient human access to potable water gives rise to severe problems, encompassing dehydration and a lack of sanitation, leading to the spread of serious diseases such as cholera, dysentery, and typhoid.Furthermore, given that agriculture is the largest consumer of water, a shortage of water resources has the potential to contribute to climate change, thereby negatively affecting the world's ecosystem [1].
As the world began to acknowledge these challenges, a movement toward water treatment initiatives emerged.One well-known method is water desalination, a process aimed at removing salts and minerals from salt water.Various techniques can be employed for water desalination, with one notable method being thermal desalination [2].In this approach, heat is utilized to evaporate water, which subsequently condenses to yield potable water.Initially, fuel energy served as the heat source for this type of desalination, but the associated air pollution posed significant issues.Hence, the utilization of solar energy as an alternative heat source became critical.Two categories of solar desalination systems, direct and indirect, have been developed.The direct system employs the same device for both evaporation and condensation, making it more suitable for small communities and households [3].Conversely, the indirect system segregates the desalination unit into a solar collector and a desalination component, with heat applied to a separate medium before being transferred to seawater [4].
Current desalination methods, particularly thermal processes, often rely solely on solar energy, a renewable resource limited by weather conditions.To address this challenge, our novel design incorporates a hybrid power supply system.This hybrid system prioritizes solar energy while seamlessly switching to a backup source (battery or generator) during low sunlight, ensuring consistent desalination operation and reliable freshwater production.This backup source is charged using both solar energy and wind energy.Moreover, traditional desalination systems often struggle to maintain consistent water quality and optimal performance.In contrast, our proposed solution, a novel Internet of Things (IoT)-based solar desalination system, addresses these limitations.Various sensors are integrated to ensure optimal performance under diverse conditions, monitoring factors like temperature, pressure, and water salinity.Even during periods of low sunlight, a heater can be employed to maintain the desalination process.The sensors are connected to the ESP32 microcontroller [5], which facilitates the transmission of real-time data and measurements to the cloud via the Arduino IoT Cloud platform [6].This connectivity allows for remote monitoring of the system's performance and water quality, and enables adjustments to optimize desalination efficiency.Through the development of this system, our primary objectives were to: 1. Develop a desalination system that utilizes renewable energy sources (solar and wind energies) to convert saline water into potable water.2.
Integrate the system at various stages with different sensors and actuators to optimally desalinate water and also ensure higher efficiency and accuracy.

3.
Establish a connection with the cloud to enable remote monitoring and the control of various processes within the system.4.
Conduct experiments to assess the performance of desalination trials under varying weather conditions.
The rest of our paper is structured as follows.Section 2 presents relevant work related to our project, Section 3 introduces the theoretical background, Section 4 illustrates the detailed system architecture, Section 5 outlines the methodology, Section 6 presents the results and a discussion in that regard, and Section 7 provides the performance evaluation of the system.

Related Work
There has been enormous work on water treatment since the Ancient Egypt civilization over 5000 years ago.Their primary goal was to make the water from the River Nile potable and generally suitable for human use [1].Methods like filtration and flocculation were revealed to be effective.While methods to remove salt from water like desalination would come much later, these early efforts laid the cornerstone for future advancements in water purification.
Since that time, various techniques have been utilized to provide fresh water for civilians.For instance, ref. [7] presented a self-sustaining solar desalination system that combined a spray-assisted low-temperature desalination system, solar thermal collectors, and heat storage tanks.The paper presented the development and validation of a mathematical model through laboratory pilot testing, followed by an evaluation of the long-term productivity and energy efficiency under Makkah, Saudi Arabia's climatic conditions.On the other hand, the authors in [8] executed an experimental investigation on the enhancement of a hybrid solar desalination system made up of integrated solar panels with solar stills by employing porous materials and preheating saline water.They preheated the saline water by passing it over the solar panel's front surface before entering the still.The output of the solar panel power is moved to the salty water to raise the still's freshwater production.The study assessed the impact of utilizing black steel wool fibers as a permeable material in the solar still basin under the meteorological conditions of Borg Al-Arab City, Alexandria, Egypt.In [9], the authors explored the impact of incorporating a material known as a phase change material (PCM) for thermal energy storage.Their objective was to assess the system's efficiency in saving energy and reducing the environmental impact in comparison to a traditional solar still without this material.The experiments were conducted in various weather conditions in Alexandria, Egypt.The findings indicated that the inclusion of a PCM increased the overall energy savings.However, the energy payback time, or the time it took to recover the energy invested in constructing the system, was found to be relatively lengthy.In another investigation [10], a solar still was enhanced by employing both cylindrical parabolic collectors and solar panels.The solar panels, with a capacity of 300 W, were utilized to heat saline water through thermal elements positioned outside the solar still unit.The researchers aimed to enhance the efficiency of the solar panels by reducing their temperature.This was achieved by implementing cooling mechanisms for the solar panels during the hot hours of the day.Additionally, artificial neural networks (ANNs) were utilized to model the experiments.The results demonstrated a significant correlation between the experimental data and the neural network models, highlighting the accuracy and reliability of ANNs in predicting and understanding the performance of the solar still unit.While these studies mainly focused on employing solar energy as a source for heating water to produce potable water, other studies explored different techniques in their desalination systems.This can be seen in [11], where the authors mainly focused on the utilization of reverse osmosis in water desalination.However, to avoid the ecosystem damage that might be caused by largely concentrated brine, they introduced a new system that combined reverse osmosis desalination, absorption cooling, and a heating system to produce fresh water and cooling simultaneously, offering potential benefits in terms of energy consumption, economic efficiency, and environmental impact.In a similar study, the authors in [12] investigated the utilization of reverse osmosis (RO) in brackish water treatment.Nonetheless, a photovoltaic (solar) system was installed to power the RO system.A hybrid inverter and manual tracking mechanism were used to optimize solar energy utilization throughout the day.The researchers evaluated the system's performance by analyzing the effect of membrane pressure, feed water temperature, and feed water salinity on water productivity.They also assessed the impact of PV system tracking and cooling on PV power.Additionally, the pH, total dissolved salts (TDS), and other parameters were determined in this study by conducting water quality tests.
While RO desalination systems have been extensively studied for their effectiveness in producing clean drinking water [13], alternative technologies like multi-effect distillation (MED) have also earned attention.Studies exploring the application of MED in water treatment have shown promising results.For example, one study [14] introduced a new plant configuration for a small-scale multi-effect distillation system.Their aim was to better exploit the energy content of different streams by improving the heat recovery.The proposed configurations were analyzed from a thermodynamic and economic perspective.The authors conducted numerical simulations using Aspen Plus software (version 10), varying the top brine temperature while keeping the bottom brine temperature fixed at 40 • C. The simulations showed that configurations implementing seawater preheating improved the performance ratio by up to 10% compared to the base configuration.In a similar study, the researchers in [15] proposed an optimized multi-effect distillation (MED) process for solar-driven desalination to handle technical challenges such as high-energy consumption, the intermittency of solar radiation, and high water consumption.The system utilized a linear Fresnel collector to provide steam at 70 • C and 0.3 bar for the MED process.In their system, they integrated an air-cooled condenser instead of a water-cooled condenser, which reduces the water cooling facilities.The system was modeled using an engineering solver equation tool and the simulation was performed under the weather conditions in Qatar.The system achieved significant reductions in energy consumption, equivalent mechanical energy, and water usage compared to existing commercial MED facilities, making it a promising solution for freshwater scarcity.
Even though previous studies have achieved promising results in brackish water treatment, an avenue for further improvement lies in integrating IoT technologies with water desalination systems.By utilizing IoT systems, real-time monitoring, remote control, and data-driven decision-making can be achieved.As an example, sensors can continuously monitor the water quality, weather conditions, and overall system performance.Several studies have examined the integration of IoT technology in water desalination systems, illustrating its potential for enhancing efficiency and performance.This can be seen in [16], where the authors designed a smart solar still prototype for water desalination.Their system consisted of a basic solar still, a solar preheater, and a remote monitoring system based on IoT techniques.The monitoring system was developed and integrated into the hybrid solar still to control its evolution online as well the quality of the freshwater provided by checking measured parameters such as pH.In [17], the authors proposed a smart environment and implementable water treatment model that integrated IoT, solar-powered sensors, and cloud-based technologies to analyze data and provide efficient approaches for water desalination operations.The implemented dual membrane desalination framework utilized solar energy and ancient purification methods to produce clean water for drinking and irrigation.Similarly, another study [18] highlighted the need for creative desalination technology and optimized resource usage.The proposed IoT-based system effectively monitors and controls the water quality parameters, provides notifications for malfunctioning, and regulates gate valves to prevent system failure and reduce maintenance costs.The findings from the performed experiments demonstrate its excellent performance compared to other methods, with significant time extensions achieved.
However, a closer investigation of the existing studies revealed several limitations such as the lack of integration of IoT technology, limited sensor integration, and the absence of comprehensive control mechanisms.These limitations provide an opportunity for further innovation and improvement in the field.Hence, our study aimed to overcome these gaps by designing a water desalination system that integrates IoT technology and incorporates multiple sensors for real-time monitoring and control.Our research addresses the need for the continuous monitoring of weather conditions, water temperature, water level, and water quality, allowing for meaningful decision-making and optimization of the desalination process.Furthermore, we enable remote monitoring and control, provide realtime insights into the system's performance, and promote efficient operation.Consequently, our significant contributions in this field of study can be briefly summarized as follows: 1.
Built a solar-powered desalination system that can be deployed in remote areas with limited access to grid electricity, providing a clean water source through a renewable energy source.

2.
Integration of IoT technology: To enhance the system's functionality, we integrated IoT technology by incorporating various sensors to monitor different operational scenarios.Through the utilization of the Arduino IoT cloud platform, our system enables remote monitoring and control, providing real-time insights and the ability to make informed decisions remotely.

3.
Implementation of a hybrid power supply: Acknowledging the importance of sustainable energy sources, we implemented a hybrid power supply for our system, utilizing both solar and wind energy.The energy generated is stored in rechargeable batteries, ensuring its availability for later use, even during periods of limited solar or wind energy availability.This enables the system to be employed in remote areas where there is limited access to electricity or other sources of nonrenewable energy.
In the subsequent sections, we will provide a comprehensive review of the systematic development and implementation of our water desalination system.

Theoretical Background
There has been a continuous global movement toward creating a more sustainable world for future generations.A key aspect of this effort is the reduction in climate change impacts and the reliance on fossil fuels through the adoption of sustainable energy resources.Among the available renewable energy options, solar energy and wind energy have appeared as notable candidates, offering clean and rich sources of power.However, effectively utilizing and optimizing these renewable energy resources, quantifying their energy output, and implementing efficient energy storage solutions require a scientific framework supported by a comprehensive understanding of their underlying mechanisms.Therefore, in this section, we aim to outline the theoretical foundation of these mechanisms, taking into account various factors to enable accurate predictions and inform better deployment strategies.

Solar Energy Conversion
Concentrated or unconcentrated sunlight can be utilized to generate heat for direct use or electricity conversion.By solar energy conversion, we mean converting the solar radiation into electricity by exciting the electrons in a solar cell [19,20].Several factors affect solar energy conversion, here are some elementary considerations: 1.
Solar irradiation: Most solar energy technologies rely on solar irradiation to provide energy and for designing related systems such as photovoltaic systems.Irradiation is a measure of the sunlight energy density; it is used to estimate how much solar energy is available [21].The expression to calculate solar irradiance or the amount of energy received from the Sun on a given surface area, is given by Equation (1).
I. solar const.is the amount of atmospheric transmittance = 1360 W/m 2 ; II.θ is the zenith angle, which is the angle between the sun ′ s rays and a perpendicular line to the earth; III.f 1 and f 2 is related to condition factors.

2.
Absorption of sunlight: Photovoltaic cells (PV), which convert solar energy into electricity, depend on the absorption of photons, the fundamental particles of light.The absorption of these photons causes a generation of the flow of electric current, known as photocurrent, denoted as I s .Simultaneously, a voltage is generated across the PV cells, which is known as photovoltage and is denoted by V s .The efficiency of converting solar power to electrical power (known as solar cell efficiency) depends on the product of the photocurrent and photovoltage, divided by the incident solar irradiant power [22].The basic formula of the solar cell efficiency is denoted by Equation (2).
where Area is the panel area.

Solar energy storage in rechargeable batteries
One of the drawbacks of solar energy is the intermittency of photovoltaic output power, which is directly dependent on the availability of solar irradiance [23].However, a solution to this shortcoming is the use of rechargeable batteries.Rechargeable batteries provide the advantage of continuous and long-term charge/discharge cycles.When an electric current flows through the semiconductor material, a direct current is created within the solar cell.In this case, a charge controller is utilized to regulate the charging of the batteries and limit the discharging [24].At this point, the batteries store excess solar energy during periods of high generation in the form of chemical energy for later use.On the other hand, during periods of low solar energy generation, the energy stored in the batteries is discharged.An inverter system is then used to convert this stored energy into AC for use by electric devices.However, charging batteries using solar panels usually takes time.This time depends on the capacity of the battery and the power of the solar panel.Equation ( 3) indicates how to calculate the time needed for charging the battery using the solar panel.time needed to charge(h) = battery capacity (Wh) solar panel power (W) However, this equation gives the minimum time needed for charging when the solar panel is exposed to optimal conditions.Other factors like charging efficiency, sunlight variations, and real-world conditions may affect the charging period [25].

Micro/Small-Scale Wind Energy Conversion
Wind energy conversion (WEC) is a system that converts wind energy to rotational or mechanical energy, which is then converted to electrical energy [26].The wind energy conversion system is composed of several components, which include a wind turbine that captures the kinetic energy of the wind and converts it into rotational energy, a generator that is responsible for converting the rotational energy into electrical energy, and a power electronic system, which regulates the flow of electrical power [27].However, the smallscale wind energy conversion system is also designed to produce electric energy from wind, but with small turbines such as a fan and a micro-electrical generator.In both systems, the produced electrical energy mainly depends on various factors, which encompass: Wind speed: This is a critical factor that affects electricity production.There is a proportional relationship between the wind speed and the energy production.This implies that as the wind speed increases, there will be an increase in the production of energy [28].

2.
Temperature and air density: The temperature of the air affects its density, and hence affects the power that exists in the wind.

3.
The characteristics of a wind turbine: The size, shape, turbine's cut-in wind speed, and the rated power capacity of the turbine.
Hence, the power that can be generated by wind is given by Equation ( 4) [29]: I. ρ is the density of the air in kg/m 3 ; II.A = cross sectional area of the wind in m 2 III.v = velocity of the wind in m/s.

Wind energy storage in rechargeable batteries
Similar to solar energy storage in rechargeable batteries, the energy generated from the wind turbine is used to charge batteries by connecting the wind turbine to a charge controller that will manage the charging process and ensure the limiting of the discharging.Likewise, here the time needed to charge batteries depends on the capacity of the battery and the output power of the wind turbine.Equation ( 5) illustrates the formula used to calculate the time for charging batteries using wind power.time needed to charge(h) = battery capacity (Wh) wind turbine power (W) (5) This formula is valid in ideal conditions when the wind turbine is expected to give its peak voltage.In reality, this time will vary depending on the wind conditions and other factors.

System Architecture Design
In this section, we outline the main components of the system, their interactions, and the flow of the data.However, as our system comprises both the water desalination system and the connected IoT system, we will introduce two system designs: one representing a sketch diagram of the desalination system, and the other representing the electrical design.

Desalination System Architecture
This architecture represents the main components of the desalination system, where water is intended to be heated, evaporated, condensed, and consequently, produce potable water.Figure 1 presents the block diagram of our desalination system.The main components of this system are:

■
The metal desalination tank: The metal desalination tank is where all the magic is supposed to happen.Specifically, the water will be heated, leading to the production of vapor.This vapor will rise, hitting the glass surface.Subsequently, it will condense and flow down through pipes connected to the freshwater tank.Although the tank is predominantly made of metal, its bottom is covered with a wooden layer, which is further insulated by a black insulating layer designed to preserve the heat of the water.Moreover, the tank is topped with a glass cover.This design allows the water inside the tank to be heated, and when it evaporates, it will hit the cover, facilitating the condensation process.

■
The salty water tank holds the saline water, which is the water that needs to be treated.It is connected to an electrical pump that facilitates the transfer of water to the desalination tank.This formula is valid in ideal conditions when the wind turbine is expected to give its peak voltage.In reality, this time will vary depending on the wind conditions and other factors.

System Architecture Design
In this section, we outline the main components of the system, their interactions, and the flow of the data.However, as our system comprises both the water desalination system and the connected IoT system, we will introduce two system designs: one representing a sketch diagram of the desalination system, and the other representing the electrical design.

Desalination System Architecture
This architecture represents the main components of the desalination system, where water is intended to be heated, evaporated, condensed, and consequently, produce potable water.Figure 1 presents the block diagram of our desalination system.The main components of this system are:  The metal desalination tank: The metal desalination tank is where all the magic is supposed to happen.Specifically, the water will be heated, leading to the production of vapor.This vapor will rise, hitting the glass surface.Subsequently, it will condense and flow down through pipes connected to the freshwater tank.Although the tank is predominantly made of metal, its bottom is covered with a wooden layer, which is further insulated by a black insulating layer designed to preserve the heat of the water.Moreover, the tank is topped with a glass cover.This design allows the water inside the tank to be heated, and when it evaporates, it will hit the cover, facilitating the condensation process.


The salty water tank holds the saline water, which is the water that needs to be treated.It is connected to an electrical pump that facilitates the transfer of water to the desalination tank. Potable (freshwater tank): This tank holds the freshwater resulting from the condensation of the heated water.It is connected to pipes that transfer water from the desalination tank to the freshwater tank.

The System's Circuit Design
In our exploration of the circuit design of the system, our goal was to explain the complexities of the components responsible for powering and controlling various processes.This involves a detailed examination of the power distribution, control mechanisms, and the interconnectivity that forms the backbone of our integrated system (Figure 2).The system comprises four main circuits, each specialized to specific measurements and control functions within the desalination system.These four circuits are: In our exploration of the circuit design of the system, our goal was to explain the complexities of the components responsible for powering and controlling various processes.This involves a detailed examination of the power distribution, control mechanisms, and the interconnectivity that forms the backbone of our integrated system (Figure 2).The system comprises four main circuits, each specialized to specific measurements and control functions within the desalination system.These four circuits are:

Humidity and temperature circuit
This circuit is responsible for measuring the humidity and temperature of the surrounding environment, enabling us to determine the optimal conditions for utilizing solar energy to heat the water within the desalination tank.The main components of this system include:  DHT11 humidity and temperature sensor [30]: This sensor measures the temperature of the surroundings in Celsius as well as the relative humidity. ESP32 [5]: This is a microcontroller that integrates Wi-Fi and Bluetooth capabilities.It receives the measurements from all sensors connected to it including the DHT11 sensor.

Water temperature circuit
This circuit is tasked with measuring the temperature of the water inside the desalination tank.If the water temperature falls below a predefined threshold, the circuit activates a heater responsible for heating the water.The main components of this circuit include:  DS18B20 waterproof temperature sensor [31]: This sensor measures the temperature of the water inside the tank and sends the measurements to the microcontroller. 12V 40 W ceramic cartridge heater [32]: This is a heating element that heats the water inside the tank if the measurements of the temperature sensors are below the specified threshold.


Relay: This provides electrical isolation between the controlling circuit (the temperature sensor) and the controlled circuit (the heater).

Humidity and temperature circuit
This circuit is responsible for measuring the humidity and temperature of the surrounding environment, enabling us to determine the optimal conditions for utilizing solar energy to heat the water within the desalination tank.The main components of this system include: ■ DHT11 humidity and temperature sensor [30]: This sensor measures the temperature of the surroundings in Celsius as well as the relative humidity.
■ ESP32 [5]: This is a microcontroller that integrates Wi-Fi and Bluetooth capabilities.It receives the measurements from all sensors connected to it including the DHT11 sensor.

Water temperature circuit
This circuit is tasked with measuring the temperature of the water inside the desalination tank.If the water temperature falls below a predefined threshold, the circuit activates a heater responsible for heating the water.The main components of this circuit include: ■ DS18B20 waterproof temperature sensor [31]: This sensor measures the temperature of the water inside the tank and sends the measurements to the microcontroller.

■
12V 40 W ceramic cartridge heater [32]: This is a heating element that heats the water inside the tank if the measurements of the temperature sensors are below the specified threshold.

■
Relay: This provides electrical isolation between the controlling circuit (the temperature sensor) and the controlled circuit (the heater).

Water level circuit
This circuit is designed to measure the water level inside the tank.If the water falls below a defined threshold, the electric pump will activate to pump water into the tank.The main components of this circuit are: ■ Water level sensor [33]: This device is used to detect and monitor the level of water inside the desalination tank.It is positioned inside the desalination tank.

■
Electric pump (diaphragm pump): The electric diaphragm pump is a type of positive displacement pump that utilizes a flexible diaphragm for fluid movement.When measurements received from the water level fall below the specified threshold, the microcontroller triggers the pump to move water into the tank.This mechanism ensures that the water level is maintained by activating the pump in response to the ultrasonic sensor's readings.

Output water quality circuit
The purpose of this circuit is to assess the quality of water following the desalination process, ensuring that it is suitable for human consumption.The primary components of this circuit include: ■ Gravity analog TDS sensor [33]: This is a type of sensor designed to measure the total dissolved solids (TDS) in water.TDS is a measure of the concentration of dissolved substances including salts and minerals in water.■ DS18B20 waterproof temperature sensor: The TDS sensor's readings are affected by the water temperature, emphasizing the necessity to measure the water temperature for an accurate evaluation of the total dissolved solids in the water.

Communication Protocol
The smooth and reliable operation of our IoT system depends on the selection of appropriate protocols and security measures.While the foundational Internet Protocol (IP) ensures network communication, the Arduino Cloud IoT platform primarily uses the MQTT (Message Queuing Telemetry Transport) protocol at the application layer for device communication with the cloud.This message-oriented protocol is lightweight and widely implemented, following a publish-subscribe programming model.MQTT is popular in IoT applications because it uses minimal network bandwidth compared to other application layer protocols like HTTP [34].

System Security
Our system comprises different physical parts connected to the Internet.Securing these components from cyber-physical attacks is crucial to prevent manipulation or potential damage.Furthermore, our system collects sensitive data such as water quality measurements, system performance parameters, and operational data.Ensuring the security of the system's data is important to prevent unauthorized deployment or data theft.By securing the system against unauthorized access, we can prevent unauthorized changes to system settings such as altering the status of the heater or the pump.To address these security concerns, we utilized two specific security measures: access control and network behavior analysis.These measures will be briefly discussed in the following subsection.

Access control
Arduino IoT Cloud provides several control settings to prevent access to the platform, except for authorized people.These settings are:

1.
Authentication: A support authentication mechanism is provided by the Arduino IoT Cloud platform.This includes username/password-based authentication and token-based authentication for ensuring secure communication between the devices and the cloud.

2.
Device authorization: Device authorization involves generating an Arduino device secret key file when first connecting a device to the Arduino Cloud.This file contains the device ID and secret key, which are used to establish the connection between the device and the cloud.The advantage is that when programming the device using the Arduino Cloud full editor, unlike other cloud platforms, the secret key and the device ID are not included inside the code.This makes it more robust against any possible attack or credentials theft.

Network behavior analysis
In general, network behavior is analyzed to detect unusual patterns of activity in network traffic.However, in IoT applications, network analysis focuses on ensuring secure communication between the device and the network, preventing attacks or data redirection to unintended destinations.To achieve this, we utilized the Wireshark application, which provides detailed information about the network behavior by analyzing network traffic and inspecting the packets exchanged between network devices.This analysis is crucial for detecting anomalies and identifying potential security threats such as unauthorized access attempts or suspicious network behavior.

Power Management
As previously declared, this system is categorized as a direct desalination system as it utilizes solar energy to heat water within the desalination tank.However, potential challenges may emerge in colder weather conditions.Additionally, the circuits integrated into this system require a stable power supply for optimal operation.To address this, we designed an alternative energy supply circuit that ensures the necessary power for the implemented circuits.The alternative circuit incorporates two primary energy sources, solar energy and wind energy, depending on the current weather conditions.

Solar energy supply
This circuit works to utilize solar energy efficiently by employing a solar cell, the charge controller, and rechargeable battery.The fundamental configuration of this circuit is described in Figure 3.Following this setup, the solar panel or photovoltaic panel captures sunlight and converts it into electrical energy.The charge controller is responsible for tracking the charging process, ensuring that the battery is safeguarded against overcharging and over-discharging.At the same time, the rechargeable battery stores the energy generated by the solar panel for later use.

Network behavior analysis
In general, network behavior is analyzed to detect unusual patterns of activity in network traffic.However, in IoT applications, network analysis focuses on ensuring secure communication between the device and the network, preventing attacks or data redirection to unintended destinations.To achieve this, we utilized the Wireshark application, which provides detailed information about the network behavior by analyzing network traffic and inspecting the packets exchanged between network devices.This analysis is crucial for detecting anomalies and identifying potential security threats such as unauthorized access attempts or suspicious network behavior.

Power Management
As previously declared, this system is categorized as a direct desalination system as it utilizes solar energy to heat water within the desalination tank.However, potential challenges may emerge in colder weather conditions.Additionally, the circuits integrated into this system require a stable power supply for optimal operation.To address this, we designed an alternative energy supply circuit that ensures the necessary power for the implemented circuits.The alternative circuit incorporates two primary energy sources, solar energy and wind energy, depending on the current weather conditions.

Solar energy supply
This circuit works to utilize solar energy efficiently by employing a solar cell, the charge controller, and rechargeable battery.The fundamental configuration of this circuit is described in Figure 3.Following this setup, the solar panel or photovoltaic panel captures sunlight and converts it into electrical energy.The charge controller is responsible for tracking the charging process, ensuring that the battery is safeguarded against overcharging and over-discharging.At the same time, the rechargeable battery stores the energy generated by the solar panel for later use.

Wind energy power supply
This circuit has the same principle as the solar energy power supply, but instead of using a solar panel, here we used a DC motor.The DC motor is driven or rotated by the wind, which in turn, will act as a generator that will generate electricity based on the principle of electromagnetic induction.

Methodology
The main goal of this research was to develop a sustainable and efficient desalination system that utilized wind and solar energy while incorporating IoT technology for remote monitoring and control.To achieve this, we followed a step-by-step methodology, where we started with the system design and ended with a performance evaluation.Therefore, in this section, we introduce a comprehensive review of the research approach and process followed to design and implement the desalination system integrated with IoT technology.This includes the process of system design, the experimental setup, data collection procedures, IoT integration, and renewable energy integration.

System Design
As mentioned in earlier sections, the desalination system must hold several characteristics to achieve the optimal results.These features encompass the thickness and dimensions of the glass enclosure, the dimensions of the metal tank, and additional components like the pipes within the tank.Moreover, the system includes openings for the installation of sensors and outlets for extracting potable water.Figures 4 and 5 illustrate the designed system after implementation.
monitoring and control.To achieve this, we followed a step-by-step methodology, where we started with the system design and ended with a performance evaluation.Therefore, in this section, we introduce a comprehensive review of the research approach and process followed to design and implement the desalination system integrated with IoT technology.This includes the process of system design, the experimental setup, data collection procedures, IoT integration, and renewable energy integration.

System Design
As mentioned in earlier sections, the desalination system must hold several characteristics to achieve the optimal results.These features encompass the thickness and dimensions of the glass enclosure, the dimensions of the metal tank, and additional components like the pipes within the tank.Moreover, the system includes openings for the installation of sensors and outlets for extracting potable water.Figures 4 and 5

Experimental Setup
Our system was designed to achieve the production of potable water while utilizin IoT technology for remote monitoring and control.However, to ensure the system's effec tiveness throughout various environments and under different circumstances, it was nec essary to conduct experiments involving multiple variables.These experiments focuse

Experimental Setup
Our system was designed to achieve the production of potable water while utilizing IoT technology for remote monitoring and control.However, to ensure the system's effectiveness throughout various environments and under different circumstances, it was necessary to conduct experiments involving multiple variables.These experiments focused on heating water, charging the batteries, and measuring the connectivity values of the resulting water in different experimental setups.In the following subsections, we introduce the experiments conducted and declare the variables used in each experiment.

Environmental description
The system was built in Beit Sahour city in Palestine.The system construction was finished in December 2023, during the winter season.However, it was tested at the end of December and at the beginning of January.According to the National Aeronautics and Space Administration, the average temperature in Beit Sahour in December on a typical day ranges from a high of 67 • F (19 • C) to a low of 48 • F (9 • C), while in January it ranges from a high of 63 • F (17 • C) to a low of 44 • F (7 • C).It is described as mildly cool, accompanied by a gentle breeze.The average day in Beit Sahour during December has 10.1 h of daylight, with sunrise at 06:29 and sunset at 16:37; during January, it has 10.3 h of daylight, with sunrise at 06:37 and sunset at 16:57.In December, Beit Sahour is reasonably humid with an average amount (57%) of relative humidity, which could be described as comfortable.However, it is moderately humid in January, with an average amount (62%) of relative humidity, which could be described as humid but cool.On the other hand, January also has the highest relative humidity of 62%.The wind in Beit Sahour during December blows at an average speed of 11.2 mph (18.0 kph) whereas January is the windiest month with an average wind speed of 11.6 mph (18.6 kph).
Despite these weather conditions not being relatively suitable for heating water inside a solar desalination system, we still conducted experiments during sunny days in January, where the temperature reached its highest, 22 • C, and the relative humidity was approximately 40%.

System's variables
To effectively evaluate the system performance, it is essential to identify several system variables related to the surroundings, the water inside the desalination tank, and the resultant potable water.These variables include: (1) Solar irradiation intensity: This variable was collected using the Photovoltaic Geographical Information System, which provides daily, monthly, and annual photovoltaic data.(2) Surrounding temperature and relative humidity: This variable was identified using a DHT11 sensor.(3) Water temperature: Both the saltwater temperature and potable water temperature were collected using a DS18B20 sensor.(4) Water flow rate: A water level sensor was used to collect these variable data.
(5) Salinity levels: A TDS gravity sensor was used to measure the salinity level before and after the desalination process.(6) Energy production and consumption: A power bank was used to provide energy for the system components; this power bank had an indicator of the consumed and remaining energy.

Data Collection Procedure
After implementing the solar desalination system, we connected the circuit and inserted each sensor and the other system components where they belonged.The ESP32 was programmed using the Arduino IDE environment.Before connecting the system with the IoT cloud platform, we used the serial output of the Arduino IDE to monitor and collect data in different conditions.After that, we ran two main experiments: one in a controlled environment, and the other in an uncontrolled or natural environment.This was performed to gain insights into how the desalination system will operate in ideal and real-world conditions.By doing this, we were able to identify the possible limitations and compare the results that were obtained in different settings.Both experiments will be clarified in the following subsections.

Controlled-environment experiment
The main objective of this type of experiment is to control factors that might influence the system's performance, especially considering that the system was constructed during winter, when low temperature and high humidity can strongly affect its operation.Therefore, we aimed to isolate the system from real weather conditions and create a controlled environment.
To achieve this, we manipulated and controlled the surrounding environment by experimenting in a closed room at room temperature.Additionally, we regulated the temperature of the saline water with an electric heater.Specifically, the experiment was conducted in a room with a temperature of 21.8 • C and a relative humidity of 47%.
We initiated the experiment by heating the water, which in the beginning had a temperature of 18.6 • C until it reached 70.5 • C. The TDS value, the concentration of dissolved solids in the water, was 2782 ppm.
Uncontrolled/real-world environment experiment This experiment was conducted to observe how the system would operate in a realworld environment.However, despite the cold weather conditions, we selected a sunny day in January to conduct this experiment.The outside temperature was 20.2 • C, the relative humidity was 47%, the wind speed was 7 km/h, and the solar irradiation was 147.73 kWh/m 2 .The tank, along with its components, was placed on the roof to ensure the maximum exposure to sunlight for heating the water.The system remained in place for approximately 6 h.The initial water temperature was recorded as 18 • C.However, despite the relatively long duration, the water temperature only reached 30 • C.

IoT Integration
Connecting the system to the Internet has several advantages: it allows for remote monitoring and control, supports process automation, and enables real-time communication.To leverage these benefits, we created an account on the Arduino Cloud IoT platform.This platform offers the capability to create devices and add different variables associated with them.Within this cloud platform, we developed a dashboard and included various widgets to display the sensor measurements and control actuators.Moreover, the platform provides a mobile application for system monitoring and control via smartphones.Additionally, we implemented triggers to send mobile notifications when the actuators are turned on or off.Figures 6-8 illustrate the system's connection with the cloud.
This platform offers the capability to create devices and add different variables associated with them.Within this cloud platform, we developed a dashboard and included various widgets to display the sensor measurements and control actuators.Moreover, the platform provides a mobile application for system monitoring and control via smartphones.Additionally, we implemented triggers to send mobile notifications when the actuators are turned on or off.

Renewable Energy Integration
One of the primary objectives of this project was to exploit renewable energy resources to enhance the energy efficiency of the system, enabling its operation in various environments and under different circumstances.To power the system, we utilized a power bank with a capacity of 10,000 mAh, constructed using Li-ion technology.To charging the power bank using solar energy, we employed a solar panel with an output power of 1500 W (250 mA × V) and an area of 107.25 cm 2 .Additionally, to charge the power bank using wind energy, we connected a small fan with a DC generator.Both the solar panel and the DC generator were connected to a charge controller to facilitate the management of the charging process and implement discharge limitation measures.

Results and Discussion
Since we conducted two types of experiments, controlled-environment and uncontrolledenvironment experiments, there were two main results.These results were observed and collected using the Arduino IoT Cloud dashboard, which was previously created to monitor the sensors' measurements and control the working of the actuators.In this section, we outline and discuss these results.

Controlled-Environment Experiment Results
As previously stated, the main objective of performing this experiment was to observe how the system would operate in ideal conditions.The primary results we were interested in were the tank water temperature, resultant water temperature, and the TDS values of the resultant water.Figures 9 and 10 illustrate these values before and after starting the desalination process.

Renewable Energy Integration
One of the primary objectives of this project was to exploit renewable energy resources to enhance the energy efficiency of the system, enabling its operation in various environments and under different circumstances.To power the system, we utilized a power bank with a capacity of 10,000 mAh, constructed using Li-ion technology.To charging the power bank using solar energy, we employed a solar panel with an output power of 1500 W (250 mA × V) and an area of 107.25 cm 2 .Additionally, to charge the power bank using wind energy, we connected a small fan with a DC generator.Both the solar panel and the DC generator were connected to a charge controller to facilitate the management of the charging process and implement discharge limitation measures.

Results and Discussion
Since we conducted two types of experiments, controlled-environment and uncontrolled-environment experiments, there were two main results.These results were observed and collected using the Arduino IoT Cloud dashboard, which was previously created to monitor the sensors' measurements and control the working of the actuators.In this section, we outline and discuss these results.

Controlled-Environment Experiment Results
As previously stated, the main objective of performing this experiment was to observe how the system would operate in ideal conditions.The primary results we were interested in were the tank water temperature, resultant water temperature, and the TDS values of the resultant water.

Discussion
We observed a notable difference between the TDS values of the water before desalination (1456 ppm) and the TDS values of the resulting water (157 ppm).The water had experienced significant purification, removing most of the existing particles.However, it is widely known that the TDS value of rainwater typically falls within the range of 1-50

Discussion
We observed a notable difference between the TDS values of the water before desalination (1456 ppm) and the TDS values of the resulting water (157 ppm).The water had experienced significant purification, removing most of the existing particles.However, it is widely known that the TDS value of rainwater typically falls within the range of 1-50 ppm.Therefore, when comparing our resulting water's TDS values, we noticed that they were higher.This difference is likely because the TDS values were measured from the water extracted from the pipe rather than directly from the condensed drops.Consequently, some particles may have been captured during the water's movement through the system.

Uncontrolled-Environment Experiment
This experiment was conducted in an open area, with no control of the outside temperature, humidity, and sunlight.We aimed to observe how the system would operate in real-world circumstances.The measured values before and after experimenting are outlined in Figures 11 and 12.

Discussion
The system was positioned in an open area for approximately 6 h.However, the temperature of the water inside the tank only reached 20.2 °C.Additionally, the TDS value of the water within the tank was relatively high, measuring 2042 ppm.After conducting the desalination process, the resultant water's TDS value decreased to 294 ppm.Although this value was lower than the initial TDS value, it still exceeded the typical TDS range of rain-

Discussion
The system was positioned in an open area for approximately 6 h.However, the temperature of the water inside the tank only reached 20.2 °C.Additionally, the TDS value of the water within the tank was relatively high, measuring 2042 ppm.After conducting the desalination process, the resultant water's TDS value decreased to 294 ppm.Although this value was lower than the initial TDS value, it still exceeded the typical TDS range of rainwater.This suggests that some particles from the external environment may have entered

Discussion
The system was positioned in an open area for approximately 6 h.However, the temperature of the water inside the tank only reached 20.2 • C. Additionally, the TDS value of the water within the tank was relatively high, measuring 2042 ppm.After conducting the desalination process, the resultant water's TDS value decreased to 294 ppm.Although this value was lower than the initial TDS value, it still exceeded the typical TDS range of rainwater.This suggests that some particles from the external environment may have entered the freshwater collector.

Energy Production Results
Within this section, we present the results obtained from our energy production attempts.The results illustrate the overall performance of the energy production technique, providing valuable insights for future developments and optimizations.

Solar energy production results
In our evaluation of solar energy production, we initiated the analysis by calculating the solar cell efficiency using Equation ( 2) Given the specific parameters: I S = 250 mA = 0.25 A, vs. = 6 V, Area = 107.25 cm 2 = 0.010725 m 2 .
The determined solar cell efficiency of approximately 13.96% was comparatively lower than the typical range of 15% to 25% observed in home solar panels.This discrepancy can be attributed to the smaller area of the solar panel.However, for the purposes of our demonstration, the system functioned effectively in charging the associated power bank.
Additionally, we calculated the estimated charging time for the power bank using Equation (3).The calculated time needed to charge the power bank with the available solar panel was approximately 6 h.However, in practical scenarios, it took around 8 h for the power bank to reach a full charge.This variation is likely due to the formula's assumption of ideal conditions such as high temperature and concentrated solar irradiation, which may not conform with the actual weather conditions experienced during this period of the year.

Wind energy production
The calculated time needed to charge the power bank using wind energy was significantly shorter than the actual time it took for the charging process (approximately 13 h for half charging).This divergence arises from the fact that the output power of the motor was noticeably lower than the required power for charging this type of power bank.Additionally, the fan used to generate rotational energy was small, making it less efficient in capturing wind for charging batteries.This limitation was identified in the project.To address this, future iterations will employ a larger rotor and a higher-output power motor to better utilize wind power to charge the system.

Performance Evaluation
In this section, we conducted a comprehensive evaluation of the hybrid-powered desalination system, incorporating IoT technologies for enhanced monitoring and control.Our objective was to explore various critical aspects of the system's functionality, efficiency, and sustainability.We also aimed to ensure that the system aligned with the primary objectives that were placed while planning for the project.The parameters examined involved energy efficiency, freshwater production rates, accuracy of IoT monitoring, and remote-control capabilities.

Energy efficiency
An advantage of the ESP32 is its low power consumption.Table 1 illustrates the various ESP32 power consumption modes.Using a 10,000 mA power bank, and applying Equation ( 7): Runtime(hours) = Power Bank Capacity (mAh) Power Consumption of ESP32 (mA) + power consumption of other components (7) In ideal conditions, the power bank can sustain the system for approximately 500 h.Consequently, although it takes a long time to charge using wind energy, charging the power bank for 8 h using solar energy should enable the system to operate for about 20 days.This is relatively energy-efficient, considering that these values depend on the system's operating hours and the number of measurements needed for transmission.

Freshwater production rate
The production rate of freshwater depends on the time required to heat the water.In the controlled experiment, where we used an electric heater to warm the water, we were able to produce approximately 120 mL of fresh water every 30 min.This amount was significantly higher than the water produced in the uncontrolled experiment.We hypothesized that expanding the tank and raising the water temperature would result in a higher yield of freshwater.

Accuracy of IoT monitoring, and remote-control capabilities
In our project, the accuracy of IoT monitoring played a pivotal role in ensuring reliable real-time data for decision-making.We validated the sensors used to monitor critical parameters such as water production, water quality, and environmental conditions.While challenges were encountered and addressed, the findings highlight the significance of precise measurements in achieving our project objectives.Simultaneously, the remotecontrol capabilities, facilitated by IoT technologies, added a layer of operational flexibility.The ability to remotely control aspects of the system such as the operation of the pump and electric heater was examined for responsiveness, user interface availability, and security.We observed a sufficient level of responsiveness, implemented robust security measures, and considered user feedback in enhancing the overall user experience.

Conclusions
In conclusion, this research project focused on the development and implementation of a novel hybrid water desalination system that leverages solar energy to transform seawater into a freshwater resource.By integrating renewable energy sources, particularly solar power, into the desalination process, the system enhances efficiency and conforms with the goal of sustainable water management.The incorporation of a network of sensors and the utilization of the IoT ensures real-time continuous monitoring and control of the system, securing it against potential variations in performance and maintaining water quality.The experiments conducted under varying weather conditions illustrated the system's effectiveness in reliably producing potable water.
However, it is important to recognize the limitations encountered during the design of the system.Uncontrolled weather conditions increased the number of hours and energy required for heating the water, and the dependence on wind energy resulted in longer charging periods.Despite this, these limitations are considered reasonable and can be overcome by selecting more productive and energy-efficient components.In the future, we aim to incorporate neural network models such as GRU-based neural networks to develop prediction models that efficiently estimate the amount of energy produced from sunlight, wind, and water as well as predict the rate of freshwater production.
By addressing these challenges and pursuing further innovations, we believe that the hybrid water desalination system presented in this research carries great potential for providing a sustainable solution to the global issue of water scarcity.With continued development and optimization, this system can contribute significantly to ensuring global access to clean and potable water, improving public health, and promoting sustainable development.

■
Potable (freshwater tank): This tank holds the freshwater resulting from the condensation of the heated water.It is connected to pipes that transfer water from the desalination tank to the freshwater tank.

Figure 1 .
Figure 1.Block diagram of the desalination system.

Figure 1 .
Figure 1.Block diagram of the desalination system.

Figure 2 .
Figure 2. The circuit schematic design of the desalination system.

Figure 2 .
Figure 2. The circuit schematic design of the desalination system.
illustrate the designed system after implementation.

Figure 4 .
Figure 4. Implemented desalination system, where a = 0.3 cm, b = 0.5 cm, c = 30 cm, and d = 18 cm.The used glass was the same glass used to cover the solar panels.Figure 4. Implemented desalination system, where a = 0.3 cm, b = 0.5 cm, c = 30 cm, and d = 18 cm.The used glass was the same glass used to cover the solar panels.

Figure 4 .Figure 5 .
Figure 4. Implemented desalination system, where a = 0.3 cm, b = 0.5 cm, c = 30 cm, and d = 18 cm.The used glass was the same glass used to cover the solar panels.Figure 4. Implemented desalination system, where a = 0.3 cm, b = 0.5 cm, c = 30 cm, and d = 18 cm.The used glass was the same glass used to cover the solar panels.IoT 2024, 5, FOR PEER REVIEW 1

Figure 5 .
Figure 5. Desalination system components: (a) pipes inside the tank, (b) openings for inserting the heater, the DS18B20 sensor, and the water level sensor, and (c) openings for potable water outlets and saline water inlets.

Figure 6 .Figure 6 .Figure 7 .
Figure 6.(a) Things created in the Arduino IoT platform.(b) Things created in the Arduino IoT platform.Figure 6.(a) Things created in the Arduino IoT platform.(b) Things created in the Arduino IoT platform.024, 5, FOR PEER REVIEW 15

Figure 7 .
Figure 7. Measured values on the website's dashboard.Figure 7. Measured values on the website's dashboard.

Figure 7 .
Figure 7. Measured values on the website's dashboard.

Figure 8 .
Figure 8. System's dashboard on the mobile IoT remote app.

Figure 8 .
Figure 8. System's dashboard on the mobile IoT remote app.
Figures 9 and 10 illustrate these values before and after starting the desalination process.

Figure 9 .
Figure 9. Measurements of the sensors before desalination.

Figure 10 .
Figure 10.Measurements of the sensors after the desalination process was completed.

Figure 12 .
Figure 12.Measured values after the experiments.

Figure 12 .
Figure 12.Measured values after the experiments.

Figure 12 .
Figure 12.Measured values after the experiments.