Preprint
Technical Note

This version is not peer-reviewed.

Aquaculture Automation: A Sensor-Based Approach to Optimize Water Quality

Submitted:

24 December 2025

Posted:

26 December 2025

You are already at the latest version

Abstract
Aquaculture is a major contributor to Bangladesh’s economy, but farmers still struggle to maintain proper water quality because manual testing is slow, inaccurate, and difficult to manage in rural areas. This project introduces a low-cost, real-time monitoring system using an ESP32-32 N4 with temperature, pH, and TS300B turbidity sensors. The system collects water quality data and sends it to a mobile device, allowing farmers to track pond conditions remotely and receive alerts when values cross safe limits. Field tests show that the system provides reliable readings and helps reduce fish mortality by enabling quick action. This approach offers an affordable and practical solution for small-scale farmers, supporting better farm management and promoting wider technological adoption in the aquaculture sector.
Keywords: 
;  ;  ;  ;  ;  ;  ;  ;  

Chapter 1. Introduction

1.1. Introduction

Aquaculture is an essential sector in Bangladesh, providing a major portion of protein intake for the population and playing a crucial role in economic growth. In 2021, the fisheries sector contributed around 3.5% to the national GDP, with 60% of total animal protein consumption in the country derived from fish. As aquaculture expands, the need for monitoring water quality to ensure sustainable practices becomes critical. Water parameters like temperature, pH, and particles concentration directly influence fish health, growth rates, and productivity. Traditional monitoring methods are time-consuming, labor-intensive, and error-prone. The introduction of an automated, real-time monitoring system using ESP32-32 N4 aims to provide an efficient, cost-effective solution for farmers, particularly in rural areas where technical resources are limited.
This paper focuses on the development of an aquaculture monitoring system that measures and displays real-time temperature, pH, and particles levels in a pond. The system notifies the user via mobile phone if the parameters deviate from ideal conditions, allowing proactive measures to protect aquatic life. The implementation of such technology can have a transformative impact on Bangladesh’s aquaculture industry by improving operational efficiency, fish yield, and resource management.

1.2. Motivation

Aquaculture is vital to Bangladesh’s food security, yet many small-scale farmers face challenges in maintaining water quality due to limited access to advanced monitoring systems. Water quality monitoring is crucial to prevent the spread of diseases and maintain optimal conditions for fish growth. In Bangladesh, climatic variability, pollution, and the lack of proper training often hinder farmers from consistently maintaining ideal pond conditions. This results in fish mortality and economic losses. Given that fish farming often supports the livelihood of rural communities, there is a need for an affordable, accessible solution to monitor key water parameters efficiently.
Inspiration for this project stems from the need to address these gaps by leveraging low-cost, open-source technologies like ESP32-32 N4. By integrating sensors to measure temperature, pH, and particles levels, this system can deliver accurate, real-time data directly to the farmer's mobile phone. This not only reduces the need for manual water quality checks but also empowers farmers to make timely interventions, minimizing losses and improving yield. The use of technology in this way aligns with Bangladesh’s vision for advancing the agricultural sector and embracing digital innovation in farming practices.

1.3. Objectives

The main objectives of this project are:
  • To design and develop an affordable real-time aquaculture monitoring system using ESP32-32 N4.
  • To measure and display the temperature, pH level, and particles concentration in aquaculture ponds.
  • To send real-time updates and alerts via mobile devices for efficient monitoring and timely interventions.
  • To improve the efficiency of fish farming operations by providing accurate and continuous data on key water parameters.
  • To promote the adoption of low-cost technological solutions among small-scale and rural farmers in Bangladesh.

Chapter 2. Literature Review

The use of technology in aquaculture is growing rapidly, with several studies highlighting the importance of water quality monitoring systems. For example, in a study by Karthick and Ganeshkumar (2015), an IoT-based monitoring system was developed to track water parameters such as dissolved oxygen and pH. Their findings indicated a significant improvement in fish yield and operational efficiency when real-time monitoring was implemented. However, the cost of implementing IoT devices in rural areas remains a challenge. [1]
In Bangladesh, traditional fish farming methods still dominate, and water quality is generally monitored manually. According to Ahmed et al. (2020), lack of access to affordable monitoring tools and limited technical knowledge are key obstacles for rural farmers. While some efforts have been made to introduce sensor-based systems, their adoption has been slow due to high costs and technical complexity. [2]
Arduino-based systems have been explored in several studies due to their affordability and open-source nature. Bhattacharjee et al. (2019) successfully developed an Arduino-based monitoring system for small-scale fish farms, though it focused primarily on temperature and pH, excluding other important factors like particles levels. The addition of particles monitoring is crucial, as particles serves as a natural food source in many pond ecosystems. [3]
This project seeks to build upon previous studies by incorporating real-time monitoring of particles, alongside pH and temperature, creating a more comprehensive solution. Moreover, the low-cost nature of the system and mobile phone integration aims to make it accessible to rural farmers, addressing the gaps identified in previous research.

Chapter 3. Background Study

3.1. Introduction

Aquaculture is a vital sector in many developing countries, including Bangladesh, where it contributes significantly to the economy and food security. The practice of fish farming in ponds, lakes, and other water bodies is widespread due to the country's natural water resources. With an increasing demand for fish as a source of protein and the need for sustainable food production, aquaculture plays a crucial role in meeting the dietary needs of the population. However, the success of aquaculture depends heavily on maintaining optimal water quality, which directly affects the health and growth of aquatic organisms. This project aims to address the challenges of real-time water quality monitoring in aquaculture systems by developing a cost-effective and efficient monitoring solution using ESP32-32 N4.

3.2. Aquaculture in Bangladesh

Bangladesh is one of the world's leading countries in aquaculture production, accounting for nearly 3% of the global fish production [4]. The country has abundant freshwater resources, including numerous rivers, ponds, and floodplains, which are ideal for aquaculture. Fish is an integral part of the Bangladeshi diet, contributing to the nutritional needs of millions of people. According to the Department of Fisheries, the aquaculture sector contributes about 60% to the total fish production in Bangladesh and plays a vital role in rural livelihoods [5]. Despite the sector's growth, aquaculture faces several challenges, including environmental variability, disease outbreaks, and poor water quality management.

3.3. Water Quality in Aquaculture

Water quality is a key factor in the success of aquaculture. Poor water conditions can lead to the death of fish, reduced growth rates, and increased susceptibility to diseases, all of which have significant economic and environmental consequences. The most important water quality parameters in aquaculture include temperature, pH level, dissolved oxygen, and the presence of biological elements such as particles.

3.3.1. Temperature

Fish are ectothermic animals, meaning their body temperature is regulated by the surrounding water. The growth rate, feeding behavior, and metabolic processes of fish are highly sensitive to water temperature. Extremes in water temperature, whether too high or too low, can result in stress, disease, or even mortality [6]. Therefore, continuous monitoring of water temperature is crucial in maintaining the health of aquaculture systems.

3.3.2. pH Level

The pH level of the water, which measures the acidity or alkalinity, is another critical factor for the survival and productivity of fish. Most fish species thrive in water with a pH range of 6.5 to 9.0. Deviation from this range can lead to stress, inhibit growth, and reduce resistance to disease. Changes in pH can also affect the solubility and toxicity of chemicals in the water, such as ammonia [7].

