Part

Water quality sensor, pH, TDS, EC, DO, NTU

A probe in the water and its signal board: TDS, pH, turbidity, dissolved oxygen or conductivity as a voltage, on the maker’s own curve.

or see every part
  • 3 pins
  • 2 settings
  • In 1 project
Drawn live by the editor's own code, at the size you see it.
At a glance

The Water quality sensor, pH, TDS, EC, DO, NTU in brief

What it is, and every setting the properties panel gives it.

The water quality probe is five analog boards in one part, chosen by model: DFRobot’s Gravity TDS (SEN0244), turbidity (SEN0189), dissolved oxygen (SEN0237) and EC (DFR0300) kits, and the blue PH-4502C pH board. Each has GND, VCC and OUT, the Gravity boards’ minus, plus and A, the pH board’s G, V+ and Po. On an Uno, VCC goes to 5 V and OUT to any analog pin. On an ESP32 the TDS, oxygen and EC boards run from 3.3 V into an ADC1 pin, but the pH and turbidity boards need 5 V and put out up to 3.76 and 4.2 V, so they need a divider first. The slider is the water, and the output is each maker’s own formula run backwards: 300 ppm reads 0.81 V, pH 7 reads 2.5 V with 0.18 V per pH, clear water 4.2 V on the turbidity board, 8 mg/L of oxygen 1.55 V at 25 C, and EC 164 mV per mS/cm. The temperature property drives the makers’ own compensation; skipping it, so warm water reads high, is the classic mistake. Calibration drift, the pH board’s trimmers and its To and Do pins, response time and noise are not modeled.

Family
Sensors
Pins
3
model
TDS (SEN0244) (or pH (PH-4502C), turbidity (SEN0189), dissolved oxygen (SEN0237), EC (DFR0300))
temperature
25
Pins

3 pins

Named as the editor names them, so a wire lands where you expect it.

Pin
What it does
GND
Ground. The Gravity boards' -, the PH-4502C's G.
VCC
Supply. The Gravity boards' +, the PH-4502C's V+.
OUT
The analog output. The Gravity boards' A, the PH-4502C's Po.
How to use it

How to use TDS, pH and turbidity probes with an Arduino

Every one of these boards has three pins and an analog output: GND, VCC (the Gravity boards’ plus, the PH-4502C’s V+) and OUT (A, or Po on the pH board). This monitor puts five of them on one Uno, TDS on A0, pH on A1, turbidity on A2, dissolved oxygen on A3 and conductivity on A4, all from 5 V. The sketch averages 20 readings of each and turns the voltage into the water’s value with the maker’s own formula: pH = 7 + (2.5 - V) / 0.18, for one.

Drag each probe’s slider and the serial monitor follows it to the ADC’s resolution, because the part’s output is that same formula run backwards. The fault everybody hits on the bench is calibration, which the simulator leaves out: each probe here is the typical one. The one it does show is temperature. TDS and EC read about 2 percent high for every degree above 25 C unless the sketch compensates; set the probe’s temperature property and watch.

Part pin
Board pin
OUT (TDS)
A0
OUT (pH)
A1
OUT (turbidity)
A2
OUT (dissolved oxygen)
A3
OUT (EC)
A4
VCC
5 V
GND
GND

On an ESP32 the TDS, oxygen and EC boards run from 3.3 V; the pH and turbidity boards need 5 V and put out up to 4.2 V, so they need a divider before an ESP32 pin.

Arduino Uno: aquarium water monitorlive0.000 s 0.00x
Click to open it in the editor
This is the simulator itself, running here. Click anything to open it in the editor.
TDS and pH, from the water monitor sketch
float v = volts(A0);
float ec = 133.42 * v * v * v - 255.86 * v * v + 857.39 * v;
float tds = ec / (1.0 + 0.02 * (waterC - 25.0)) * 0.5;

v = volts(A1);
float ph = 7.0 + (2.5 - v) / 0.18;
How it is modeled

What is true about the Water quality sensor, pH, TDS, EC, DO, NTU, here

