Building an Arduino Water Quality Monitoring Station (SDG 6: Clean Water and Sanitation)

Last Updated May 28, 2026

Freshwater systems depend on reliable measurement. Rivers, lakes, groundwater sources, irrigation systems, treatment facilities, wetlands, and community water supplies all require consistent monitoring to remain safe, resilient, and ecologically functional. When water quality changes go undetected, contamination events can spread quickly and affect ecosystems, agriculture, food systems, public health, and community trust.

An Arduino water quality monitoring station provides a practical way to observe water conditions using low-cost embedded electronics. By combining sensors for pH, temperature, and total dissolved solids, it becomes possible to collect local data about water chemistry and identify changes that may warrant closer investigation.

This project demonstrates how to build a small environmental monitoring station capable of measuring several key water-quality indicators. While simple, the design reflects a broader principle of sustainable infrastructure: effective water stewardship depends on measurement systems that are calibrated, validated, maintained, and interpreted responsibly. Sensor-based monitoring networks can help communities understand water conditions and support SDG 6: Clean Water and Sanitation, but prototypes like this must not be mistaken for certified laboratory or regulatory instruments.

Arduino water quality monitoring station with pH temperature and conductivity sensors measuring environmental conditions supporting SDG 6 Clean Water and Sanitation.
Arduino-based water quality monitoring station measuring pH, temperature, and dissolved solids to support environmental monitoring aligned with SDG 6.

The project also connects to broader site areas, including Environmental Monitoring Systems, Intelligent Infrastructure Systems, Freshwater Change and Earth System Risk, Sustainable Development Goals Within Planetary Boundaries, Land-System Change and Ecological Transformation, and Planetary Boundaries. In that wider context, the project is not just a maker build. It is a small prototype of the measurement infrastructure needed for water stewardship, environmental sensing, watershed protection, resilient public systems, and responsible freshwater governance.

Abstract

This project presents a prototype Arduino water quality monitoring station built around a microcontroller, a pH sensor, a total dissolved solids sensor, and a waterproof temperature sensor. The system reads environmental signals, converts them into interpretable water-quality indicators, and outputs measurements for real-time review, calibration, logging, and later analysis.

From an engineering perspective, the platform demonstrates a compact embedded sensing station for freshwater monitoring. From a sustainability perspective, it illustrates how distributed, low-cost measurement systems can support more transparent water management and earlier detection of environmental deterioration.

The system is intentionally limited. It does not replace certified laboratory analysis, regulatory monitoring, public-health testing, professional water-quality assessment, or official drinking-water safety determinations. Its value is educational and methodological: it shows how water-quality measurement works, why calibration matters, and why environmental data must be interpreted carefully.

Back to top ↑

SDG Alignment: Clean Water, Infrastructure, Cities, Ecosystems, and Watersheds

This project connects most directly to SDG 6: Clean Water and Sanitation, which focuses on ensuring availability and sustainable management of water and sanitation for all. Clean water depends not only on pipes, pumps, treatment plants, regulations, and watershed protection. It also depends on measurement systems that can detect changes in water conditions before problems become invisible, normalized, or widespread.

The project is not a certified drinking-water test, a regulatory compliance tool, or a laboratory instrument. Its contribution is narrower and still valuable: it demonstrates the sensing architecture behind water-quality monitoring. It shows how a small embedded system can measure temperature, pH, and dissolved-solids proxies, then convert raw sensor signals into interpretable environmental data.

Sustainable Development Goal How the Project Relates Project-Level Mechanism
SDG 6: Clean Water and Sanitation Supports water-quality awareness, sustainable water management, and local monitoring capacity. pH measurement, temperature sensing, TDS/conductivity proxy monitoring, calibration workflows, and time-series water data.
SDG 9: Industry, Innovation and Infrastructure Demonstrates distributed environmental instrumentation and prototype monitoring infrastructure. Arduino sensing, analog conversion, waterproof probe integration, telemetry, and reproducible environmental monitoring workflows.
SDG 11: Sustainable Cities and Communities Relates to resilient local infrastructure, community water awareness, urban runoff monitoring, and public environmental literacy. Low-cost monitoring stations that can support classroom, campus, community, and watershed observation projects.
SDG 14: Life Below Water Connects to downstream aquatic health because freshwater contamination can move through rivers, wetlands, estuaries, and coastal systems. Water-condition monitoring that can help identify changes before pollutants move farther through connected aquatic systems.
SDG 15: Life on Land Relates to wetlands, riparian zones, soils, farms, freshwater-dependent habitats, and land-water interactions. Field sensing that connects water quality with ecosystem condition, land-use pressure, runoff, and watershed stewardship.

The strongest SDG connection is SDG 6. Water-quality monitoring is foundational to safe water systems, ecosystem protection, and public trust. Without measurement, changes in pH, salinity, dissolved solids, temperature, or contamination indicators may remain hidden until ecological or health effects are already visible.