3.3.3. Particles

Particles are small aquatic organisms that form a critical part of the food chain in aquatic ecosystems. In fish farming, they serve as a natural food source for many fish species, especially during their early life stages. Monitoring particles levels helps assess the overall health of the pond and the availability of natural food for the
fish. A decline in particles populations may indicate deteriorating water quality or an imbalance in the aquatic ecosystem.

3.4. Challenges in Traditional Aquaculture Monitoring

Traditional methods of monitoring water quality in aquaculture often involve manual sampling and laboratory testing. While these methods can provide accurate data, they are labor-intensive, time-consuming, and costly. Additionally, manual monitoring may not provide real-time data, limiting the ability of farmers to respond quickly to adverse conditions. In rural areas of Bangladesh, small-scale farmers may not have the financial resources or technical knowledge to implement sophisticated water quality monitoring systems, further exacerbating the problem.
In the face of these challenges, there is a growing need for affordable and automated systems that can provide continuous monitoring of water quality parameters. Such systems can help farmers maintain optimal water conditions, thereby improving the productivity and sustainability of aquaculture operations.

3.5. Technological Solution in Traditional Aquaculture Monitoring

Recent advancements in technology offer promising solutions to the challenges of water quality monitoring in aquaculture. Microcontroller-based systems, such as those built using Arduino, have gained popularity due to their affordability, flexibility, and ease of use. The ESP32-32 N4, a compact and powerful microcontroller, is particularly well-suited for small-scale projects that require low power consumption and space-efficient designs.
Arduino-based systems can be integrated with various sensors to measure critical water quality parameters such as temperature, pH, and particles levels. These systems can be programmed to collect data continuously and transmit it to a central database or mobile device for real-time monitoring. Additionally, the integration of wireless communication technologies, such as Wi- Fi or Bluetooth, allows farmers to monitor water quality remotely, providing timely alerts if any parameter deviates from the optimal range.

3.6. ESP32-32 N4-Based Aquaculture Monitoring System

This project proposes the development of an ESP32-32 N4-based aquaculture monitoring system that continuously measures and reports the temperature, pH level, and particles levels in a fish pond. The ESP32-32 N4 is chosen for its compact size, low cost, and ability to interface with multiple sensors. The system will be equipped with temperature sensors, pH sensors, and a TS300B turbidity sensor.

3.6.1. Temperature Monitoring

The system will use digital temperature sensors (e.g., DS18B20) to monitor the water temperature. These sensors are highly accurate and can be easily interfaced with the ESP32-32 N4. The temperature data will be logged continuously and displayed on an LCD screen or sent to a mobile application via wireless communication.

3.6.2. pH Monitoring

A pH sensor module will be used to measure the acidity or alkalinity of the water. The sensor will be calibrated to ensure accurate readings and will provide real-time data on the pond's pH level. The system can be programmed to trigger alerts if the pH level moves outside the safe range for the fish.

3.6.3. Particles Monitoring

Traditional particles monitoring in aquaculture involves manual sampling and microscopic analysis, which can be labor-intensive and time-consuming. To automate this process, a TS300B turbidity sensor will be employed to measure the water's cloudiness, which correlates with the concentration of suspended particles, including particles. By continuously monitoring changes in turbidity levels, the system can provide an indirect estimate of particles abundance. Although less precise than optical or image-based methods, this approach offers a simpler, cost-effective solution for tracking the biological dynamics of the pond ecosystem.
The data collected from these sensors will be processed by the ESP32-32 N4 and transmitted to a mobile application or web interface where the farmer can monitor the pond conditions in real time. Alerts can be set up to notify the farmer if any parameter deviates from the optimal range, allowing for timely intervention.

3.7. Sustainability and Impact

The implementation of this ESP32-32 N4-based aquaculture monitoring system has the potential to significantly improve the sustainability of aquaculture practices in Bangladesh. By providing real-time data on critical water quality parameters, the system enables farmers to maintain optimal conditions for fish growth, reducing the risk of disease outbreaks and mortality. Furthermore, by automating the monitoring process, the system reduces the need for manual labor and frequent site visits, allowing farmers to focus on other aspects of their operations.
In the long term, widespread adoption of such systems could contribute to the overall sustainability of the aquaculture sector in Bangladesh. Automated monitoring systems can help reduce the environmental impact of fish farming by minimizing water waste, preventing overfeeding, and reducing the use of chemical treatments for water quality management. Additionally, by improving the efficiency and productivity of fish farms, the system can help boost rural incomes and contribute to food security in the country.

3.8. Field Survey Study

Aquaculture is a cornerstone of food security and economic development in Bangladesh. The fisheries sector not only provides essential protein to the population but also serves as a source of livelihood for millions. Among the regions actively involved in fish farming, Chandpur stands out for its rich aquatic resources and history of aquaculture practices.
However, despite this long-standing tradition, many farmers still rely on experience-based, manual approaches to manage their farms. With increasing challenges posed by environmental changes, diseases, and market competition, there is a growing need to adopt modern technological interventions.
This report presents detailed findings from a survey of five fish farmers (four real and one synthesized) conducted in Chandpur. The aim was to understand their current practices, identify inefficiencies, and assess their openness to real-time monitoring systems using technologies like ESP32-32 N4. These systems can help monitor key parameters such as temperature, pH, and turbidity, thus improving farm management.

3.8.1. Farm Information

The survey captured detailed insights into the scale and nature of the fish farms. The largest pond measured 3 acres, while the smallest was 1.5 acres. On average, the ponds were about 2.2 acres in size. All farmers rear common species like Koi, Tilapia, and Mixed Carp, which are well-suited for local demand and conditions.
Their experience in the sector varied, with the most experienced farmer having 25 years in aquaculture. The diversity in experience reflects the generational knowledge transfer and the evolving challenges faced over time.
Fish type preferences also show localized adaptations. Some prefer species with fast growth and high resistance (e.g., Tilapia), while others focus on varieties with higher market value despite higher risk.

3.8.2. Water Quality Monitoring

Proper water quality management is critical to the health and productivity of fish. However, monitoring is infrequent or inconsistent among the surveyed farmers. Three out of five monitor temperature and pH levels, but often only once a month or during visible fish distress.
One farmer uses a laboratory service, while two use manual test kits. The remaining two either do not monitor or lack the tools and knowledge. All farmers reported fish deaths due to water quality problems. The financial implications were significant, with reported annual losses as high as 1.5 million Taka.
This highlights a major gap in day-to-day monitoring. Integrating affordable, real-time sensors can drastically improve response time and reduce losses.
Figure 3.1. Water monitoring frequency.
Figure 3.1. Water monitoring frequency.
Preprints 191360 g001

3.8.3. Fish Feed Waste and Feeding Practices

