Introduction
Monitoring the TDS in your aquarium is a simple yet essential practice for maintaining a healthy and thriving aquatic environment. It provides valuable insights into water quality and helps ensure the well-being of all aquarium inhabitants.
Parts
- Arduino Uno or compatible
- TDS Probe & Gravity Analog TDS Sensor
- 16 x 2 LCD w/ I2C
- Jumper wires
Schematics
Assemble all parts per schematic
Code
Library’s required
- LiquidCrystal.h
Notes
- Change Sensor pin number if needed
- Change LCD I2C address if needed
Sketch
/*
* Arduino Project 2a TDS Sensor
* Complete Project details https://thediyaquarium.com/
*/
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2); // I2C address 0x27 , 16 column and 2 rows
#define TdsSensorPin A0
int ADC_value;
unsigned long int avgval_ADC;
int buffer_tds[10],temp1;
void setup()
{
Serial.begin(115200);
pinMode(TdsSensorPin,INPUT);
lcd.init();
lcd.backlight();
}
void loop()
{
lcd.clear();
for(int i=0;i<10;i++)
{
buffer_tds[i]=analogRead(TdsSensorPin);
delay(2);
}
for(int i=0;i<9;i++)
{
for(int j=i+1;j<10;j++)
{
if(buffer_tds[i]>buffer_tds[j])
{
temp1=buffer_tds[i];
buffer_tds[i]=buffer_tds[j];
buffer_tds[j]=temp1;
}
}
}
avgval_ADC=0;
for(int i=2;i<8;i++)
avgval_ADC+=buffer_tds[i];
float voltage_value = (float)avgval_ADC*5.0/1024.0/6;
float TDS = (133.42/voltage_value*voltage_value-255.86*voltage_value*voltage_value + 857.39*voltage_value)*0.5;
lcd.setCursor(0,0);
lcd.print(" TDS");
lcd.setCursor(3,1);
lcd.print(TDS);
lcd.setCursor(10,1);
lcd.print("PPM");
delay(5000);
}
Or click to download sketch
After download, unzip file and place file and folder in your Arduino Sketch directory
Operation
Load code (Sketch), put end of probe in aquarium
As long as there is power to the board, TDS will be displayed on LCD and updated every 5 seconds
Do Not use probe in temperatures over 55 degrees Celsius (131 degrees Fahrenheit)
The probe cannot be left too close to the edge of the aquarium; otherwise, it will affect the reading.
The head and the cable of the probe are waterproof, but the connector and the signal transmitter board are not waterproof, so be careful
Summary
Can be expanded to monitor TDS across multiple aquariums
Can be expanded to record data and send to computer or cell phone
Combined with temperature a sensor will give a more accurate reading