The connection to SDG 9 comes through infrastructure and innovation. Water monitoring is part of the measurement layer of modern infrastructure. Sensors, telemetry, dashboards, alerts, sampling protocols, laboratory confirmation, and public reporting all contribute to systems that can respond to water stress more intelligently.

The connection to SDG 11 appears through local communities. Schools, campuses, community groups, farms, parks, and local watershed organizations often need accessible ways to learn about water conditions. Low-cost prototypes cannot replace official monitoring programs, but they can support education, early investigation, and environmental awareness.

The connection to SDG 14 is indirect but meaningful. Freshwater systems are connected to downstream aquatic environments. Pollution in storm drains, streams, rivers, and lakes can affect estuaries and coastal systems. Monitoring at the freshwater source helps make those connections visible.

Because the Sustainable Development Goals are broad public frameworks, it is important not to overclaim. This project is not a certified analytical instrument, not a drinking-water safety system, not a public-health diagnostic tool, and not a substitute for professional sampling, laboratory analysis, or regulatory oversight. Its value is educational, methodological, and practical: it teaches the measurement logic behind water-quality monitoring and shows why calibration, validation, and responsible interpretation are essential.

In that sense, the project works best as a bridge between sustainability language and environmental engineering practice. It turns a broad goal — protect water quality — into a practical sequence: collect sensor readings, calibrate probes, compensate for temperature where appropriate, validate against reference standards, log measurements, inspect trends, and escalate unusual readings for professional confirmation.

Back to top ↑

Connections to Other Site Areas

This Arduino build belongs to a wider body of work on measurement, sustainability, and intelligent infrastructure. The project is especially relevant to Environmental Monitoring Systems, where sensor networks, field data, remote sensing, and environmental telemetry become tools for understanding ecological conditions.

It also connects to Intelligent Infrastructure Systems because water monitoring is part of a broader shift toward infrastructure that can sense, report, adapt, and support better decision-making. A future version of this prototype could feed water-quality data into dashboards, warning systems, municipal infrastructure tools, or watershed-scale monitoring networks.

At the planetary scale, this project links to Freshwater Change and Earth System Risk. Local water measurements cannot, by themselves, describe the entire freshwater boundary, but they demonstrate the same underlying principle: water systems become more governable when their physical and chemical conditions are observed consistently.

The project also connects to Land-System Change and Ecological Transformation because water quality is shaped by land use, agriculture, runoff, soil condition, wastewater, industrial activity, and watershed management. It also supports the broader development logic explored in Sustainable Development Goals Within Planetary Boundaries, where clean water, sanitation, resilient infrastructure, healthy ecosystems, and responsible development depend on practical measurement systems as well as policy commitments.

Back to top ↑

System Architecture

The water quality monitoring station consists of five major functional layers:

  • Sensor layer: pH, TDS/conductivity proxy, and temperature sensors measure water-related variables.
  • Acquisition layer: Arduino analog and digital inputs read sensor values.
  • Conversion layer: firmware converts raw ADC values and digital readings into engineering estimates.
  • Telemetry layer: results are printed to the Serial Monitor and can later be stored or transmitted.
  • Power and deployment layer: stable power, waterproof probes, enclosures, and sampling protocols support reliable operation.

The architecture follows a typical embedded sensing pipeline:

Water Sample → Sensors → Arduino Microcontroller → Conversion Logic → Telemetry / Logging / Interpretation

Each sensor produces an electrical signal representing a physical or chemical condition. The Arduino reads these signals, applies conversion logic, and reports values. The reported values become useful only after calibration, validation, and interpretation in relation to water source, sampling method, temperature, sensor condition, and measurement objective.

Back to top ↑

System Requirements

A water quality monitoring prototype becomes more useful when its requirements are explicit. Water sensors are sensitive to calibration, contamination, probe condition, temperature, and analog stability. The system must therefore be designed around measurement discipline, not only wiring.

Requirement Design Target Reason
pH measurement Estimate acidity or alkalinity using a calibrated pH probe pH is a key indicator of chemical change and aquatic suitability
Temperature measurement Measure water temperature with a waterproof probe Temperature affects aquatic biology, chemistry, sensor response, and TDS compensation
TDS/conductivity proxy Estimate dissolved-solids concentration from an analog sensor Dissolved solids can indicate salinity, minerals, runoff, or contamination changes
Calibration workflow Use reference buffers or standards before interpretation Raw sensor values are not reliable without calibration
Telemetry Print readable measurements and raw values Supports debugging, validation, and later data logging
Probe maintenance Rinse, inspect, store, and recalibrate probes appropriately Water sensors drift and foul over time
Deployment scope Use for education, screening, and prototype monitoring Clarifies that this is not a certified analytical or public-health instrument

These requirements can be reused across the Arduino sustainability project series. Each project should identify what is being measured, how it must be validated, what can fail, and where the prototype should not be overextended.

Back to top ↑

Why an Arduino Water Quality Monitoring Station Matters