Feeding practices vary greatly among farmers. Two rely on personal experience, one uses a scientific method, and two depend on guesswork. Most do not assess natural feed (plankton/algae) availability before supplementing with artificial feed. Lack of knowledge and tools are the primary barriers.
All farmers agreed that excessive feeding leads to waste. They estimate 5–10% of feed goes unused, which translates into large financial waste given their monthly feed costs (1.2 to 3 million Taka).
The table below illustrates the average spending and potential monthly savings if feed waste is reduced:
Table 3.1. Average spending and potential monthly savings if feed waste is reduced.
Table 3.1. Average spending and potential monthly savings if feed waste is reduced.
Farmer Monthly Feed Cost (Taka) Estimated Monthly Savings (Taka)
Farmer 1 1.5 Million 0.25 Million
Farmer 2 3.0 Million 0.05 Million
Farmer 3 1.2 Million 0.2 Million
Farmer 4 3.0 Million 0.1 Million
Farmer 5 2.0 Million 0.15 Million
Figure 3.2. Estimated feed waste per year.
Figure 3.2. Estimated feed waste per year.
Preprints 191360 g002

3.8.4. Impact of Technology on Fish Farming

Despite none of the farmers having used technology so far, all expressed interest in a system that could provide real-time updates on water temperature, pH, and natural feed availability.
Benefits identified include:
-
Timely intervention to prevent fish deaths
-
Reduction in feed costs by monitoring natural feed
-
Improved yield and farm profitability
-
Peace of mind through automated alerts
Suggested technology: ESP32-32 N4-based sensor systems combined with mobile app interfaces. These systems can provide live data feeds and notify farmers about abnormalities, making aquaculture more data-driven and efficient.

3.8.5. Recommendation

To successfully integrate real-time monitoring systems into local fish farming practices, the following steps are recommended:
  • Capacity Building: Organize training sessions to educate farmers on sensor-based systems.
  • Pilot Projects: Run pilot projects in collaboration with government or NGOs to demonstrate cost-benefit outcomes.
  • Subsidies and Microfinance: Provide financial support for initial hardware investments.
  • User-Friendly Mobile Apps: Develop local language applications with intuitive dashboards.
  • Monitoring and Support: Offer maintenance and consultation services for early adopters.
These interventions will enable small to medium-scale farmers to transition into smarter, more efficient aquaculture operations.

3.8.6. Conclusion

The survey has revealed that while fish farming in Chandpur is well-established, it remains largely traditional. This leaves farmers vulnerable to losses due to preventable factors such as water quality fluctuations and feed waste. However, the openness to adopt technology provides a silver lining.
By leveraging affordable solutions like Arduino-based systems and mobile technology, farmers can significantly improve efficiency, minimize waste, and increase profitability. The survey serves as a strong case for scaling up smart aquaculture practices in rural Bangladesh.
In conclusion, the future of aquaculture in Chandpur can be transformed by embracing modern solutions that empower farmers with real-time data and control.

Chapter 4. Methodology

The methodology of this aquaculture monitoring system project involves designing and implementing an automated ESP32-32 N4-based system to monitor essential water quality parameters in real-time. The system's primary purpose is to support small-scale farmers by providing affordable, accurate, and easily accessible monitoring of temperature, pH, and turbidity levels to help maintain optimal water conditions for aquaculture.

4.1. Introduction

This chapter introduces the steps involved in building the aquaculture monitoring system, including identifying the project requirements, selecting the appropriate hardware and sensors, setting up the communication interface, and developing the software for data acquisition, processing, and alerting. The system design is based on low-cost hardware and easy-to-use software to make it accessible for small-scale fish farmers in Bangladesh, where resources for advanced monitoring solutions are limited.

4.2. Steps in methodology

4.2.1. Requirement Analysis

This involves identifying critical water quality parameters (temperature, pH, and turbidity) that impact fish health and productivity [7].

4.2.2. Hardware and Sensor Selection

We chose the ESP32-32 N4 microcontroller and compatible sensors (temperature, pH, and turbidity) based on their affordability, compatibility, and accuracy. Sensors are selected for optimal performance in the specific conditions of Bangladeshi aquaculture [6].

4.2.3. System Design

Designing the layout and arrangement of the sensors and microcontroller for ease of installation and robustness in a pond environment.

4.2.4. Communication Interface

Developing a communication module, either via Wi-Fi or Bluetooth, for data transmission to a mobile app or web interface. This enables real-time monitoring and alerts, even from remote locations.

4.2.5. Software Development

Programming the Arduino to collect, process, and transmit data continuously. The software will also trigger alerts when any parameter goes beyond safe limits, enabling immediate corrective action.

4.3. Proposed System

The proposed system comprises three main components: sensor modules for data collection, ESP32-32 N4 for data processing, and a communication module for data transmission to a mobile device or web platform. Each component is described below:

4.3.1. Sensor Modules

The sensor modules are the critical components that measure the water quality parameters essential for maintaining a healthy aquaculture environment. The selected sensors are specifically chosen for their reliability, cost-effectiveness, and suitability for real-time monitoring in outdoor conditions.

4.3.1.1. Temperature Sensor (DS18B20)

  • Description: The DS18B20 is a digital temperature sensor widely used for precise temperature measurements. It has a resolution of up to 12 bits and operates over a temperature range of -55°C to +125°C. Its waterproof design makes it ideal for submersion in pond water. The sensor measures water temperature in real-time, which is essential for monitoring fish health, as extreme temperatures can cause stress or even death. [8]
  • Role in the System: Temperature is a vital parameter in aquaculture, affecting fish metabolism, oxygen solubility, and susceptibility to diseases. Monitoring temperature ensures that the pond environment remains within optimal limits for fish growth.
  • Installation and Calibration: The sensor is submerged in the pond at strategic depths to measure water temperature accurately. Calibration is performed using reference thermometers to eliminate offset errors and ensure reliability.
Figure 4.1. DS18B20 temperature sensor.
Figure 4.1. DS18B20 temperature sensor.
Preprints 191360 g003

4.3.1.2. pH Sensor

  • Description: The pH sensor module measures the hydrogen ion concentration in water, indicating its acidity or alkalinity. It typically consists of a probe and an amplifier circuit to convert the sensor’s analog signal into a digital format readable by the ESP32-32 N4. Maintaining an ideal pH range is crucial for fish health, as imbalanced pH levels can impact growth rates and make fish susceptible to diseases [7].
  • Role in the System: Maintaining proper pH levels is critical for fish health, as extreme pH levels can cause stress, reduce growth rates, and impair reproduction. Optimal pH also supports beneficial microbial activity in the pond [9].
  • Installation and Calibration: The pH probe is placed in the pond at a location where water circulation is high but undisturbed by feeding or external pollutants. Calibration is done using standard buffer solutions (pH 4, 7, and 10) to ensure accuracy.
Figure 4.2. Analog PH Sensor.
Figure 4.2. Analog PH Sensor.
Preprints 191360 g004

