# Make a TDS Detector for Water Testing Experiment

As we know, tap water contains unknown and potentially unsafe levels of minerals, some of which may make us sick, so many people usually choose to install water filters to purify tap water for health, including me sure. But over years of continued use, I found they cost me a lot because I need to replace the filter element with a new one once it's at the end of service life.

Well, with so much money spent on it, I really wonder how much this stuff purifies tap water. So I decided to DIY a TDS meter with my analog TDS sensor, and use the meter to detect the TDS of tap water before and after filtration. Moreover, I can use it to do some interesting experiments. Let's have a go.

Generally, the TDS value of tap water will drop after it's filtered. Based on this, we can know the purification effect of my water filter from experiments.

2.TDS Sensor

In this experiment, I use a TDS sensor from DFRobot. It can be used with Arduino and micro:bit mainboards, and the graphical programming software Mind+, convenient and suitable for primary and secondary school students. It supports 3.3~5.5V wide voltage input and offers a measurement range of 0-1000ppm.

Note: ppm stands for parts per million, which tells how many milliliters(grams) of solute are present in 1 000 000 milliliters(grams) of solution. The relationship: 1ppm=1mg/L.

During use, please note that the probe can't be used to detect water above 55℃, and can't be left too close to the edge of the container, otherwise, it will affect the reading. This entry-level TDS sensor has no temperature compensation, so if I want to get more accurate data, I have to use it with a temperature sensor and the program containing relevant algorithms for automatic temperature compensation. This makes it harder to use, especially for those who use graphical programming software. Any easy way? Well, I found that the sensor is calibrated in the water of 25℃, so we just need to keep the temperature of the detected water at 25℃.

Experiment Plan

The main part of a TDS meter in this project includes Arduino UNO controller, TDS sensor, DS18B20 temperature sensor, and LED display. And to facilitate the operation, a robotic arm made of three 180° servos is added to hold the two probes. Furthermore, I want it smarter, so I use a voice recognition module and a speech synthesis module to make the TDS meter listen to and execute my orders and broadcast the result.

With this meter, we can do a series of experiments to obtain TDS values of water at different temperatures, tap water before and after filtering, boiled water, untreated water, and bottled water, etc.

HARDWARE LIST
1 Arduino UNO
1 IO Expansion Board
1 Analog TDS Sensor
1 DS18B20 Temperature Sensor
1 OLED Display
3 180° Servo
1 Speech Recognition Module
1 Speech Synthesis Module

### Experiment Steps

1. Make a TDS meter

(1) Hardware Connection

Plug the expansion board into the mainboard, and then connect various electronic modules to the corresponding pins of the expansion board. As shown in Figure 5, the voice synthesis module is connected to pins 0 and 1, the three servos to pins 4, 6 and 8, the DS18B20 temperature sensor to pin A0, the TDS sensor to pin A2, and the OLED display and voice recognition module to the two I2C pins. The connection diagram is as shown in Figure 6.

(2) Programming

The program is done on Mind+, and the complete codes are as shown Figure 7. The functions to be implemented are: (1) when receiving the command "start detecting", the robotic arm begins to move the two probes of the sensor to the designated position; when receiving command "detection ends", it moves them back to the initial position; (2) continuously detect the temperature and TDS concentration of water, and show the results on the display. (3) when the temperature is higher or lower than 25 ℃, voice prompts to reduce or increase the temperature; when the temperature is exactly equal to 25 ℃, voice broadcasts the detected TDS value.

(3) Design Shell

Model on LaserMaker software. The structural drawing of the robotic arm was modified with open source drawings.

Laser cut the linden wood board (3mm), and the cut parts are as shown above.

(4) Assembly & Debugging

Assemble the bottom case and fix the electronic material on the preset position.

Assemble the robotic arm (see Figure 11).

Install the robotic arm on the top cover plate.

Connect cables and install the top plate on the bottom case.

Fix the TDS sensor and temperature sensor probes on the end of the robotic arm (see Figure 14).

Power on for testing; check if there is any change in the data before and after the probe is put into the water.

2. Doing Experiments

Experiment 1: Explore the effect of temperature on TDS values

As mentioned before, temperature compensation is required for TDS detection, which means that the water temperature may affect the detected TDS. Let's prove it.

Prepare three cups of the same tap water, put one of them into the sink with warm water for a while, one of the left two into refrigerator for a while, and the last one keeps the indoor temperature. Then test the temperature and TDS value of the three respectively and record the data.

The experiment result is as shown above which tells that: for the same water, if the water temperature is different, and the TDS will vary; the higher the temperature, the higher the TDS.

Therefore, it is necessary to keep the temperature of the detected water at 25 ℃ in later experiments.

Experiment 2: Contrast TDS of tap water before filtering with that after filtering

Prepare two cups of tap water, one of which is tap water without processing and the other is the one filtered. Then detect the temperature and TDS of the two. If the water temperature is not 25℃, voice prompts to increase temperature (place it into a sink with warm water) or reduce temperature (into a sink with ice water), as shown in Figure 19; when the temperature is 25℃, the detected TDS value is valid, record it. (Note: The temperature of the local in-season tap water is about 20℃ and heated to 25℃, so is the water in later experiments.)

The experiment result is as shown above, which tells that: the used tap water has a suitable TDS, which is reduced (although not too much) after filtering. So we can know the water filter does purify tap water.

Experiment 3: Contrast TDS of tap water with that of cool boiled water

Prepare two cups of water, one of which is tap water and the other is cool boiled water. Detect the TDS of the two with temperature of 25℃, and record the data.

The experiment result tells that: the TDS of the tap water after boiling does not change. This experiment used the tap water of 30.74ppm TDS, so it’s uncertain whether the water type will affect TDS. Let's verify!

Experiment 4: Contrast the TDS of multiple types of bottled water

Prepare several types of bottled water, pour them into cups for detection, and record the TDS value when the water temperature is 25℃.

The experiment result is as shown above, which tells that: mineral water has the highest TDS, and pure water has the lowest TDS. The results are consistent with the water composition and production process.

Extension

For further exploration of water quality, we can use mainboards and electronic modules such as pH sensors and turbidity sensors to make detectors for more experiments. Also, we can use relays, small pumps and other equipment to make tools for getting water, so that we can detect the quality of outdoor water conveniently.

The article was first published in dfrobot.com.cn, 2021-10-28