Water systems are often managed through large institutions, laboratories, and centralized infrastructure. Those systems remain essential. But measurement can also happen closer to the source: near rivers, lakes, wells, farms, schools, community sites, stormwater systems, aquaculture tanks, wetlands, irrigation channels, or local treatment infrastructure.

A prototype like this demonstrates several important principles:

  1. environmental systems become easier to manage when they can be measured consistently
  2. distributed sensing can complement centralized laboratory monitoring
  3. water quality is not a single variable, but a combination of interacting indicators
  4. embedded systems can make environmental stewardship more practical and accessible
  5. measurement only becomes meaningful when calibration, context, and maintenance are taken seriously

The platform is not a replacement for certified laboratory analysis. Its value is that it translates the logic of water-quality sensing into a deployable, testable embedded system. It gives students, makers, educators, and engineers a working model for thinking about water data, sensor calibration, telemetry, and environmental reliability.

It also teaches caution. A low-cost sensor can show change, trends, and possible anomalies, but it cannot identify every contaminant or determine whether water is safe to drink. Responsible interpretation means treating unusual readings as prompts for further investigation, not as final authority.

Back to top ↑

System Overview

The monitoring station uses a combination of sensors to measure water-related conditions and report them through an Arduino-based data pipeline.

The system includes:

  • Arduino microcontroller for control and data processing
  • analog pH sensor for acidity and alkalinity
  • TDS or conductivity-based sensor for dissolved-solids estimation
  • DS18B20 waterproof temperature sensor
  • serial or optional display output for telemetry review
  • future support for SD logging, wireless transmission, solar power, or alerts

The station continuously samples sensor values, converts them into engineering estimates, and outputs the resulting measurements for observation, logging, or later analysis. More advanced versions could apply temperature compensation, rolling averages, calibration constants, outlier detection, and time-series analysis.

Back to top ↑

Bill of Materials

  • Arduino Uno or Arduino Nano
  • analog pH sensor module and pH probe
  • TDS or conductivity sensor module
  • DS18B20 waterproof temperature sensor
  • 4.7kΩ resistor for the temperature sensor pull-up
  • breadboard for bench testing or terminal connectors for field prototypes
  • jumper wires
  • stable USB or battery power supply
  • clean sample containers
  • reference pH buffer solutions for calibration
  • TDS or conductivity reference solution for calibration
  • optional waterproof enclosure for field-oriented testing

These components form a compact embedded sensing platform capable of monitoring several important water-quality indicators. For anything beyond bench testing, the enclosure, wiring, probe mounting, sampling method, and calibration materials become as important as the electronics.

Back to top ↑

Engineering Specifications

Parameter Reference Design
Microcontroller Arduino Uno, Arduino Nano, or equivalent ATmega328P-compatible board
Measured variables pH, temperature, and total dissolved solids proxy
Temperature sensor DS18B20 waterproof probe
pH interface Analog voltage output to Arduino ADC
TDS interface Analog voltage output to Arduino ADC
ADC resolution 10-bit, 0–1023 on standard Arduino Uno/Nano
Telemetry output Serial Monitor, optional future logging, display, or dashboard layer
Power system USB or battery, with optional future solar support
Deployment scope Educational, prototype, and experimental environmental monitoring

The reference design should be understood as a low-cost prototype. It is appropriate for learning, screening, and controlled experiments, not for legal compliance, health-risk determination, regulatory reporting, or final drinking-water decisions.

Back to top ↑

Key Water Quality Indicators

pH

pH measures the acidity or alkalinity of water on a scale from 0 to 14. A pH of 7 is neutral, values below 7 are acidic, and values above 7 are basic. pH is important because many aquatic organisms and chemical processes are sensitive to acidity and alkalinity.

pH can shift because of runoff, industrial discharge, biological activity, acid mine drainage, algal blooms, wastewater, or changes in dissolved carbon chemistry. A low-cost pH probe can help detect changes, but it must be calibrated with reference buffers before interpretation.

Temperature

Water temperature influences dissolved oxygen levels, biological activity, chemical reaction rates, stratification, and sensor behavior. Many aquatic organisms are sensitive to temperature fluctuations, making thermal measurement a critical environmental indicator.

Temperature also matters because many electrochemical and conductivity-related measurements vary with temperature. A TDS value without temperature context is less useful than a TDS value measured alongside temperature.

Total Dissolved Solids

Total dissolved solids represent an estimate of dissolved minerals, salts, and ions in water. High TDS levels may indicate salinity shifts, agricultural runoff, wastewater influence, road salts, groundwater mineral content, industrial input, or other dissolved constituents.

TDS is useful as a screening indicator, but it does not identify the specific dissolved substances present in the sample. A high TDS value tells the user that dissolved material is present; it does not tell whether the material is harmless minerals, nutrients, salts, metals, or contaminants of concern. Laboratory analysis is required for chemical identification.

Back to top ↑

Measurement Principle: pH, Temperature, Conductivity, and TDS

