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
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
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 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
ESP32 <------> Converter 3V3 <------> VCC GND <------> GND IO36 <------> A0
Then power the ESP32 by the USB cable.
Step 6: Program
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
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.
Read more: TDS Measuring in Aquarium