Guides · 8 min read

Arduino Water Quality Monitoring: pH, TDS, Turbidity and Temp

Build an Arduino water quality monitoring station: pH, TDS, turbidity and temperature on OLED and an ESP32 web page, drinking water limits and probe isolation.

Arduino water quality monitoring means wiring pH, TDS, turbidity and temperature sensors to one board so you can track how acidic the water is, how many minerals are dissolved in it, how clear it is and how warm it is, all at the same time. Read together, these four values tell you things none of them can tell alone: is the reverse osmosis membrane wearing out, does the aquarium need a water change, did the well turn cloudy after the rain, is the hydroponic solution balanced?

In this guide you will connect all four sensors to an Arduino Uno, an ESP32 and a Raspberry Pi Pico and show the readings on an OLED display and on a web page served by the ESP32. You will also get a reference table for drinking water, ways to stop the pH and TDS probes from disturbing each other in the same container, a two-point pH calibration and a concrete calibration schedule for every sensor.

TDS water quality and conductivity sensor
The TDS sensor measures conductivity and reports dissolved minerals in ppm; it is one of the station's four sensors.

Which sensors does a water quality station need?

SensorMeasuresOutputNotes
pH module (PH-4502C or Gravity pH V2) + glass probeAcidity / alkalinity, 0–14Analog, about 2.5 V at pH 7 (4502C)Fragile probe, stored wet
TDS moduleDissolved minerals, 0–1000 ppmAnalog, 0–2.3 VTwo AC-driven electrodes
Turbidity module (SEN0189 type)Clarity, NTUAnalog, 0–4.5 V (5 V supply)Optical, no electrical contact with water
Waterproof DS18B20Temperature, −55…125 °CDigital (OneWire)Required to compensate pH and TDS

pH describes acidity, TDS the amount of dissolved ions, turbidity the suspended particles, and temperature affects both the water and the accuracy of every other reading: conductivity changes by about 2% per °C, and the pH probe's sensitivity drifts with temperature too. That is why the DS18B20 is not a luxury here but the fourth sensor you need for compensation. TDS measurement is covered in depth in our TDS sensor guide, and the temperature probe in the DS18B20 article.

Drinking water reference values

ParameterTarget rangeSource and notes
pH6.5–8.5WHO operational guidance and US EPA secondary standard; EU directive 6.5–9.5
TDS< 300 ppm excellent, < 600 ppm goodWHO palatability scale; EPA secondary limit 500 mg/L; > 1200 ppm unacceptable taste
Turbidity< 1 NTU ideal, > 4–5 NTU visibleWHO: below 1 NTU recommended for effective disinfection
TemperatureNo strict limit, cool water preferred25–45 °C in pipes favours Legionella growth
Bacteria, nitrate, lead, arsenicNot measurable with these sensorsOnly a lab analysis can tell

The pH and TDS ranges in the table are not health limits; they are targets for taste, pipe corrosion and scaling. Water below pH 6.5 can dissolve copper and lead from pipes, while water above 8.5 tastes bitter and leaves scale. Turbidity is a direct safety signal: particles shield microbes from chlorine, so a sudden rise in turbidity is often the first sign of a problem in treatment or in the supply network.

This station does not prove that water is safe to drink. Bacteria, viruses, nitrate, lead, arsenic and pesticides barely change pH, TDS or turbidity. Only a laboratory analysis can decide whether well or tank water is drinkable; the sensors are there to spot changes early.

Parts list and wiring

  • Arduino Uno, ESP32 DevKit or Raspberry Pi Pico
  • pH module with a BNC glass probe, plus pH 4.01 and 7.00 (or 6.86) buffer solutions
  • TDS module and probe
  • Turbidity sensor (switch on the module set to A)
  • Waterproof DS18B20 and a 4.7 kΩ resistor
  • 0.96 inch I2C OLED display
  • Two 10 kΩ + 20 kΩ voltage dividers for ESP32 and Pico
  • Breadboard, jumper wires and distilled water