The monitoring station combines three different measurement types. The DS18B20 reports digital temperature readings. The pH sensor produces an analog voltage related to acidity or alkalinity. The TDS sensor produces an analog voltage related to conductivity, which is then converted into an approximate dissolved-solids estimate.

This distinction matters because not all sensor outputs have the same reliability. The temperature sensor is relatively straightforward. The pH and TDS sensors require more careful calibration, cleaning, stabilization time, and interpretation.

pH probes are electrochemical sensors. Their response can drift over time and may vary with probe condition, temperature, storage, and calibration quality. TDS sensors usually estimate dissolved solids from electrical conductivity. Because conductivity changes with temperature and ion composition, TDS is a proxy rather than direct identification of pollutants.

The measurement principle is therefore not simply “read pH and TDS.” It is: collect electrical signals, convert them into approximate water-quality indicators, check them against reference standards, interpret them in context, and avoid overstating what the sensors can prove.

Back to top ↑

Mathematical Lens: From Sensor Voltage to Water-Quality Interpretation

The Arduino water quality station can be understood as a signal-conversion system. Raw electrical readings are converted into approximate environmental indicators through calibration equations and interpretation rules.

\[
V=\frac{x}{1023}V_{\mathrm{ref}}
\]

Interpretation: A 10-bit Arduino analog reading \(x\) is converted into voltage using the reference voltage \(V_{\mathrm{ref}}\).

This conversion is the first step for analog pH and TDS sensors. If the reference voltage is unstable, the resulting measurement will also be unstable.

\[
\bar{x}=\frac{1}{n}\sum_{i=1}^{n}x_i
\]

Interpretation: Averaging multiple analog readings reduces short-term noise before converting readings into pH or TDS estimates.

Analog water sensors can fluctuate because of electrical noise, probe movement, bubbles, temperature changes, and unstable contact with the water sample. Averaging helps, but it does not replace calibration.

\[
\mathrm{pH}=mV+b
\]

Interpretation: A calibrated pH estimate can be modeled as a linear relationship between probe voltage and pH over the working range of the sensor.

The constants \(m\) and \(b\) should be derived from calibration buffers rather than assumed. A two-point or three-point calibration using known pH solutions is much more defensible than relying on a generic formula.

\[
C_{25}=\frac{C_T}{1+\alpha(T-25)}
\]

Interpretation: Conductivity can be temperature-compensated to an equivalent value at 25°C using coefficient \(\alpha\).

TDS modules often use conductivity-related measurements. Because conductivity changes with temperature, compensation improves comparability across samples measured under different thermal conditions.

\[
\Delta y = y_t-y_{t-1}
\]

Interpretation: Change between consecutive readings can reveal trends or sudden shifts that may matter more than a single isolated value.

The mathematical lens shows why this project is more than a sensor demo. It is a small environmental measurement system. Its usefulness depends on conversion, calibration, averaging, temperature context, trend detection, and a careful distinction between screening data and confirmed water-quality analysis.

Back to top ↑

Circuit Logic, Analog Stability, and Probe Protection

The circuit has two major tasks: measure water-related signals and protect the electronics from the water environment. The DS18B20 uses a digital one-wire interface. The pH and TDS modules produce analog voltages read by the Arduino’s analog-to-digital converter.

Analog stability is especially important. pH and TDS readings can be affected by noisy power, unstable reference voltage, poor grounding, long wires, loose breadboard connections, probe fouling, or electromagnetic interference from pumps and motors. Stable power and clean wiring improve measurement consistency.

The electronics should remain dry. Only waterproof or water-compatible probes should enter the sample. The Arduino, breadboard, sensor boards, battery, and connectors should be kept above splash level and inside an enclosure if used near field conditions.

The core circuit lesson is that water-quality monitoring is not only code. It is an instrumentation problem involving sensor chemistry, analog electronics, calibration standards, physical sampling, enclosure design, and maintenance practice.

Back to top ↑

How the Monitoring Station Works

The monitoring station reads water temperature from the DS18B20, then samples analog voltages from the pH and TDS modules. The firmware averages readings, converts raw ADC values into voltages, applies calibration or prototype conversion formulas, and prints the results in a readable form.

During each measurement cycle, the system:

  1. requests a water temperature reading
  2. samples the pH analog input several times
  3. samples the TDS analog input several times
  4. converts raw ADC readings into voltages
  5. estimates pH using calibration constants
  6. estimates TDS using a conductivity-related formula and temperature context
  7. prints telemetry for review, logging, or later analysis

This loop demonstrates the core architecture of low-cost environmental instrumentation: sense, convert, validate, log, interpret, and maintain.

Back to top ↑

Design Assumptions and Constraints

This prototype assumes:

  • educational, screening, or prototype use
  • low-cost sensors rather than laboratory-grade instrumentation
  • calibrated probes before serious interpretation
  • stable sampling containers or controlled field sampling
  • proper probe cleaning and maintenance
  • no drinking-water safety decisions based on prototype readings alone

