TDS Measuring in Aquarium

I have an idea to build a smart aquarium by improving my fish tank. It sounds very difficult for it: monitoring the water, automatic water changing, automatic feeding and so on. these are the functions that the smart aquarium required.

Now I plan to do the first step–monitoring the water quality. The water contains a lot of impurities, contaminants and chemicals. Checking the TDS in water is the easy way to monitor the water quality.

Step 1: What Is TDS

Total dissolved solids (TDS) represent the total concentration of dissolved substances in water. TDS is made up of inorganic salts, as well as a small amount of organic matter. The TDS level is how much of the total dissolved solids are present in the water. The unit of TDS level is PPM, and 1 PPM TDS represents that it has 1 mg dissolved solids in 1L water.

Step 2: How TDS Effect Fish

The fishes need a stable environment which have the same level of TDS and PH as the original habit in aquariums or tanks. Different fishes require water with different TDS. 400PPM~450PPM TDS in the water are recommended for most freshwater fish living. The concentrations too high would cause the death for fish and permit a high volume of algae bloom. The low level of TDS in the water will affect fish growth. In a word, if the TDS climbs above normal levels, you may need to help the small fishes…

Step 3: How to Test TDS

Testing the water conductivity is a common way to measure the TDS in the water. The dissolved solids can improve the water conductivity that the more dissolved solids and the better water conductivity. And TDS measurement will indicate if the minerals, salts and other compounds are building up over time.

I purchased a kit for measuring the TDS online, it is made up of the TDS probe and converter. The converter measures the water conductivity by the TDS probe and converts the result to the voltage signal.

Step 4: For Controller

Besides the sensor part of TDS measuring, I had to prepare one controller to receive the result and a display to show the TDS level. The 3.5inch display board with ESP32 is the best choice that I had used to complete many projects past.

Besides the 3.5 inch display with capacitive touch, this module has WIFI connectively, that I can even update any of my result to the internet, that I may need as the project going. The board is suitable to connect the TDS converter because it has an expansion for sensors/Actuator, convenient for my project:

Step 5: Hardware Connection

Connect the TDS probe to the TDS converter board. And connect the converter and ESP32 with the following connection. The TDS convertor board outputs an analog voltage, so any pin that has A/D on the ESP display interface is OK, I used the IO36:

ESP32 <------> Converter
3V3 <------> VCC
GND <------> GND
IO36 <------> A0

Then power the ESP32 by the USB cable.

Step 6: Program

I have programmed the ESP32 with Arduino for measuring the TDS, and the code is available on Github

ESP32 had to receive the voltage signal that the TDS converter output, and calculated these with the specified formula:

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

For driving the display, it is required to install the library TFT-eSPI.h. Refer to the example (TFT_ring_meter) included in the library, I programmed it and got some beautiful shown.

    xpos = 480 / 2 - 160, ypos = 0, gap = 15, radius = 170;
    // Comment out above meters, then uncomment the next line to show large meter
    ringMeter(value, 0, 1000, xpos, ypos, radius, "ppm", BLUE2RED); // Draw analogue meter

There are many pictures obtained by programming with the example.

Step 7: Assemble and Test

After the programming, I tried to test the tap water TDS, the output was 144PPM, which seems reasonable. I used some tape to fix the display and converter on the tank wall and placed the TDS probe to the water for measuring. This is a little risky in the testing, that the probe is waterproof while the PCBAs are not.

Tested TDS in the fish tank, the result reached a shocking number out of the range. It was above 999PPM. seems I not only had to change the water for fish tank, but also need to wash the tank. To avoid the huge change of TDS that may not be good for fish, I take some dirty water back to it, the TDS measuring is 653PPM.

Step 8:

This TDS monitoring can remind me to change the water of the tank manually. For changing water automatically, it is required some water pump and valve controlled by the controller to be assembled to the tank, it is the next for building the smart aquarium.

Source: TDS Measuring in Aquarium


About The Author

Muhammad Bilal

I am a highly skilled and motivated individual with a Master's degree in Computer Science. I have extensive experience in technical writing and a deep understanding of SEO practices.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top