4.3.1.3. Turbidity Sensor (TS300B)

  • Description: A TS300B TS300B turbidity sensor is used to assess water clarity by measuring suspended particle concentrations in the pond. High turbidity can reduce light penetration, impact oxygen levels, and affect fish health. The TS300B turbidity sensor measures the cloudiness or clarity of water by detecting light scattered by suspended particles. The TS300B sensor is compact and provides analog signals proportional to the water’s turbidity.
  • Role in the System: Turbidity monitoring is essential to assess water clarity, which directly impacts light penetration and dissolved oxygen levels. High turbidity often indicates algal blooms, sediment disturbances, or pollution, all of which can harm aquatic life.
  • Installation and Calibration: The sensor is placed in a representative location within the pond and calibrated against known turbidity standards to provide consistent readings. The sensor is positioned where suspended particles are evenly distributed, typically away from the pond's edges. Calibration is done using formazin standards or other known turbidity references to establish a baseline for comparison.
Figure 4.3. TS300B turbidity sensor.
Figure 4.3. TS300B turbidity sensor.
Preprints 191360 g005

4.3.2. Data Processing Unit (ESP32-32 N4)

The ESP32-32 N4 acts as the central processing unit for this system. It gathers data from each sensor, processes it, and makes decisions based on predefined threshold values for temperature, pH, and turbidity. When a parameter exceeds the safe limit, the ESP32-32 N4 triggers an alert, allowing the farmer to take corrective action promptly. The microcontroller’s small size, low cost, and sufficient processing power make it ideal for this project.
Figure 4.4. ESP32-32 N4.
Figure 4.4. ESP32-32 N4.
Preprints 191360 g006
  • Data Collection: The ESP32-32 N4 continuously receives signals from the connected sensors. Each signal is processed to generate precise readings of temperature, pH, and turbidity.
  • Data Calibration: To enhance accuracy, the Arduino applies calibration algorithms to the raw sensor data. For instance, temperature corrections may account for environmental factors, while pH and turbidity readings are adjusted based on calibration coefficients [10].
  • Threshold Monitoring: Predefined thresholds for temperature, pH, and turbidity are programmed into the ESP32-32 N4. If any parameter deviates from these safe ranges, the system generates an alert [11].
  • Energy Efficiency: The ESP32-32 N4’s low power consumption ensures extended operation, even with limited power sources such as batteries or solar panels [10].

4.3.2.1. Programming

  • The ESP32-32 N4 is programmed using the Arduino IDE with code that collects sensor readings, applies calibration values, and processes the data.
  • Conditional logic is embedded to activate alerts if readings fall outside optimal ranges.

4.3.3. Communication Module

The communication module ensures real-time data transmission from the ESP32-32 N4 to a remote user interface, such as a mobile app or web dashboard. This allows users to monitor water quality parameters without needing physical presence at the pond.

4.3.3.1. Communication Technology (ESP32 Built-In Wi-Fi)

  • Description: The ESP32 built-in Wi-Fi is a low-cost, Wi-Fi-enabled microchip that facilitates seamless communication with cloud platforms or local servers [12].
  • Functionality: It sends processed sensor data from the ESP32-32 N4 to a cloud server, enabling real-time visualization and historical data tracking [12].
  • Use Case: This module is suitable for locations with stable Wi-Fi connectivity, allowing remote monitoring from anywhere.

4.3.3.2. Data Transmission and Alerting

The communication module sends real-time data from the sensors to a mobile device or web dashboard. Alerts are set up to notify the farmer if parameters exceed safe levels, enabling quick response times.

4.3.3.3. User Interface

The data is visualized on a mobile app or web dashboard designed to be intuitive for farmers. It displays real-time parameter values, historical trends, and alerts for any abnormalities. Users can also receive actionable recommendations, such as adding aeration or adjusting feeding schedules [12].

4.3.4. System Workflow Diagram

Figure 4.5. Working Diagram of the prototype.
Figure 4.5. Working Diagram of the prototype.
Preprints 191360 g007
The diagram illustrates the flow of data from the sensors to the user interface, enabling a closed- loop monitoring system that provides constant updates and immediate alerts.

4.3.5. Diagram of the Prototype

The following diagram illustrates the complete wiring and connection setup for the aquaculture monitoring system. The prototype consists of an ESP32-32 N4, ESP32 built-in Wi-Fi (NodeMCU), and various sensors such as the DS18B20 temperature sensor, analog pH sensor, and TS300B turbidity sensor. Serial communication is established between the ESP32-32 N4 and ESP32 built-in Wi-Fi, allowing seamless data transfer for real-time monitoring of water conditions. The sensors are connected to specific digital and analog pins of the ESP32-32 N4 to ensure accurate data acquisition.
Below is the detailed circuit diagram of the prototype:

4.3.5.1. Circuit Connection Procedure

4.3.5.1.1. Power Connection:
  • ESP32-32 N4 Power:
    • 5V →ESP32 built-in Wi-Fi VCC (3.3V)
    • GND → Common Ground for all components
4.3.5.1.2. Sensor Connections:
  • DS18B20 Temperature Sensor
    • VCC → 3V3 (ESP32-32 N4)
    • GND → GND
    • Data → D27 (ESP32-32 N4)
    • 4.7kΩ Pull-up Resistor between Data and 3V3
  • Analog pH Sensor
    • VCC (V+) → 3V3 (ESP32-32 N4)
    • GND (G) → GND
    • Signal (Po) → D34 (ESP32-32 N4 Analog Input)
  • TS300B Turbidity Sensor
    • VCC (V) → 3V3 (ESP32-32 N4)
    • GND (G) → GND
    • Signal(A) → D32 (ESP32-32 N4 Analog Input)
4.3.5.1.3. Wi-Fi Communication (ESP32 built-in Wi-Fi):
  • ESP32 built-in Wi-Fi connects to Wi-Fi using WiFi.begin(SSID, PASSWORD);
  • ESP32-32 N4 collects sensor data and sends it to ESP32 built-in Wi-Fi via Serial Communication.
  • ESP32 built-in Wi-Fi transmits data to a cloud platform or mobile application for real- time monitoring.

4.4. Prototype

A functional prototype of the aquaculture monitoring system was developed using the ESP32- WROOM-32 microcontroller, pH sensor module, TS300B turbidity sensor, and DS18B20 waterproof temperature probe. All sensors were interfaced on a compact prototype board, and the system was tested on a benchmark setup before deployment in the pond environment.
Figure 4.6 shows the top view of the complete prototype, including the controller board, sensor modules, and wiring layout.
Figure 4.6. Diagram of the prototype.
Figure 4.6. Diagram of the prototype.
Preprints 191360 g008
Figure 4.7 presents a close-up view of the complete prototype, including the controller board, sensor modules, and wiring layout.
Figure 4.7. Prototype top view.
Figure 4.7. Prototype top view.
Preprints 191360 g009
Figure 4.8 displays the side view of the assembled prototype, showing the physical arrangement and mounting structure.
Figure 4.8. Sensor Module close-up.
Figure 4.8. Sensor Module close-up.
Preprints 191360 g010
Figure 4.9. Prototype side view.
Figure 4.9. Prototype side view.
Preprints 191360 g011

4.5. Summary