It also assumes that pH, temperature, and TDS are useful for the monitoring question. In many water-quality contexts, they are only part of the picture. Dissolved oxygen, turbidity, nitrate, phosphate, coliform bacteria, heavy metals, hydrocarbons, pesticides, and other contaminants may be equally or more important depending on the site and concern.

The project therefore teaches a monitoring pattern rather than claiming comprehensive water analysis. Responsible water monitoring requires matching the indicators to the environmental question.

Back to top ↑

Wiring the Monitoring Station

The sensors connect directly to the Arduino using analog and digital input pins.

  • pH sensor output → Arduino A0
  • TDS sensor output → Arduino A1
  • DS18B20 data → Arduino digital pin 2
  • All sensor VCC → Arduino 5V or sensor-specified supply voltage
  • All sensor GND → Arduino GND

The DS18B20 temperature sensor requires a 4.7kΩ pull-up resistor between the data line and the supply voltage.

In practical deployments, stable grounding and clean wiring matter because water-sensing systems can be sensitive to analog noise, poor reference stability, and sensor-placement variability. For field-oriented builds, move away from loose breadboard wiring and toward strain-relieved connectors, waterproof cable glands, and a dry electronics enclosure.

Back to top ↑

Field Deployment, Probe Maintenance, and Sampling Practice

Water-quality sensors are strongly affected by how sampling is done. A sensor placed near sediment, algae, stagnant water, moving water, or a recent discharge point may read differently from a sensor placed elsewhere in the same water body. Sampling location, depth, time of day, weather, recent rainfall, and water movement all matter.

For better measurement practice:

  • record sampling location and time
  • rinse probes with clean water between samples
  • allow readings to stabilize before recording values
  • avoid touching probe surfaces with bare hands
  • keep pH probes stored according to manufacturer guidance
  • calibrate before important sampling sessions
  • record recent rain, runoff, temperature, and visible conditions
  • compare suspicious readings with reference instruments or laboratory tests

Probe maintenance is part of the system. Fouling, drying, scratches, chemical residue, storage errors, and calibration drift can make a technically working device produce misleading data.

Back to top ↑

Firmware Design Goals

The firmware in this project is designed to do more than print raw sensor values. It attempts to provide a usable monitoring framework by:

  • reading multiple sensors in a repeatable cycle
  • averaging analog inputs to reduce short-term noise
  • converting analog signals into interpretable engineering estimates
  • including temperature context for water-quality interpretation
  • keeping telemetry readable for debugging and observation
  • printing both raw and processed values where useful
  • creating a foundation for future data logging and remote reporting

These goals make the system more useful as a prototype environmental station rather than just a collection of disconnected sensors.

Back to top ↑

Basic vs. Advanced Firmware

A minimal water-quality station could read three sensors and print values to the Serial Monitor. That is useful for a first test, but it does not teach the measurement discipline needed for environmental interpretation.

The advanced version used here adds averaging, calibration constants, temperature context, structured telemetry, and clear comments about limits. These additions make the prototype more useful for validation, comparison, logging, and future expansion.

The larger lesson for the project series is that code should teach the structure of measurement. A sustainability prototype should show not only how to read a sensor, but how to convert sensor output into defensible environmental data.

Back to top ↑

Advanced Arduino Code

The code below provides a practical starting point for temperature, pH, and TDS monitoring using Arduino-compatible sensors. The conversion equations are suitable for prototype development and should be calibrated against reference solutions or reference meters before any serious field interpretation.

/*
  Arduino Water Quality Monitoring Station

  Measures:
  - Water temperature using a DS18B20 waterproof sensor
  - pH using an analog pH sensor module
  - Total dissolved solids using an analog TDS sensor module

  Notes:
  - This is prototype firmware for educational and experimental use.
  - pH and TDS readings should be calibrated with reference solutions.
  - The formulas below provide a starting point, not laboratory-grade validation.
  - Do not use prototype readings for drinking-water safety decisions.
*/

#include <OneWire.h>
#include <DallasTemperature.h>

// DS18B20 temperature sensor is connected to digital pin 2.
#define ONE_WIRE_BUS 2

// Create OneWire and DallasTemperature objects for the DS18B20 sensor.
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature temperatureSensors(&oneWire);

// Analog input pins for water-quality sensors.
const int phPin = A0;
const int tdsPin = A1;

// Arduino ADC reference voltage and resolution.
const float referenceVoltage = 5.0;
const float adcResolution = 1023.0;

// Number of samples used for analog averaging.
const int sampleCount = 10;

// Delay between measurement cycles.
const unsigned long sampleDelayMs = 2000;

// pH calibration constants.
// Replace these with values derived from pH 4, 7, and 10 buffer calibration.
float phSlope = -5.70;
float phIntercept = 21.34;

// TDS temperature compensation coefficient.
// A common approximate value for conductivity compensation is around 0.02 per degree C.
const float compensationCoefficient = 0.02;

int readAnalogAverage(int pin) {
  long total = 0;

  for (int i = 0; i < sampleCount; i++) {
    total += analogRead(pin);
    delay(10);
  }

  return total / sampleCount;
}