In its help article’s own words: what the simulation gets right, and where it stops.

Modeled

Each output is the maker's own published formula, the one their sample code turns the voltage into the quantity with, run backwards. A sketch that uses that formula reads back the slider's value, to one converter step.

TDS. DFRobot's code: EC = 133.42 V³ - 255.86 V² + 857.39 V (µS/cm), compensated EC25 = EC / (1 + 0.02 (T - 25)), and TDS = EC25 / 2 ppm. 300 ppm reads 0.81 V, 1000 ppm 2.16 V; the board tops out at 2.3 V. The slider is the 25 C figure, the one DFRobot's GravityTDS library reports.

pH. The PH-4502C has no maker's datasheet. Its electrode gives the Nernst slope, 59.16 mV a pH at 25 C, and the board amplifies it; the slope every tutorial uses is 0.18 V a pH (a gain of about 3), with the offset trimmer set so pH 7 reads 2.5 V: pH = 7 + (2.5 - V) / 0.18. Acid reads higher: pH 4 is 3.04 V, pH 10 is 1.96 V. The slope follows the absolute temperature, as the Nernst equation says: at 0 C it is 8% smaller.

Turbidity. DFRobot's chart of voltage against turbidity, at 5 V, is the curve NTU = -1120.4 V² + 5742.3 V - 4352.9: 4.2 V in clear water, 3.9 V at 1000 NTU, 2.63 V at 3000. Murkier reads lower. The wiki says clear water reads 4.1 V give or take 0.3 V from 10 to 50 C, so temperature does nothing to this model.

Dissolved oxygen. DFRobot's single-point calibration: the voltage is in proportion to the oxygen, and saturated water (8.25 mg/L at 25 C) reads the calibration voltage, 1600 mV in their sample, which moves 35 mV a degree: DO = mV x saturation(T) / (1600 + 35 (T - 25)), with the saturation table from their code. 8 mg/L at 25 C is 1.55 V. The board's output stops at 3.0 V, which is 15.5 mg/L at 25 C.

EC. The board's gain is documented: 820 ohms of feedback and about 200 mV of excitation, so DFRobot_EC reads EC = mV / 820 / 200 x 1000 mS/cm (K = 1, before calibration), compensated by 1 + 0.0185 (T - 25). That is 164 mV per mS/cm: the 1413 µS/cm buffer reads 232 mV and the 12.88 mS/cm buffer 2.11 V.

Not ratiometric. These boards put out their own voltage whatever the supply, so a sketch that reads the converter against a 4.8 V USB supply but assumes 5 V reads a little high.

Not modeled

Calibration. Every real probe is a little different, which is why each maker has a calibration procedure. The model is the maker's typical curve: an ideal probe that has just been calibrated. Calibration drift and electrode aging (the pH and EC electrodes, the DO probe's membrane and filling solution, which DFRobot says to change every month or few) are not modeled.

The PH-4502C's trimmers. Here the offset is always exactly 2.5 V at pH 7 and the slope exactly 0.18 V a pH at 25 C. The To and Do pins, and the turbidity board's digital mode and its threshold, are not modeled either.

Response time. The output follows the slider at once. A real DO probe takes up to 90 seconds to reach 98% (DFRobot's figure), the turbidity board up to half a second.

The TDS and EC boards' AC excitation. The real boards drive the probe with an alternating signal, so the electrodes do not polarize, and smooth the result to a DC output. Only that DC output is modeled, along with no polarization at high conductivity, no noise, and none of the probes' stated accuracy (TDS ±10% of full scale, EC ±5%).

From Water quality probe (TDS, pH, turbidity, DO, EC), in full.

Projects

See the Water quality sensor, pH, TDS, EC, DO, NTU in a project

One built-in project uses it. It opens in the editor, already wired.

Boards

The boards it is shown on

This board has a built-in project with the Water quality sensor, pH, TDS, EC, DO, NTU in it.

Wire up the Water quality sensor, pH, TDS, EC, DO, NTU

Open the editor and push it into the breadboard. It is free, and it runs on your own machine.