The aquaculture monitoring project is designed to assist small-scale fish farmers in Bangladesh by providing a cost-effective and efficient solution for real-time water quality monitoring. The system is built around an ESP32-32 N4-based platform, which integrates multiple sensors to measure key water parameters, including temperature, pH level, and turbidity. These factors are critical for maintaining a healthy aquatic environment, as they directly affect fish growth, metabolism, and overall productivity.
The system incorporates affordable and readily available sensors to continuously collect data from the pond. A temperature sensor ensures that water remains within the optimal range for fish survival and growth, while a pH sensor detects acidity or alkalinity fluctuations that could stress fish or impact their immune systems. Additionally, a TS300B turbidity sensor monitors water clarity, providing insights into the presence of suspended particles, which may indicate pollution, excessive organic matter, or imbalances in the pond ecosystem.
Once data is collected, the ESP32-32 N4 processes the readings and transmits the information using wireless communication technologies such as Wi-Fi or Bluetooth. This enables farmers to receive real-time updates and alerts through a mobile application or dashboard, allowing
them to monitor pond conditions remotely. If any parameter deviates from the optimal range, the system immediately notifies the user, prompting timely interventions to prevent potential fish health risks or losses.
This solution is designed to be user-friendly, low-cost, and reliable, making it accessible even for farmers with limited technical knowledge. By automating water quality monitoring, the project reduces dependence on manual testing, minimizing labor costs and human error while enhancing productivity. Ultimately, this technology-driven approach contributes to sustainable aquaculture practices, improving fish yield, reducing environmental risks, and supporting food security in Bangladesh.

Chapter 5. Implementation

5.1. Introduction

This chapter describes how the aquaculture monitoring system was built, starting from configuring the ESP32 microcontroller to setting up the backend server and deploying the dashboard. The goal was to develop a simple, reliable, and low-cost system capable of collecting temperature, pH, and turbidity data in real time and delivering it to the farmer through a web interface.

5.2. Hardware Implementation

Selected Hardware:
  • ESP32-32 N4
  • DS18B20 waterproof temperature probe
  • Analog pH sensor with signal conditioning board
  • TS300B turbidity sensor
  • 3.3V regulated power from ESP32 USB supply
  • Jumper wires and prototype board
Each sensor was connected to the ESP32 using dedicated analog or digital pins. All grounds were connected in common. Voltage dividers were added for analog sensors to ensure 3.3V- safe input levels.

5.3. Software Environment and Setup

The ESP32 was programmed using Arduino IDE, with required libraries installed:
  • WiFi.h (network connectivity)
  • HTTPClient.h (sending data to server)
  • OneWire & DallasTemperature (DS18B20)
The firmware was designed to:
  • Read sensor values at fixed intervals
  • Apply basic calibration and filtering
  • Send the processed data to a backend API
  • Receive acknowledgment from the server
  • Retry transmission if the network fails
Only the main functional summary is included here. Full source code is provided in Appendix B.

5.4. Backend Implementation

A lightweight backend was developed using Node.js and MongoDB.
Major components:
  • Express-based REST API
  • POST endpoint for receiving data from ESP32
  • GET endpoints for dashboard data visualization
  • Mongoose schema for structured database storage
  • Basic API key protection for POST requests
The backend runs continuously and stores timestamped readings. The full backend code is available in Appendix C.

5.5. Web Dashboard Implementation

A browser-based dashboard was created to visualize the data. It displays:
  • Real-time readings
  • Parameter-wise graphs
  • Status indicators (Normal / Alert)
The dashboard fetches JSON data from the backend using JavaScript. The interface is designed to be simple so farmers can read values easily on mobile devices. Full front-end code is included in Appendix D.

5.6. Testing and Deployment

The entire system was tested through several stages:
  • Bench testing- verifying sensor readings with known references
  • Connectivity testing – checking Wi-Fi stability and API response
  • Field testing – placing sensors in a pond to evaluate real-world performance
  • Dashboard validation – checking whether values update correctly
The ESP32 maintained stable readings and successfully transmitted data at 15-second intervals. Packet loss was minimal, and all alerts were triggered as expected.

5.7. Budget Summary

Table 5.1. Budget comparison between prototype and full project.
Table 5.1. Budget comparison between prototype and full project.
Sl. Component/ Aspect Prototype (BDT) Full project Scale (BDT)
1 ESP32-32 N4 400 400
2 pH Sensor 2500 4800
3 Turbidity Sensor 1150 2500
4 Temperature Sensor (DS18B20) 300 500
5 Power Supply 1000 3000
6 Wiring, PCB, And Assembly 500 1500
7 Hosting & Domain 0 (Local) 2500
8 Web Dashboard Dev Self-built 5000
Total 5,850 20,200

5.8. Summary

The completed system successfully integrates sensors, microcontroller, backend, and dashboard into a reliable monitoring solution. Technical details and complete source codes are provided in the appendices for reference and reproducibility.

Chapter 6. Result and Analysis

This chapter presents the outcomes of the developed aquaculture monitoring system and analyzes the collected data, sensor performance, wireless communication reliability, and the usability of the mobile application. The results demonstrate how the system performs in real- world pond conditions and how effectively it delivers real-time information to the user.

6.1. System Performance Overview

The ESP32-based monitoring system successfully measured temperature, pH, and turbidity and transmitted these values to the server in real time. All three sensors operated continuously without system resets or data loss during testing. The ESP32 maintained a stable Wi-Fi connection within a range of 20–25 meters from the access point, which is sufficient for small and medium-sized ponds.
The system collected data at intervals of 15 seconds, and each dataset included:
  • Water temperature (°C)
  • pH level
  • Turbidity (NTU-equivalent analog reading)
  • Timestamp
These values were available instantly on the mobile/web dashboard.

6.2. Temperature Sensor (DS18B20) Results

The DS18B20 provided stable and noise-free readings throughout the experiment. The average response time was approximately 750 ms, and no calibration was required since the sensor is factory-calibrated.
During field testing, typical pond temperature ranged between 26°C and 30°C, which aligns with normal aquaculture conditions for carp and tilapia.
Figure 6.1. DS18B20 temperature graph from the mobile app dashboard.
Figure 6.1. DS18B20 temperature graph from the mobile app dashboard.
Preprints 191360 g012
The plotted temperature showed smooth variation, indicating reliable sensor performance with minimal interference.

6.3. pH Sensor Results

The analog pH module required two-point calibration (pH 4.0 and 7.0 buffer solutions). After calibration, the system showed an accuracy of ±0.1 to ±0.2 pH, which is acceptable for aquaculture monitoring.
The recorded pH values ranged from 6.8 to 7.5, consistent with expected pond conditions in Bangladesh.
Observations:
  • Sudden rain during the test caused a temporary drop in pH from 7.3 to 6.9.
  • The system detected this change and sent an alert through the app immediately.
Figure 6.2. pH level graph from the mobile app.
Figure 6.2. pH level graph from the mobile app.
Preprints 191360 g013

6.4. Turbidity Sensor (TS300B) Results

The TS300B turbidity sensor showed clear changes in response to feeding and suspended solids. While the analog output does not provide direct NTU values without calibration, it was effective for detecting relative turbidity changes.
Findings during testing:
  • Before feeding: lower turbidity (clearer water)
  • 20 minutes after feeding: significant increase
  • Evening readings: steady decrease
The sensor responded consistently to particulate matter changes.
Figure 6.3. Turbidity level trend from mobile app.
Figure 6.3. Turbidity level trend from mobile app.
Preprints 191360 g014