float adcToVoltage(int rawValue) {
  return rawValue * (referenceVoltage / adcResolution);
}

float estimatePH(float voltage) {
  /*
    Estimate pH from voltage using calibration constants.

    The slope and intercept should be calculated from reference buffer
    solutions rather than treated as universal constants.
  */
  return phSlope * voltage + phIntercept;
}

float estimateTDS(float voltage, float temperatureC) {
  /*
    Estimate TDS from analog sensor voltage with simple temperature compensation.

    This polynomial is commonly used with low-cost analog TDS modules as a
    prototype conversion. Calibration against reference solutions is required
    for serious interpretation.
  */
  float compensationFactor = 1.0 + compensationCoefficient * (temperatureC - 25.0);
  float compensatedVoltage = voltage / compensationFactor;

  float tdsValue =
    (133.42 * compensatedVoltage * compensatedVoltage * compensatedVoltage
    - 255.86 * compensatedVoltage * compensatedVoltage
    + 857.39 * compensatedVoltage) * 0.5;

  return tdsValue;
}

void printTelemetry(
  float temperatureC,
  int phRaw,
  float phVoltage,
  float phValue,
  int tdsRaw,
  float tdsVoltage,
  float tdsValue
) {
  Serial.print("Temperature_C: ");
  Serial.print(temperatureC, 2);

  Serial.print(" | pH_raw: ");
  Serial.print(phRaw);

  Serial.print(" | pH_voltage: ");
  Serial.print(phVoltage, 3);

  Serial.print(" | pH_estimate: ");
  Serial.print(phValue, 2);

  Serial.print(" | TDS_raw: ");
  Serial.print(tdsRaw);

  Serial.print(" | TDS_voltage: ");
  Serial.print(tdsVoltage, 3);

  Serial.print(" | TDS_ppm_estimate: ");
  Serial.println(tdsValue, 1);
}

void setup() {
  // Start serial communication for telemetry output.
  Serial.begin(9600);

  // Start the DS18B20 temperature sensor library.
  temperatureSensors.begin();

  Serial.println("Arduino Water Quality Monitoring Station");
  Serial.println("Temperature, pH, and TDS telemetry starting...");
  Serial.println("Prototype measurements require calibration and validation.");
  Serial.println("---------------------------------------------------------");
}

void loop() {
  // Request a temperature reading from the DS18B20 sensor.
  temperatureSensors.requestTemperatures();
  float temperatureC = temperatureSensors.getTempCByIndex(0);

  // Check for disconnected DS18B20 probe.
  if (temperatureC == DEVICE_DISCONNECTED_C) {
    Serial.println("Temperature sensor error: DS18B20 disconnected.");
    delay(sampleDelayMs);
    return;
  }

  // Read averaged raw values from analog sensors.
  int phRaw = readAnalogAverage(phPin);
  int tdsRaw = readAnalogAverage(tdsPin);

  // Convert raw ADC readings to voltages.
  float phVoltage = adcToVoltage(phRaw);
  float tdsVoltage = adcToVoltage(tdsRaw);

  // Estimate pH and TDS values.
  float phValue = estimatePH(phVoltage);
  float tdsValue = estimateTDS(tdsVoltage, temperatureC);

  // Print readable telemetry output.
  printTelemetry(
    temperatureC,
    phRaw,
    phVoltage,
    phValue,
    tdsRaw,
    tdsVoltage,
    tdsValue
  );

  Serial.println("---------------------------------------------------------");

  // Wait before taking the next reading.
  delay(sampleDelayMs);
}

Back to top ↑

GitHub Repository

The article body includes the core firmware and design explanation so the build remains readable. The full repository expands the project into a reproducible prototype package, including Arduino firmware, setup documentation, calibration notes, deployment guidance, bill of materials, example water-quality readings, and wiring materials.

The repository contains the complete prototype build materials:

  • Arduino monitoring firmware
  • bill of materials
  • setup guide
  • calibration notes
  • deployment notes
  • example water-quality readings

Repository Structure

arduino-water-quality-monitoring-station/

README.md
LICENSE

BOM.csv

firmware/
  water_quality_monitor.ino

docs/
  setup_guide.md
  calibration.md
  deployment_notes.md
  validation.md

data/
  example_water_quality_readings.csv

hardware/

Engineers can clone the repository, fork the design, or download the complete project using GitHub’s Download ZIP feature. All materials are released under the MIT License to support reuse in research, education, and prototype engineering work.

Back to top ↑

Engineering Notes

A few technical points are important in this build:

  • Analog interpretation: pH and TDS values are derived from analog voltage, so measurement quality depends on sensor calibration and signal stability.
  • Temperature as context: thermal conditions influence water chemistry and can also affect sensor behavior.
  • TDS as proxy: TDS readings offer a useful indicator, but they do not identify which specific dissolved substances are present.
  • Field variation: water movement, probe placement, and contamination on the sensor surface can all affect readings.
  • Calibration dependence: the station is only as useful as the care taken in validating the sensors.
  • Probe care: pH probes require appropriate storage, rinsing, and recalibration to remain useful.
  • Signal stability: unstable reference voltage, long wires, and poor grounding can degrade analog measurements.