ConnectionArduino UnoESP32Raspberry Pi Pico
pH module PoA0GPIO 35 (via divider)GP26 (via divider)
pH and turbidity VCC5VVIN (5 V)VBUS (5 V)
TDS signal (A)A1GPIO 34GP27
TDS VCC (powered from a pin)D7GPIO 25GP15
Turbidity signal (A)A2GPIO 33 (via divider)GP28 (via divider)
DS18B20 DATAD2 + 4.7 kΩ to 5VGPIO 4 + 4.7 kΩ to 3V3GP22 + 4.7 kΩ to 3V3
OLED SDA / SCLA4 / A5GPIO 21 / 22GP4 / GP5
All GNDsGNDGNDGND
The pH module and the turbidity sensor run on 5 V and their outputs can exceed 3.3 V. Never connect those two signals straight to an ESP32 or Pico: put 10 kΩ between the signal and the ADC pin and 20 kΩ from the ADC pin to GND, so 4.5 V reads as 3.0 V at most and the code multiplies by 1.5. You can check the values with the voltage divider calculator. On the ESP32 use ADC1 pins only (GPIO 32–39); ADC2 does not work while Wi-Fi is on.

Isolating the sensors: the interference problem

A pH probe measures a tiny voltage between the water and its reference electrode (about 59 mV per pH unit) with an extremely high impedance. A TDS probe pushes an alternating current through the same water. With both probes in one container and sharing one GND, the TDS current creates small voltage differences in the water and the pH reading can drift by a full unit, jump around or make no sense at all. Leakage from aquarium heaters and pumps has the same effect.

  1. Measure in turn: power the TDS module from a GPIO pin (it only draws 3–6 mA), switch it off after reading, wait 1 second and only then read the pH. Every sketch in this guide does exactly that.
  2. Use galvanic isolation: if you need continuous readings, feed the pH or TDS module through an isolated DC-DC converter (such as a B0505S) and an analog signal isolator, so the two probes no longer share a current path.
  3. Separate the probes: keep them at least 10–15 cm apart, or measure in a small sample cup filled from the main tank.
  4. Watch mains-powered devices: if the pH jumps while a heater, pump or UV lamp is running, the cause is leakage current; switch them off briefly during the reading or have the earthing checked.
Test whether your isolation works: put the pH probe in a buffer solution, add the TDS probe to the same cup and watch the pH value while you switch the TDS module on and off. If the difference stays below 0.05 your setup is clean; if it is larger, apply one of the methods above.

Arduino Uno code: four sensors and an OLED display

  1. Install Adafruit SSD1306, OneWire and DallasTemperature from the Library Manager.
  2. Build the circuit as in the table; connect the TDS module's VCC wire to D7, not to 5V.
  3. Upload the sketch, open the Serial Monitor at 115200 baud, rinse the probes with distilled water and dip them in the sample.
  4. Readings settle within 30–60 seconds; a pH probe can take a minute to stabilise in new water.
