Low-cost water quality sensors

Marco Zecchini
5 min readDec 3, 2018

--

As I have already explained in my first preliminary article, I am designing the development of a low-cost smart water monitoring system using LPWAN nodes (that sends their information to “The Things Network”).

In this scenario, it is very important to choose the sensors carefully so that they can be used by everybody at a relatively low-cost and are easy to use too: “DFRobot” was the brand I was looking for.

Waterproof DS18B20 Digital Temperature Sensor

This is a waterproofed version of the DS18B20 Temperature sensor (datasheet). Useful when it is necessary to measure in wet conditions, it supports a temperature range between -55℃ and 125℃ with an accuracy of ±0.5℃ from -10℃ to +85℃. This sensor requires a 4.7K Ohm resistor between the voltage and Signal pin but DFRobot offers a plugable terminal sensor adapter to help in making this connection secure.

DFRobot temperature sensor kit

The DS18B20 provides 9 to 12-bit (configurable) temperature readings over a 1-Wire interface, so that only one wire (and ground) needs to be connected from a central microprocessor. Since it communicates using the 1-Wire protocol, it requires only one digital pin for communication and multiple sensors can share the same pin because each of them is identified by a unique 64 bit ID burned into the chip.

The following GitHub link shows a sample code for Arduino 1.0 and above.

Analog TDS Sensor

TDS (Total Dissolved Solids) indicates the amount of milligrams of soluble solids dissolved in one liter of water. The higher the TDS value, the more soluble solids dissolved in water, and the less clean the water is. Therefore, the TDS value can be used as one of the references for reflecting the cleanliness of water.

Its TDS measurement range is between 0 and 1000 ppm with an accuracy of ±10%. Included in the kit there is also a board that ensure correctness in the connection between the microcontroller and the probe.

TDS Analog Sensor

The snippet below shows how to easy interact with it using Arduino.

Turbidity Sensor

The turbidity sensor detects water quality by measuring the levels of turbidity. It measures the light transmittance and the scattering rate which change with the amount of total suspended solids (TSS). As the TTS increases, the liquid turbidity level increases giving the idea of the quality of water.

Turbidity Sensor.

This liquid sensor provides analog and digital signal output modes. The threshold is adjustable when in digital signal mode through a potentiometer on the auxiliary board where is also located a switch to pass from analog to digital mode and vice versa.

Analog pH Sensor

This cheap sensor offers the possibility of measuring this very important property. With an accuracy of ± 0.1pH and a response time less or equal to one minute, it embeds an electrode that has as reference solution the 3NKCL one.

The sensor needs to be calibrated before the long-term usage and to do so two standard solutions are necessary, one with pH value around 7.00 and one around 4.00. I have prepared the code illustrated below that helps us in noting the two reference voltages related with these two standard solutions and, finally, computes a line to calculate the future pH values.

A notable precaution is that the electrode used for the first or long set without re-use should be immersed in the 3NKCL solution activated eight hours.

Analog pH sensor

Analog Dissolved Oxygen Sensor

Good water quality is very important to the aquatic organisms. Dissolved oxygen is one of the important parameters to reflect the water quality. Low dissolved oxygen in water will lead to difficulty in breathing for aquatic organisms, which may threaten the lives of aquatic organisms their lives. It is widely applied in many water quality applications, such as aquaculture, environment monitoring, natural science and so on. This sensor kit helps you quickly to build your own dissolved oxygen detector.

Analog Dissolved Oxygen sensor

It has a response time within 90 seconds and it has a detection range among 0 and 20 mg/L. To be maintained correctly its membrane cap needs to be replaced within a period of 1~2 months (in muddy water) or 4~5 months (in clean water).

The probe must be prepared following these instructions:

  • Preliminary, we prepare a 0.5 mol/L NaOH solution that should be added into the membrane cap firstly as the filling solution.
  • Unscrew the membrane cap from the probe and fill 2/3 volume of the cap. Make sure the probe is in vertical position with respect to the horizontal plane.
  • Carefully screw the cap back to the probe. If a bit of solution overflows out of the cap, don’t worry, it’s fine!
  • Clean the overflowed solution with a tissue.
  • Screw the NaOH solution bottle after every use to prevent the CO2 in the air from affecting the solution.
How to prepare the probe

Now we can calibrate the sensor. As before, we use the following Arduino sketch. Note that it includes the usage of a DS18B20 temperature.

Once we have uploaded the code into the Arduino, we have to dip the probe into the water and stir it for several times to wet the permeable membrane of the cap. Then, expose the probe to the air for over 1 minute and wait until the readings are stable.

We have almost done, some more steps:

  • Enter “Calibration” in the serial monitor to enter in calibration mode
  • Enter “SATCAL” to calibrate the sensor.
  • Enter “EXIT” to exit from calibration mode.

Now the probe is ready for the measurements!

Great! I have shown you all the sensors I thought useful for measurements of the physical quality of water. Now it’s your turn, have fun!

--

--