These constraints do not reduce the value of the build. They clarify its role as a prototype environmental monitoring system rather than a laboratory-certified instrument.

Back to top ↑

Failure Modes and Practical Risks

A useful water-monitoring article should explain not only how the station works, but how it can fail. Water-quality systems can fail through sensor drift, probe fouling, analog noise, sampling error, calibration error, and overinterpretation.

  • pH probe drift: pH readings can shift over time if the probe is not calibrated, stored, or maintained properly.
  • Probe fouling: algae, sediment, oil, biofilm, or residue can affect sensor response.
  • Temperature effects: conductivity and some sensor outputs change with water temperature.
  • Analog noise: unstable voltage, poor grounding, long wires, and electrical interference can create noisy readings.
  • Sampling bias: one location or depth may not represent the whole water body.
  • TDS overinterpretation: TDS does not identify specific contaminants or determine safety.
  • Calibration error: expired buffers, contaminated standards, or incorrect calibration constants can produce misleading results.
  • False confidence: live readings may look precise even when the sensors are unvalidated.
  • Public-health overreach: prototype readings must not be used to declare water safe to drink.

These risks do not make the project unusable. They define the responsible scope. A prototype station can support learning, screening, and trend observation, but unusual or consequential results require confirmation through appropriate reference methods or professional testing.

Back to top ↑

Calibration and Validation

Calibration is central to this project. The pH sensor should be calibrated using known buffer solutions, commonly including pH 4.0, 7.0, and 10.0 depending on the expected measurement range. The TDS or conductivity sensor should be checked against a known standard solution. The temperature probe should be compared against a reference thermometer under stable conditions.

A practical validation procedure should include:

  1. verify that the DS18B20 temperature probe reports stable readings in water
  2. compare pH readings against reference buffer solutions or a calibrated pH meter
  3. compare TDS readings against a known standard solution or reference meter
  4. observe how measurements change under different water conditions
  5. repeat measurements over time to evaluate consistency
  6. check for analog drift, noisy output, unstable sensor baselines, or slow stabilization
  7. document calibration date, reference solutions, and probe condition

If results appear inconsistent, the problem may be related to sensor calibration, signal noise, water chemistry variation, probe condition, temperature variation, or sampling method rather than to the measurement logic alone.

Example Calibration Record

Calibration Item Reference Value Sensor Reading Adjustment Needed? Notes
pH buffer 4.00 4.18 Yes Acid-side calibration point
pH buffer 7.00 7.05 Minor Neutral reference
pH buffer 10.00 9.72 Yes Base-side calibration point
TDS standard 342 ppm 356 ppm Minor Temperature compensation checked
Temperature bath 25.0°C 24.8°C No Stable reading after equilibration

A calibration record like this gives the data a quality context. Without calibration records, water-quality numbers can look authoritative while remaining difficult to trust.

Back to top ↑

Suggested Performance Metrics

For a more rigorous evaluation, the station can be assessed using a few simple metrics:

  • temperature stability: consistency of repeated thermal readings under unchanged conditions
  • pH agreement: alignment between the station and reference pH buffer or reference meter
  • TDS agreement: alignment between the station and a reference TDS or conductivity standard
  • telemetry repeatability: whether repeated outputs remain interpretable and stable
  • sensor drift: whether measurements shift noticeably over time without a real change in the water sample
  • response time: how long probes take to stabilize after entering a sample
  • field durability: whether probes, wiring, and enclosure remain reliable under realistic conditions

Even simple tracking of these metrics improves the credibility and usefulness of the prototype. Environmental monitoring becomes more meaningful when sensor behavior is measured alongside the environmental condition itself.

Back to top ↑

Data Logging Extension

The station becomes more useful when water temperature, pH, TDS, raw sensor readings, calibration metadata, location, and timestamps are logged over time. Even a simple CSV file can help distinguish real environmental change from sensor drift, sampling variation, or temporary disturbance.

Field Example Purpose
timestamp 2026-05-28 09:15:00 Records when the measurement occurred
site_id creek_upstream_01 Identifies the monitoring location
temperature_c 18.6 Water temperature context
ph_estimate 7.42 Estimated pH after calibration
tds_ppm_estimate 218 Estimated total dissolved solids
ph_raw 512 Raw pH ADC value for debugging
tds_raw 391 Raw TDS ADC value for debugging
calibration_id ph_cal_2026_05_28 Links readings to calibration history
notes after heavy rain Preserves field context for interpretation

Data logging is especially useful in water monitoring because isolated readings can be misleading. Trends, sudden shifts, repeated anomalies, and correlations with rainfall or land-use activity are often more informative than single values.

Back to top ↑

Applications

