Water is the most important source of life for any creature existing in nature. From here the life begins on earth before many years ago. The existence of life depend on it and if we say drinking water then some care should be taken, like it should contain proper minerals, number of solid dissolved and free from any contamination. A pure water and distilled water both are two different things. Pure water is the term used for drinking water containing some ions, minerals and all but distilled water is de-ionized water and purest form nothing is present there.
We all know, Water do not have any taste but drinking water(from purifier) due to added minerals and other impurities have a little bitter taste in the same way water form borewell has a sweet taste, but distilled water do not have any taste this is all due to the impurities present there. These impurities are known as total number of dissolved solid (named as TDS) in water.
Measuring TDS:
We can measure the TDS of any water through a dedicated sensor which returns a value after sensing and then processed to an actual reading. To measure TDS a simple procedure is there, two electrode system is prepared with a voltage source attached to them. The movement of impurities and ions to these electrodes generate the signal and then measured.
But to make the system more reliable and to control the field applied to these electrode we can use the dedicated TDS sensor as mentioned above. It come with auto zeroing and offset calibration functions, you can calibrate the sensor by placing it into special type of buffer solution and entering the reading manually. But nowadays it comes fully calibrated out of the box.
Gravity Analog TDS sensor:
This TDS sensor supports 3.3 ~ 5.5V wide voltage input, and 0 ~ 2.3V Analog voltage output, which makes it compatible with a 5V or 3.3V control system or board. The excitation source is an AC signal, which can effectively prevent the probe from polarization and prolong the life of the probe, meanwhile, increase the stability of the output signal. The TDS probe is waterproof, it can be immersed in water for a long-time measurement. An additional temperature sensor is required If temperature of water more than room temperature(25 degrees).
Features:
- Input Voltage: 3.3 ~ 5.5V
- Output Voltage: 0 ~ 2.3V
- Working Current: 3 ~ 6mA
- TDS Measurement Range: 0 ~ 1000ppm
- TDS Measurement Accuracy: ± 10% F.S. (25 ℃)
- Module Size: 42 * 32mm
- Module Interface: PH2.0-3P
- Electrode Interface: XH2.54-2P
Components Required:
- Gravity TDS sensor
- Arduino NANO/UNO
- OLED display
- Wires and connectors
- Breadboard or Custom PCB Shield
Circuit and Schematics:
Circuit is quite simple; TDS sensor gives analog reading which is measured by the Arduino and further results are calculated and displayed on the OLED screen. Connect the power to the sensor and sensor pin to the A1 of Arduino. Connect the OLED through the I2C interface, A4 to SDA and A5 to SCL. Here we are considering ideal conditions so the temperature sensor is not required. You can see other tutorials from here with temperature sensor and different microcontrollers.
Code:
you can download the libraries from the manage library section under the tools menu. This code is optimized for 12C OLED display (128x64).
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define OLED_RESET 1
Adafruit_SSD1306 display(128, 64, &Wire, OLED_RESET);
#define TdsSensorPin A1
#define VREF 5.0 // analog reference voltage(Volt) of the ADC
#define SCOUNT 30 // sum of sample point
int analogBuffer[SCOUNT]; // store the analog value in the array, read from ADC
int analogBufferTemp[SCOUNT];
int analogBufferIndex = 0,copyIndex = 0;
float averageVoltage = 0,tdsValue = 0,temperature = 25;
void setup()
{
Serial.begin(115200);
pinMode(TdsSensorPin,INPUT);
Wire.begin();
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
display.clearDisplay();
}
void loop()
{
static unsigned long analogSampleTimepoint...
Read more »