6.5. Dashboard and Mobile App Analysis

The mobile/web application displayed real-time sensor values, graphical trends, and alerts. Data visualization helped the farmer quickly understand pond conditions.
Feature tested:
  • Live numerical values
  • Line charts for each parameter
  • Status indicators (Normal / Alert)
  • Automatic refresh
  • Alert notification (pH or temperature outside safe limits)
The interface was easy to understand and worked smoothly on Android and desktop browsers.
Figure 6.4. Pond dashboard of the monitoring app.
Figure 6.4. Pond dashboard of the monitoring app.
Preprints 191360 g015
Figure 6.5. Home dashboard of the monitoring app.
Figure 6.5. Home dashboard of the monitoring app.
Preprints 191360 g016

6.6. Alert System Validation

Thresholds used during testing:
  • Temperature: < 22°C or > 33°C
  • pH: < 6.5 or > 8.5
  • Turbidity: custom threshold based on baseline data In all test cases, the alert system worked correctly:
  • pH drop during rainfall triggered a real-time alert
  • High turbidity after feeding triggered another alert
The system responded within 2–3 seconds of detecting abnormal values.

6.7. Communication and Data Stability

The ESP32 maintained excellent Wi-Fi stability. Data packets were sent using HTTP POST every 15 seconds.
Packet success rate: 97.8%
Lost packets were automatically resent during the next cycle. Server and database performance:
  • Average response time: 120–180 ms
  • No database overflow or freezing
  • Historical data stored without corruption

6.8. Limitations of the System

While the prototype performed well during testing, there are several limitations that should be considered when evaluating the overall system performance:

6.8.1. Single-Point Monitoring

The system collects data from one fixed position in the pond. Large ponds often have variations in pH, turbidity, and temperature at different locations, so a single node cannot represent the entire water body accurately.

6.8.2. Wi-Fi Range Constraints

The ESP32-32 N4 requires a stable Wi-Fi connection. In rural areas, Wi-Fi coverage is limited, and the signal weakens beyond 20–30 meters, reducing the effective monitoring area.

6.8.3. Analog Sensor Noise

Both the pH sensor and turbidity sensor produce noise due to:
  • water movement
  • loose wiring
  • analog voltage fluctuations
This sometimes results in small spikes in readings and requires additional filtering.

6.8.4. Limited Calibration Accuracy

The pH sensor requires frequent calibration with buffer solutions, and turbidity calibration is not precise without laboratory-grade NTU references.

6.8.5. No Long-Term Waterproof Casing

The current prototype is not fully enclosed in a weatherproof housing. Outdoor use in rain or sunlight may damage:
  • ESP32 board
  • Connectors
  • Sensor wiring

6.8.6. No automated Control

The system only provides monitoring. It does not:
  • automatically adjust pH
  • run aerators
  • control water pumps
So farmers must take manual action after receiving alerts.
These limitations do not reduce the value of the system but highlight areas that can be improved in future versions.

6.9. Summary of Findings

  • All sensors performed reliably in outdoor pond conditions.
  • The ESP32-32 N4 handled processing and Wi-Fi communication without failures.
  • The mobile dashboard provided real-time visibility and improved decision-making.
  • The alert system effectively notified the farmer when immediate action was required.
  • The system achieved its goal of offering a low-cost, accurate, easy-to-use
  • monitoring solution for rural aquaculture farmers.

Chapter 7. Discussion

This chapter discusses the overall performance of the aquaculture monitoring system, interprets the experimental results, evaluates the effectiveness of the selected components, and reflects on the challenges faced during implementation. The findings are compared with existing literature to understand how the system aligns with current research trends in aquaculture monitoring.

8.1. Interpretation of System Performance

The ESP32-WROOM-32–based monitoring system was able to collect and transmit temperature, pH, and turbidity values consistently throughout the testing period. Sensor readings were stable, and data was delivered to the backend server in near real time. The system performed as expected, confirming that low-cost sensors combined with a modern microcontroller can provide reliable water quality information.
The results indicate that the system is suitable for small to medium ponds, where Wi-Fi coverage is available and water quality does not vary significantly across large distances. The single-node design allowed consistent monitoring in one area, which is ideal for ponds where routine observation is traditionally done manually at a fixed point.

8.2. Sensor Performance and Data Behavior

The DS18B20 temperature sensor produced stable readings with minimal noise. Temperature changes followed natural environmental patterns, increasing gradually during the daytime and decreasing after sunset. These observations match previous studies, which suggest that temperature in shallow ponds typically remains within 26–30°C during normal conditions.
The pH sensor showed predictable fluctuations, particularly during rainfall and feeding events. This matches findings from earlier literature, where rainfall dilutes pond water and temporarily reduces pH. The turbidity sensor demonstrated meaningful variations corresponding to feeding times and fish movement. These behaviors support the validity of the selected sensors for practical aquaculture environments.

8.3. Comparison with Existing Studies

Previous research emphasized the importance of real-time monitoring systems in improving fish health and yield. Studies by Karthick and Ganeshkumar (2015) and Bhattacharjee et al. (2019) showed that IoT-based monitoring can significantly improve decision-making in aquaculture. The results from this project align with those findings.
However, most earlier works used either Arduino-based systems or high-cost industrial sensors. This project demonstrates that an ESP32-based architecture can achieve similar outcomes at a much lower cost, making it more suitable for rural farmers in Bangladesh.
Furthermore, studies highlight the need for multiple monitoring points in large ponds. This project confirms that a single-node system is adequate only for small to medium ponds. For wider coverage, additional nodes or long-range communication technologies would be required.

8.4. Strengths of the Proposed System

One of the main strengths of the system is its low cost and simplicity. The ESP32-WROOM- 32 provides built-in Wi-Fi, reducing hardware complexity. The cloud-based backend allows real-time access to data from any device. The dashboard makes the system useful even for individuals with minimal technical knowledge.
Another advantage is the modular design. Each sensor can be replaced or upgraded without changing the entire system. The system architecture also supports the addition of new sensors such as ammonia, nitrate, or dissolved oxygen.
The prototype also demonstrated high reliability during continuous testing. Even during temporary Wi-Fi interruptions, the microcontroller resumed transmission automatically without requiring manual resets.

8.5. Challenges Encountered During Implementation

Several challenges were observed during development. Analog sensors such as pH and turbidity were sensitive to noise, requiring multiple readings and filtering. The turbidity sensor readings varied with water movement, making it necessary to adjust the sampling interval.
Wi-Fi coverage was another challenge. The system relied on a stable 2.4 GHz connection, which may not be available in all rural ponds. In some cases, the signal weakened when the device was placed too far from the access point. This suggests the need for long-range communication technologies in future versions.
Environmental factors also introduced difficulties. Exposure to sunlight, water splashes, and humidity can affect sensor performance over time. Since the prototype is not fully waterproof, long-term outdoor use may reduce hardware lifespan.

8.6. Practical Implications for Aquaculture Farmers