Water-monitoring stations like this support a wide range of environmental and engineering applications:

  • river and lake monitoring
  • well and groundwater screening
  • agricultural water management
  • aquaculture and hydroponics education
  • environmental education programs
  • community science initiatives
  • early detection of unusual water-condition changes
  • prototype telemetry systems for local infrastructure monitoring
  • stormwater, runoff, or watershed observation projects

Distributed monitoring networks can provide continuous environmental data that improves both scientific understanding and policy decision-making. In a more advanced architecture, local Arduino stations could become part of a wider environmental data layer connected to dashboards, alerts, watershed models, or community reporting systems.

Back to top ↑

Future Improvements

Several upgrades could significantly expand this prototype:

  • SD card logging for long-term data collection
  • OLED or LCD display for field readout
  • wireless telemetry using ESP32, LoRa, or cellular modules
  • solar power and battery management
  • turbidity sensing
  • dissolved oxygen sensing
  • conductivity calibration and temperature compensation improvements
  • automatic calibration reminders
  • weatherproof enclosure and probe-mounting system
  • dashboard visualization and anomaly alerts

Each upgrade introduces new validation needs. More sensors do not automatically make a station more reliable if the added probes are poorly calibrated, poorly maintained, or poorly interpreted.

Back to top ↑

Responsible Deployment

This prototype is appropriate for classrooms, makerspaces, environmental education, community science, controlled experiments, and early-stage water-monitoring prototypes. It should not be used to determine whether water is safe to drink, whether a facility is compliant with regulation, whether a contamination event is legally confirmed, or whether public-health action is warranted without professional confirmation.

Responsible deployment means matching the system to the consequence of error. A classroom test with reference solutions can tolerate rough measurements. A drinking-water source, public lake, agricultural runoff site, or suspected contamination event requires stronger sampling protocols, certified instruments, laboratory methods, chain-of-custody procedures where appropriate, and qualified interpretation.

A responsible version should include clear sensor limits, calibration records, probe-maintenance procedures, raw and processed data logging, location metadata, quality flags, validation against references, and an escalation pathway for unusual readings. The prototype teaches the logic of monitoring; it does not authorize unsafe water decisions.

Back to top ↑

Supporting SDG 6: Clean Water and Sanitation

The United Nations Sustainable Development Goal 6 focuses on ensuring the availability and sustainable management of water and sanitation for all. Achieving this objective requires not only infrastructure investment but also reliable environmental monitoring systems.

Low-cost embedded technologies allow communities, schools, researchers, and early-stage engineers to build distributed water monitoring prototypes capable of identifying unusual patterns, measuring ecosystem conditions, and supporting responsible water governance conversations.

Projects like this Arduino water quality monitoring station illustrate how accessible engineering tools can contribute to more transparent and resilient water systems. They also demonstrate how sustainability work can move from abstract commitments into practical measurement, instrumentation, validation, and reproducible design.

The deeper lesson is that water stewardship depends on feedback. Freshwater systems cannot be managed responsibly if changes are invisible, if sensors are uncalibrated, or if data is separated from local context. Measurement is not the whole of water governance, but it is one of its foundations.

Back to top ↑

Reproducibility

All firmware, documentation, and supporting build materials necessary to reproduce the prototype are included in the project repository. The design intentionally relies on widely available educational and hobbyist hardware so that it can be rebuilt in classrooms, labs, and independent environmental monitoring projects.

The system is intended as a reference implementation rather than a certified analytical instrument. Engineers adapting it for real monitoring deployments should validate sensor calibration, probe maintenance, enclosure design, power stability, analog reference behavior, sampling procedures, and long-term reliability under local environmental conditions.

For the rest of this project series, reproducibility should mean more than making code available. Each article should include a clear bill of materials, wiring logic, validation notes, failure modes, test procedure, data interpretation guidance, and a realistic statement of appropriate use.

Back to top ↑

Conclusion

Building an Arduino water quality monitoring station demonstrates how embedded systems can support environmental stewardship. By integrating sensors for pH, temperature, and dissolved solids, the system provides real-time insight into water conditions and illustrates the core principles used in modern environmental monitoring infrastructure.

While this prototype is relatively simple, the underlying concept is powerful: when environmental conditions can be measured clearly, they can also be investigated, discussed, and managed more effectively. Distributed sensor networks will play an increasingly important role in protecting freshwater resources, supporting resilient infrastructure, and advancing sustainable development.

For classrooms, community science projects, makerspaces, engineering labs, and early-stage environmental monitoring work, this project provides a practical foundation for thinking about water chemistry, calibration, sensor drift, field sampling, telemetry, and responsible interpretation.

The deeper lesson is not simply that an Arduino can read pH, temperature, and TDS sensors. The deeper lesson is that clean water systems require feedback. When water-quality data is tied to calibration, validation, maintenance, context, and responsible escalation, even a small prototype can demonstrate the logic of more intelligent freshwater infrastructure.

Back to top ↑

Further Reading

Back to top ↑

References

Back to top ↑

Scroll to Top