C++ (Arduino IDE)
1#include <Wire.h>
2#include <Adafruit_GFX.h>
3#include <Adafruit_SSD1306.h>
4#include <OneWire.h>
5#include <DallasTemperature.h>
6
7const int PH_PIN = A0;          // pH modülü Po / pH module Po
8const int TDS_PIN = A1;         // TDS modülü A / TDS module A
9const int TURB_PIN = A2;        // bulanıklık modülü A / turbidity module A
10const int TDS_POWER = 7;        // TDS modülünün VCC'si bu pinden / TDS module VCC from this pin
11const int DS_PIN = 2;           // DS18B20, 4,7 kΩ pull-up
12const float VREF = 5.0;         // 5V pinini multimetreyle ölç / measure the 5V pin with a multimeter
13
14const float PH_NEUTRAL = 7.00;  // tampon değeri (6,86 ise değiştir) / buffer value (change if 6.86)
15const float PH_ACID = 4.01;
16const float V_NEUTRAL = 2.50;   // nötr tamponda ölçülen gerilim / voltage in the neutral buffer
17const float V_ACID = 3.03;      // asit tamponda ölçülen gerilim / voltage in the acid buffer
18const float V_CLEAR = 4.20;     // berrak suda bulanıklık gerilimi / turbidity voltage in clear water
19const float TDS_K = 1.0;        // TDS kalibrasyon katsayısı / TDS calibration factor
20
21Adafruit_SSD1306 display(128, 64, &Wire, -1);
22OneWire oneWire(DS_PIN);
23DallasTemperature ds(&oneWire);
24
25float readVolts(int pin) {      // 20 okumanın ortalaması / average of 20 readings
26  long sum = 0;
27  for (int i = 0; i < 20; i++) { sum += analogRead(pin); delay(5); }
28  return sum / 20.0 * VREF / 1023.0;
29}
30
31void setup() {
32  Serial.begin(115200);
33  pinMode(TDS_POWER, OUTPUT);
34  digitalWrite(TDS_POWER, LOW);
35  ds.begin();
36  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
37  display.setTextColor(SSD1306_WHITE);
38  Serial.println(F("temp_c,ph,tds_ppm,ntu"));
39}
40
41void loop() {
42  ds.requestTemperatures();
43  float tempC = ds.getTempCByIndex(0);
44  if (tempC == DEVICE_DISCONNECTED_C) tempC = 25.0;   // sensör yoksa 25 °C / no sensor: 25 °C
45
46  // 1) TDS: modülü aç, ölç, kapat / power the module, measure, switch off
47  digitalWrite(TDS_POWER, HIGH);
48  delay(800);
49  float v = readVolts(TDS_PIN) / (1.0 + 0.02 * (tempC - 25.0));
50  float tds = (133.42 * v * v * v - 255.86 * v * v + 857.39 * v) * 0.5 * TDS_K;
51  digitalWrite(TDS_POWER, LOW);
52  delay(800);                                          // suyun durulmasını bekle / let the water settle
53
54  // 2) pH: TDS kapalıyken, sıcaklık düzeltmeli / with TDS off, temperature compensated
55  float slope = (PH_NEUTRAL - PH_ACID) / (V_NEUTRAL - V_ACID) * 298.15 / (tempC + 273.15);
56  float ph = PH_NEUTRAL + (readVolts(PH_PIN) - V_NEUTRAL) * slope;
57
58  // 3) Bulanıklık: 2,5–4,2 V aralığındaki eğri / turbidity curve valid for 2.5–4.2 V
59  float vt = constrain(readVolts(TURB_PIN) * 4.2 / V_CLEAR, 2.5, 4.2);
60  float ntu = -1120.4 * vt * vt + 5742.3 * vt - 4352.9;
61  if (ntu < 0) ntu = 0;
62
63  Serial.print(tempC, 1); Serial.print(',');
64  Serial.print(ph, 2);    Serial.print(',');
65  Serial.print(tds, 0);   Serial.print(',');
66  Serial.println(ntu, 0);
67
68  display.clearDisplay();
69  display.setTextSize(2);
70  display.setCursor(0, 0);
71  display.print(F("pH  "));  display.println(ph, 2);
72  display.print(F("TDS "));  display.println(tds, 0);
73  display.print(F("NTU "));  display.println(ntu, 0);
74  display.print(F("T   "));  display.println(tempC, 1);
75  display.display();
76  delay(2000);
77}
CodeWhat it does
digitalWrite(TDS_POWER, ...)Turns the TDS module on only while measuring, so no current flows while pH is read
1 + 0.02 × (T − 25)Normalises conductivity to 25 °C
298.15 / (T + 273.15)Corrects the pH probe slope for temperature (Nernst)
V_NEUTRAL, V_ACIDVoltages measured in the two buffers, entered after calibration
4.2 / V_CLEARScales the turbidity sensor to clear water
−1120.4 V² + 5742.3 V − 4352.9Approximate NTU curve of the turbidity module between 2.5 and 4.2 V

