Home > Projects > Temperature Measurement Projects > TDS Measuring in Aquarium

TDS Measuring in Aquarium

Summary of TDS Measuring in Aquarium


This article outlines the first step in building a smart aquarium: monitoring water quality via Total Dissolved Solids (TDS). The author explains TDS importance for fish health, details testing methods using conductivity, and describes assembling a system with an ESP32 controller and 3.5-inch display to visualize data. The project successfully measured tap water and detected high TDS levels in an existing tank, confirming the need for water changes before automating the process.

Parts used in the Smart Aquarium Water Monitoring Project:

  • TDS probe
  • TDS converter board
  • ESP32 microcontroller
  • 3.5-inch display board with capacitive touch
  • USB cable
  • Tape

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

Quick Solutions to Questions related to Smart Aquarium Water Monitoring:

  • What is TDS?
    Total dissolved solids represent the total concentration of dissolved substances in water, including inorganic salts and organic matter.
  • How does TDS affect fish?
    High TDS levels can cause fish death and algae blooms, while low levels affect growth; most freshwater fish require 400PPM to 450PPM.
  • How is TDS tested?
    Testing involves measuring water conductivity, as dissolved solids improve conductivity which correlates to TDS levels.
  • Which controller is best for this project?
    The 3.5-inch display board with ESP32 is recommended due to its WiFi connectivity and sensor expansion capabilities.
  • How do you connect the hardware?
    Connect the TDS probe to the converter, then link the converter's VCC, GND, and A0 outputs to the ESP32's 3V3, GND, and IO36 pins.
  • What formula calculates the TDS value?
    The code uses a specific polynomial formula involving compensation voltage to convert the analog signal into a TDS value.
  • What library is needed for the display?
    The TFT-eSPI.h library is required to drive the display and create visualizations like the ring meter.
  • Can this system automate water changes?
    No, current automation requires additional components like water pumps and valves controlled by the controller.

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter
Scroll to Top