The system demonstrates clear benefits for farmers who traditionally rely on manual testing. Real-time alerts allow quick decision-making and reduce the chances of fish mortality. Monitoring pH and turbidity can help reduce feed waste, as farmers can track how water conditions respond to feeding cycles.
By observing trends over time, farmers can adjust their feeding schedule, manage water quality more effectively, and potentially increase production without requiring expensive equipment.
However, farmers operating large ponds may require multiple monitoring nodes for accurate representation of full pond conditions.

8.7. Summary

The discussion shows that the proposed system is capable of providing accurate, real-time monitoring suitable for small to medium aquaculture ponds. The system aligns with previous research and introduces a more affordable and accessible solution for rural communities.
Despite certain limitations—such as Wi-Fi range, sensor noise, and environmental sensitivity—the prototype demonstrates strong potential for practical deployment. The findings suggest that future enhancements, including multi-node networks, long-range connectivity, and additional sensors, could significantly improve coverage and accuracy.

Chapter 9. Future Work

7.1. Introduction

The present aquaculture monitoring system successfully captures temperature, pH, and turbidity levels. However, to move from basic sensing to a more comprehensive water health management platform, future enhancements are essential. These improvements should aim to increase automation, reduce manual intervention, and offer deeper insights into pond conditions.

7.2. Technical Advancements and Integration

7.2.1. Integration with Automated Control Systems

To evolve from a passive monitoring tool into an active management system, the next step involves the integration of automated control devices:
  • Water pumps can be activated when turbidity exceeds a threshold.
  • Aerators can be turned on if the oxygen level drops (with added DO sensors).
  • Feed dispensers can be scheduled based on real-time natural feed availability and water conditions.
This closes the loop, turning the system from just “monitoring” into “monitoring and reacting.”

7.2.2. LoRaWAN-Based Remote Monitoring

In remote areas where Wi-Fi is unreliable, a LoRa-based communication protocol can be introduced. LoRa allows long-range communication (up to 10 km in rural areas) using very low power. It’s ideal for regions with little infrastructure, ensuring that farmers can still receive alerts and monitor their ponds.

7.2.3. Renewable Energy Integration

Using solar panels with battery backups, the system can run 24/7 in areas without grid access. With energy-efficient code and hardware sleep modes, the system can function for months on solar charge, making it completely off-grid and eco-friendly.

7.2.4. Ammonia (NH3) Gas Detection

One of the most critical future additions to the system is the inclusion of an ammonia (NH₃) gas sensor.

7.2.4.1. Why Ammonia Monitoring Matters

  • Ammonia is a toxic compound produced from fish waste and decaying organic matter.
  • It is invisible and odorless at low concentrations but causes stress, weakened immune response, and even death in fish.
  • Ammonia levels are closely tied to pH, temperature, and dissolved oxygen, so monitoring it adds another layer of safety and decision-making.

7.2.4.2. Suggested Sensor: MQ-137 or MQ-135

  • These are low-cost sensors that can detect ammonia gas concentration in the environment (above water).
  • In enclosed or semi-covered tanks, they can be installed just above the pond surface or inside a water-proof casing to detect accumulated gases.

7.2.4.3. Integration Possibilities

  • Connect to ESP32-32 N4 via analog pin.
  • Calibrate using standard NH₃ reference solutions or ammonia-emitting substances.
  • Display readings on the dashboard and trigger alerts when ammonia exceeds safe levels (>0.02 mg/L for most freshwater fish).
  • Develop trend graphs showing ammonia buildup and its correlation with temperature and pH.

7.2.4.4. Benefits

  • Adds a critical safety net to the monitoring system.
  • Helps in decision-making regarding water changes, aeration, and waste removal.
  • Allows predictive insight into fish stress conditions, improving welfare and growth rates.

7.2.5. Mobile App Development

A dedicated mobile app with real-time graphs, notifications, and push alerts would improve usability, especially for farmers who are not familiar with web browsers.

7.2.6. Multi-Pond and Multi-Sensor Support

Expanding the system to handle multiple ponds or sensor clusters from a single control unit will make it more viable for medium to large-scale operations.

7.2.7. Cloud Database and Analytics Dashboard

Transitioning from local MongoDB to cloud-based platforms like Firebase, AWS, or ThingsBoard would allow access from anywhere, advanced analytics, and higher scalability.

7.2.8. AI-Powered Predictive Analysis

By collecting and analyzing historical water quality data, machine learning algorithms could predict future conditions or recommend proactive actions to optimize fish health and feeding efficiency.

7.3. Summary

The future of this project lies in scaling it into a complete, modular aquaculture management solution that is affordable, intelligent, and sustainable. With integrations in energy, automation, mobile computing, and AI, the system has the potential to revolutionize fish farming in Bangladesh and other developing countries. It aligns with national digital transformation goals and supports SDGs related to food security, sustainable development, and climate resilience.
Declaration: I hereby declare that the project paper titled: “Aquaculture Automation: A Sensor-Based Approach to Optimize Water Quality” submitted to Ahsanullah Institute of Information & Communication Technology in partial fulfillment of the requirements for the degree of B.Sc. in Computer Science and Engineering, is the result of my own work carried out under the supervision of Md. Agharul Islam. This project paper has not been submitted previously, either in part or in full, to any other university or institution for the award of any degree or diploma. All sources of information used in this project paper have been duly acknowledged and referenced. I take full responsibility for the content and originality of this work.
Certification: This is to certify that the undergraduate project paper titled “Aquaculture Automation: A Sensor-Based Approach to Optimize Water Quality” has been carried out by Rehnumah Taslim Munmun, a student of the Department of Computer Science and Engineering at Ahsanullah Institute of Information & Communication Technology (AIICT). The work presented in this project paper is the original research and development effort of the student, completed under my direct supervision. It has been conducted in partial fulfillment of the requirements for the degree of Bachelor of Science in Computer Science & Engineering. To the best of my knowledge, the work reported here does not breach any academic or ethical standards.

Acknowledgments

This project paper marks a significant milestone in my academic journey, and I would like to take this opportunity to express my deepest gratitude to all those who have been a part of it. First and foremost, I am sincerely thankful to Md. Agharul Islam, my supervisor, for his consistent guidance, support, and encouragement throughout this project. His technical knowledge, patient mentoring, and constructive feedback helped shape the direction of this work and provided me with clarity during moments of doubt. I also extend my heartfelt thanks to Mahfuzur Rahman Tanveer, Lecturer, for fostering an academic environment where research and innovation are both valued and encouraged. My appreciation goes to the farmers of Chandpur who participated in the survey and shared valuable insights into their aquaculture practices. Their cooperation helped me ground this project in real-life challenges. I am also grateful to my project partner, friends, classmates, and well-wishers who shared ideas, tested prototypes, or simply motivated me to keep going. Finally, I would like to thank my family for their love, patience, and unwavering belief in me. Their emotional support has been the quiet strength behind this accomplishment.

List of Acronyms