pH calibration: the two-point method

  1. Rinse the probe with distilled water and dab it dry; do not wipe the glass, rubbing it builds up static charge.
  2. Dip the probe in the pH 7.00 (or 6.86) buffer, wait a minute and read the voltage on the Po pin from the Serial Monitor or with a multimeter; that is V_NEUTRAL. On a PH-4502C you can turn the potentiometer next to the BNC so this value is about 2.50 V.
  3. Rinse again, dip the probe in the pH 4.01 buffer and read V_ACID the same way.
  4. Enter both values in the code; if your buffer is 6.86, set PH_NEUTRAL to 6.86 too. Calibrating at room temperature (about 25 °C) keeps the temperature correction accurate.
  5. If you will measure alkaline water (pools, marine tanks), calibrate with the 7.00 and 10.01 buffers instead.

The code calculates the slope of the line between the two buffers: pH = PH_NEUTRAL + (V − V_NEUTRAL) × slope. A healthy probe gives about 59 mV per pH unit at 25 °C, which after the module's amplifier shows up as roughly 150–180 mV per pH unit on the Po pin. If the difference you measure between the buffers is less than 85% of that, the probe is ageing and should be replaced. Because the slope scales with absolute temperature, the code corrects it by 298.15 / (T + 273.15); in water at 35 °C that is about 3%.

How often to calibrate, and maintenance

SensorCalibrationHow oftenMaintenance
pHTwo points: 7.00 and 4.01 (10.01 for alkaline water)Probe always in water: every 1–2 weeks; occasional use: before every sessionKeep it wet in KCl storage solution; probe life 1–2 years
TDSSingle point: 1413 µS/cm (about 707 ppm)MonthlyRinse; brush off biofilm gently every few weeks
TurbidityMeasure V_CLEAR in clear waterMonthly and after every lens cleaningWipe the optical window with a soft cloth, keep bubbles away
DS18B20Not needed; check 0 °C in ice waterOnce a yearCheck the cable entry for water ingress

The pH probe needs the most care: if the glass tip dries out, its response slows down within days and the calibration drifts. Never store the probe in distilled water; water without ions leaches ions from the glass and ages the probe. If you keep records, write down V_NEUTRAL and V_ACID at every calibration; seeing the gap between them shrink over the months tells you in advance when the probe is due for replacement.

ESP32 web dashboard for water quality

Waterproof DS18B20 temperature sensor
Waterproof DS18B20: the station's fourth sensor, used to compensate pH and TDS for temperature.

The ESP32 can show the same readings on a web page that any phone on your home network can open. The sketch below reads the four sensors in turn every 10 seconds, writes the results to the OLED and serves two addresses: the root page (/) is a simple self-refreshing dashboard, and /json returns raw data that logging and charting tools can read. Change the Wi-Fi name and password to match your network.

C++ (Arduino IDE)
1#include <WiFi.h>
2#include <WebServer.h>
3#include <Wire.h>
4#include <Adafruit_GFX.h>
5#include <Adafruit_SSD1306.h>
6#include <OneWire.h>
7#include <DallasTemperature.h>
8
9const char* WIFI_SSID = "MiRedWiFi";
10const char* WIFI_PASS = "clave1234";
11
12const int PH_PIN = 35;          // 10k/20k bölücü üzerinden / through a 10k/20k divider
13const int TDS_PIN = 34;         // TDS 3,3 V ile beslenir, bölücü gerekmez / TDS on 3.3 V, no divider
14const int TURB_PIN = 33;        // 10k/20k bölücü üzerinden / through a 10k/20k divider
15const int TDS_POWER = 25;       // TDS modülünü GPIO besler / GPIO powers the TDS module
16const int DS_PIN = 4;
17const float DIVIDER = 1.5;      // (10k + 20k) / 20k
18
19const float PH_NEUTRAL = 7.00, PH_ACID = 4.01;
20const float V_NEUTRAL = 2.50, V_ACID = 3.03;   // modül çıkışındaki gerilimler / voltages at the module output
21const float V_CLEAR = 4.20, TDS_K = 1.0;
22
23WebServer server(80);
24Adafruit_SSD1306 display(128, 64, &Wire, -1);
25OneWire oneWire(DS_PIN);
26DallasTemperature ds(&oneWire);
27
28float tempC = 25, ph = 7, tds = 0, ntu = 0;
29unsigned long lastMeasure = 0;
30
31float readVolts(int pin) {      // 21 örneğin ortancası, volt / median of 21 samples, volts
32  int mv[21];
33  for (int i = 0; i < 21; i++) { mv[i] = analogReadMilliVolts(pin); delay(3); }
34  for (int i = 1; i < 21; i++) {                 // ekleme sıralaması / insertion sort
35    int x = mv[i], j = i - 1;
36    while (j >= 0 && mv[j] > x) { mv[j + 1] = mv[j]; j--; }
37    mv[j + 1] = x;
38  }
39  return mv[10] / 1000.0;
40}
41
42void measure() {
43  ds.requestTemperatures();
44  float t = ds.getTempCByIndex(0);
45  if (t != DEVICE_DISCONNECTED_C) tempC = t;
46
47  digitalWrite(TDS_POWER, HIGH);                 // önce TDS / TDS first
48  delay(800);
49  float v = readVolts(TDS_PIN) / (1.0 + 0.02 * (tempC - 25.0));
50  tds = (133.42 * v * v * v - 255.86 * v * v + 857.39 * v) * 0.5 * TDS_K;
51  digitalWrite(TDS_POWER, LOW);                  // pH ölçerken TDS kapalı / TDS off while reading pH
52  delay(800);
53
54  float slope = (PH_NEUTRAL - PH_ACID) / (V_NEUTRAL - V_ACID) * 298.15 / (tempC + 273.15);
55  ph = PH_NEUTRAL + (readVolts(PH_PIN) * DIVIDER - V_NEUTRAL) * slope;
56
57  float vt = constrain(readVolts(TURB_PIN) * DIVIDER * 4.2 / V_CLEAR, 2.5, 4.2);
58  ntu = -1120.4 * vt * vt + 5742.3 * vt - 4352.9;
59  if (ntu < 0) ntu = 0;
60}
61
62void showOled() {
63  display.clearDisplay();
64  display.setTextSize(2);
65  display.setCursor(0, 0);
66  display.print("pH  ");  display.println(ph, 2);
67  display.print("TDS ");  display.println(tds, 0);
68  display.print("NTU ");  display.println(ntu, 0);
69  display.print("T   ");  display.println(tempC, 1);
70  display.display();
71}
72
73void handleRoot() {                              // 10 sn'de bir yenilenen sayfa / page refreshing every 10 s
74  String html = "<!DOCTYPE html><html><head><meta charset='utf-8'>"
75                "<meta name='viewport' content='width=device-width'>"
76                "<meta http-equiv='refresh' content='10'><title>Water quality</title></head>"
77                "<body style='font-family:sans-serif'><h2>Water quality</h2>";
78  html += "<p>pH: <b>" + String(ph, 2) + "</b></p>";
79  html += "<p>TDS: <b>" + String(tds, 0) + " ppm</b></p>";
80  html += "<p>Turbidity: <b>" + String(ntu, 0) + " NTU</b></p>";
81  html += "<p>Temperature: <b>" + String(tempC, 1) + " &deg;C</b></p></body></html>";
82  server.send(200, "text/html", html);
83}
84
85void handleJson() {                              // kayıt ve grafik için / for logging and charts
86  String j = "{\"ph\":" + String(ph, 2) + ",\"tds\":" + String(tds, 0) +
87             ",\"ntu\":" + String(ntu, 0) + ",\"temp\":" + String(tempC, 1) + "}";
88  server.send(200, "application/json", j);
89}
90
91void setup() {
92  Serial.begin(115200);
93  pinMode(TDS_POWER, OUTPUT);
94  digitalWrite(TDS_POWER, LOW);
95  ds.begin();
96  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
97  display.setTextColor(SSD1306_WHITE);
98  WiFi.begin(WIFI_SSID, WIFI_PASS);
99  while (WiFi.status() != WL_CONNECTED) delay(500);
100  Serial.print("IP: ");
101  Serial.println(WiFi.localIP());               // tarayıcıda bu adresi aç / open this address in a browser
102  server.on("/", handleRoot);
103  server.on("/json", handleJson);
104  server.begin();
105}
106
107void loop() {
108  server.handleClient();
109  if (lastMeasure == 0 || millis() - lastMeasure > 10000) {   // 10 sn'de bir ölç / measure every 10 s
110    lastMeasure = millis();
111    measure();
112    showOled();
113  }
114}