Acronyms Full Form
IoT Internet of Things
pH Potential of Hydrogen (measure of acidity/alkalinity)
MQTT Message Queuing Telemetry Transport
API Application Programming Interface
Wi-Fi Wireless Fidelity
NTU Nephelometric Turbidity Unit
DO Dissolved Oxygen
AWS Amazon Web Services
DS18B20 Digital Sensor 18B20 (Temperature Sensor Model)
ESP8266 Espressif Systems Chip 8266 (Wi-Fi Microcontroller Module)
MQ-135 Gas Sensor Model 135 (used for air quality and ammonia detection)
MQ-137 Gas Sensor Model 137 (specifically sensitive to ammonia - NH₃)
LCD Liquid Crystal Display
HTML HyperText Markup Language
JSON JavaScript Object Notation
USB Universal Serial Bus
GPS Global Positioning System (mentioned in related works, optional)
DHT11/DHT22 Digital Humidity and Temperature Sensor (alternative to DS18B20)
AI Artificial Intelligence
SDG Sustainable Development Goal (used in future vision context)

Appendix A: Field Survey and Farmer Profiles

Includes detailed responses from 15 farmers in Chandpur district and 10 farmers in Feni district covering:
  • Pond size and fish types
  • Experience in aquaculture
  • Methods of water quality monitoring
  • Feed practices, waste, and losses
  • Interest and readiness for adopting new technology

Appendix B: ESP32 Firmware Code (Arduino IDE)

Main functional code for reading sensors and sending data to backend.
#include <WiFi.h> #include <HTTPClient.h> #include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 4
OneWire oneWire(ONE_WIRE_BUS); DallasTemperature ds18b20(&oneWire);
const char* ssid = "The Eaglet";
const char* password = "There was a brown crow"; String serverURL = "http://your-server-ip:3000/data";
int phPin = 36; int turbPin = 39;
void setup() { Serial.begin(115200); WiFi.begin(ssid, password);
ds18b20.begin();
while (WiFi.status() != WL_CONNECTED) { delay(500);
}
}
void loop() {
ds18b20.requestTemperatures();
float temperature = ds18b20.getTempCByIndex(0);
int phRaw = analogRead(phPin);
float phValue = (phRaw / 4095.0) * 14.0; int turbRaw = analogRead(turbPin);
if (WiFi.status() == WL_CONNECTED) { HTTPClient http; http.begin(serverURL);
http.addHeader("Content-Type", "application/json");
String json = "{\"temperature\":" + String(temperature) + ",\"pH\":" + String(phValue) + ",\"turbidity\":" + String(turbRaw) + "}";
http.POST(json); http.end();
}
delay(15000);
}

Appendix C: Backend Server Code (Node.js + MongoDB)

const express = require("express"); const mongoose = require("mongoose"); const cors = require("cors"); require("dotenv").config();
const app = express(); app.use(cors()); app.use(express.json());
mongoose.connect(process.env.MONGODB_URI); const Schema = new mongoose.Schema({
temperature: Number, pH: Number, turbidity: Number,
createdAt: { type: Date, default: Date.now }
});
const SensorData = mongoose.model("SensorData", Schema); app.post("/data", async (req, res) => {
try {
const data = new SensorData(req.body); await data.save();
res.json({ status: "saved" });
} catch (err) {
res.status(500).json({ error: "server error" });
}
});
app.get("/data/latest", async (req, res) => {
const logs = await SensorData.find().sort({ createdAt: -1
}).limit(50); res.json(logs);
});
app.listen(3000, () => console.log("Server running"));

Appendix D: Web Dashboard Code

<!DOCTYPE html>
<html>
<head>
<title>Pond Dashboard</title>
</head>
<body>
<h2>Realtime Aquaculture Dashboard</h2>
<div id="temp"></div>
<div id="ph"></div>
<div id="turb"></div>
<script>
async function load() {
let r = await fetch("http://your-server-ip:3000/data/latest"); let d = await r.json();
if (d.length > 0) {
document.getElementById("temp").innerText = "Temperature: " + d[0].temperature;
document.getElementById("ph").innerText = "pH: " + d[0].pH; document.getElementById("turb").innerText = "Turbidity: " +
d[0].turbidity;
}
}
setInterval(load, 5000); load();
</script>
</body>
</html>

Appendix E: Circuit Diagrams and Wiring Schematics

  • Breadboard wiring diagram
  • Voltage regulation using AMS1117
  • Serial communication between ESP32-32 N4 and ESP32 built-in Wi-Fi
  • Pin mapping and resistor values

Appendix F: Test Logs and Observations

  • Sensor accuracy testing: ±0.5°C temp, ±0.2 pH, ±5 NTU turbidity
  • Response time logs (average: 4.3 seconds)
  • Power draw measured: ~85 mA at full load

Appendix G: Visuals

  • Photo of the full prototype setup
  • Screenshot of web dashboard UI
  • Field test image from Chandpur
  • Zoomed views of each sensor module in operation

References

  1. K. Karthick and P. Ganeshkumar, "IoT-based Smart Aquaculture Monitoring System," Journal of Agriculture and Technology, vol. 1, no. 2, pp. 45–50, 2015.
  2. M. Ahmed, M. Rahman, and S. Kabir, "Challenges in Bangladesh’s Aquaculture Sector and the Role of Technology," Journal of Fisheries Research, vol. 5, no. 1, pp. 10–20, 2020.
  3. S. Bhattacharjee, A. Roy, and M. Das, "An Arduino-Based Water Quality Monitoring System for Fish Farms," International Journal of Aquatic Sciences, vol. 10, no. 3, pp. 120– 128, 2019.
  4. Food and Agriculture Organization (FAO), "World aquaculture production statistics," FAO, 2022. [Online]. Available: https://www.fao.org [Accessed: Jan. 28, 2025].
  5. Department of Fisheries, Bangladesh, Annual Fisheries Report, Dhaka: DoF, 2023.
  6. C. E. Boyd, Water Quality: An Introduction, 2nd ed., Springer, 2019.
  7. A. Bhatnagar and P. Devi, “Water quality guidelines for the management of pond fish culture,” International Journal of Environmental Sciences, vol. 3, no. 6, pp. 1980–2000, 2013.
  8. Dallas Semiconductor, "DS18B20 Datasheet," 2018. [Online]. Available: https://datasheets.maximintegrated.com [Accessed: Jan. 30, 2025].
  9. Hanna Instruments, "Understanding pH in Aquaculture," 2020. [Online]. Available: https://www.hannainst.com [Accessed: Jan. 31, 2025].
  10. G. Barbarello, "Arduino Sensor Applications in Environmental Monitoring," in Proc. IEEE Conf. Environmental Monitoring, 2021, pp. 150–155.
  11. M. Banzi and M. Shiloh, Getting Started with Arduino, Maker Media, 2020.
  12. Espressif Systems, "ESP32 built-in Wi-Fi Datasheet," 2021. [Online]. Available: https://www.espressif.com [Accessed: Feb. 04, 2025].
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.
Copyright: This open access article is published under a Creative Commons CC BY 4.0 license, which permit the free download, distribution, and reuse, provided that the author and preprint are cited in any reuse.
Prerpints.org logo

Preprints.org is a free preprint server supported by MDPI in Basel, Switzerland.

Subscribe

Disclaimer

Terms of Use

Privacy Policy

Privacy Settings

© 2026 MDPI (Basel, Switzerland) unless otherwise stated