After uploading, type the IP address shown in the Serial Monitor into your phone's browser. analogReadMilliVolts uses the ESP32's factory ADC calibration, so it gives far more accurate voltages than analogRead. To keep data long term, send the /json values to Google Sheets or to a home automation system over MQTT, and for live charts move on to a WebSocket web server.

Water quality station with Raspberry Pi Pico and MicroPython

The Pico's three ADC channels (GP26, GP27, GP28) are exactly enough for this station. The onewire and ds18x20 modules for the DS18B20 are built into MicroPython; for the OLED you only need to copy the ssd1306.py driver to the Pico. Power the 5 V sensors from the VBUS pin (USB 5 V) and connect the pH and turbidity signals through dividers, just like on the ESP32.

MicroPython
1from machine import ADC, Pin, I2C
2import onewire, ds18x20, time
3import ssd1306                                     # ssd1306.py Pico'da olmalı / must be on the Pico
4
5ph_adc = ADC(26)                                   # GP26, bölücü üzerinden / through a divider
6tds_adc = ADC(27)                                  # GP27
7turb_adc = ADC(28)                                 # GP28, bölücü üzerinden / through a divider
8tds_power = Pin(15, Pin.OUT, value=0)              # TDS modülünü besler / powers the TDS module
9ds = ds18x20.DS18X20(onewire.OneWire(Pin(22)))
10roms = ds.scan()
11oled = ssd1306.SSD1306_I2C(128, 64, I2C(0, sda=Pin(4), scl=Pin(5)))
12
13DIVIDER = 1.5                                      # (10k + 20k) / 20k
14PH_NEUTRAL, PH_ACID = 7.00, 4.01
15V_NEUTRAL, V_ACID = 2.50, 3.03                     # kalibrasyonla bulunur / found by calibration
16V_CLEAR, TDS_K = 4.20, 1.0
17
18def volts(adc, n=21):                              # ortanca, volt / median, volts
19    r = sorted(adc.read_u16() for _ in range(n))
20    return r[n // 2] * 3.3 / 65535
21
22while True:
23    t = 25.0
24    if roms:
25        ds.convert_temp()
26        time.sleep_ms(750)
27        t = ds.read_temp(roms[0])
28    tds_power.value(1)                             # TDS aç, ölç, kapat / TDS on, read, off
29    time.sleep_ms(800)
30    v = volts(tds_adc) / (1 + 0.02 * (t - 25))
31    tds = (133.42 * v ** 3 - 255.86 * v ** 2 + 857.39 * v) * 0.5 * TDS_K
32    tds_power.value(0)
33    time.sleep_ms(800)
34    slope = (PH_NEUTRAL - PH_ACID) / (V_NEUTRAL - V_ACID) * 298.15 / (t + 273.15)
35    ph = PH_NEUTRAL + (volts(ph_adc) * DIVIDER - V_NEUTRAL) * slope
36    vt = min(max(volts(turb_adc) * DIVIDER * 4.2 / V_CLEAR, 2.5), 4.2)
37    ntu = max(0, -1120.4 * vt ** 2 + 5742.3 * vt - 4352.9)
38    oled.fill(0)
39    oled.text("pH   {:.2f}".format(ph), 0, 0)
40    oled.text("TDS  {:.0f} ppm".format(tds), 0, 16)
41    oled.text("Turb {:.0f} NTU".format(ntu), 0, 32)
42    oled.text("Temp {:.1f} C".format(t), 0, 48)
43    oled.show()
44    print("{:.1f},{:.2f},{:.0f},{:.0f}".format(t, ph, tds, ntu))
45    time.sleep(2)

Reading the numbers: real-world scenarios

  • Reverse osmosis filter: 350 ppm in and 15 ppm out means the membrane rejects 96%. If the output creeps up to 40–50 ppm over a few weeks, the membrane or pre-filters need replacing. It is normal for RO water to drop to pH 6–6.5.
  • Well or tank water: if turbidity jumps from 1 NTU to 10 NTU after rain, surface water may be seeping in; boil the water or have it tested before drinking it.
  • Aquarium: pH falling from 7.4 to 6.6 within days points to nitrate build-up and an overdue water change. Seeing temperature and TDS on the same chart catches this early.
  • Hydroponics: TDS rises as you add nutrients and falls as plants use them up. A pH outside 5.5–6.5 blocks nutrient uptake, so you add a pH adjuster.
  • Swimming pool: chlorine works best at pH 7.2–7.6; calibrate with the 7.00 and 10.01 buffers for this job.

Common mistakes and how to fix them

SymptomLikely causeFix
pH stuck around 7 and slowDried-out probe or loose BNCSoak the probe in KCl solution for a few hours, check the connector
pH drifts when TDS is onBoth probes in the same water with a shared GNDMeasure in turn or use an isolated module
High turbidity in clear waterBubbles, dirty window or V_CLEAR not setWipe the window, remove bubbles, measure V_CLEAR again
ESP32 readings break when Wi-Fi startsSignal on an ADC2 pinUse ADC1 pins, GPIO 32–39
All values slightly high or lowUSB 5 V is really 4.8 VMeasure the 5V pin with a multimeter and set VREF
TDS far too high in warm waterTemperature probe left out of the waterPut the DS18B20 at the same depth as the probes

A four-sensor water quality station tells you far more than a single number: it spots changes early, tells you when the filter or the aquarium needs attention and makes problems in well water much easier to notice. Remember to measure the probes in turn, calibrate pH at two points and read the results against the reference table. In the BlueGrays app you will find the smart irrigation station and the timestamped temperature logger projects with step-by-step wiring diagrams and code, a solid base to build this station on.

Frequently asked questions

Which sensors do I need to monitor water quality with Arduino?

A basic station needs a pH module with probe, a TDS sensor, a turbidity sensor and a waterproof DS18B20. The temperature sensor is essential for compensating the pH and TDS readings. Dissolved oxygen or ORP require additional, more expensive probes.

What should the pH of drinking water be?

Drinking water usually targets 6.5–8.5, the WHO operational guidance and the US EPA secondary standard. It is not a health limit but a range for taste and pipe corrosion. Reverse osmosis water can drop to pH 6–6.5, which is normal.

How often should a pH sensor be calibrated?

If the probe sits in water all the time, do a two-point calibration every 1–2 weeks; for occasional use, calibrate before every session. Use opened buffer solutions within a few months and never pour used solution back into the bottle. If the gap between the two buffers shrinks noticeably, the probe is ageing.

Why does my pH sensor read wrong next to a TDS sensor?

The TDS probe drives an alternating current into the water, while the pH probe measures millivolt differences at a very high impedance. In the same container with a shared GND, the TDS current can shift the pH reading by up to a full unit. The fix is to switch the TDS module off outside its reading, use galvanically isolated modules or separate the probes.

Can an Arduino tell if water is safe to drink?

No. pH, TDS and turbidity describe taste, mineral content and clarity, but bacteria, nitrate, lead or arsenic barely change those values. Only a laboratory analysis can confirm that water is drinkable; an Arduino station helps you notice changes early.

What is NTU and how much turbidity is acceptable?

NTU (Nephelometric Turbidity Unit) describes how much light is scattered by particles in the water. Below 1 NTU is ideal for drinking water, and from 4–5 NTU the cloudiness becomes visible. Cheap turbidity sensors cannot resolve differences below 1 NTU; they are good for telling clear from cloudy water and catching sudden spikes.

See all projects
Smart Irrigation Station
AR-83Advanced
Premium

Smart Irrigation Station

A gardener that waters your plants on its own, so they don't dry out while you're on vacation.

5.0(42)
57
ESP32 Temperature Data Logger (DHT22 + DS1307 RTC + microSD + OLED)
ES-40Advanced
Premium

ESP32 Temperature Data Logger (DHT22 + DS1307 RTC + microSD + OLED)

Build a timed temperature and humidity logger with the ESP32! A DHT22 sensor reads temperature and humidity once a minute, and each reading is saved to a microSD card in CSV format with a real-time stamp from the DS1307 RTC module. The OLED display shows the latest temperature, humidity, timestamp and total number of records live, in large text.

4.7(7)
12
ESP32 Asynchronous Web Server (with IP Display on LCD)
ES-27Advanced

ESP32 Asynchronous Web Server (with IP Display on LCD)

In this project, we’re turning the ESP32 into an asynchronous web server that you can control from your phone or computer on the same Wi-Fi network. Thanks to the ESPAsyncWebServer library, the server can process multiple requests simultaneously (unlike the classic WebServer.h, which blocks on a single request). You’ll be able to open the ESP32’s IP address in a browser and click the ON/OFF buttons (the /on and /off routes) to turn the LED connected to GPIO 5 on and off.

4.8(16)
27
ESP32 HTTPClient + Weather API (with SSD1306 OLED Display)
ES-32Advanced
Premium

ESP32 HTTPClient + Weather API (with SSD1306 OLED Display)

In this project the ESP32 makes a REST API call over the internet to a weather API (wttr.in) using HTTPClient.h. Unlike the I2C LCD version, it uses an SSD1306 OLED (128×64) display, with large text and vector icons for a richer look. Seven weather icons (sunny, rainy, snowy and more) are drawn on the fly, with no bitmap files.

4.3(10)
22
ESP32 DHT22 Temperature and Humidity (with LCD Display)
ES-15Intermediate

ESP32 DHT22 Temperature and Humidity (with LCD Display)

This project measures ambient temperature and humidity using a DHT22 sensor and displays the data in real time on a 16x2 I2C LCD. Data is read from the sensor using the one-wire protocol via the Adafruit DHT library. This project serves as the foundation for IoT weather stations, smart home automation, or environmental monitoring systems in greenhouses. Communication with the DHT22 is established via the ESP32's GPIO 4 pin.

4.8(38)
57
Digital Voltmeter with LCD Display
AR-56Intermediate
Premium

Digital Voltmeter with LCD Display

Find out how much voltage a battery or power adapter gives with a meter you built yourself.

4.5(27)
36
Temperature and Humidity with DHT11
AR-55Intermediate

Temperature and Humidity with DHT11

How warm is your room, and is the air humid or dry? The DHT11 sensor measures temperature and humidity, and the Arduino writes the values on a two-line LCD screen, refreshing every couple of seconds.

4.7(47)
96