IOT Projects

TDS Meter with TDS Sensor and Arduino for water quality monitoring in Realtime

Learn how to measure the TDS value of water by creating an easy realtime TDS monitoring device with Arduino and TDS sensor.

Total dissolved solids (TDS) are measured in milligrams per unit volume of water (mg / l) or also referred to as parts per million (ppm). For drinking water, the maximum concentration level established by the EPA (the United States Environmental Protection Agency) is 500 mg / L.  So TDS value is used as a reference in knowing the quality of  water for drinking,  Aquaponics, hydroponics and where the quality of water matters.

So taking this into consideration we are going to build an IOT TDS monitoring device with the help of Arduino with Gravity Analog TDS sensor which is designed for Arduino with simple plug and play use.  As TDS is dependent on temperature we use a waterproof temperature sensor bundled with the TDS sensor probe.

What is TDS?

TDS (Total dissolved solids), are inorganic compounds found in water, such as salts, heavy metals, and some traces of organic compounds that dissolve in water. Some of these compounds or substances can be essential for life, however, it can be harmful when taking more than the desired amount that the body needs.

How does a tds reader work?

Total dissolved solids at a technical level are measured in a laboratory but if we are interested in measuring it ourselves, the best option is to use an electronic TDS Meter.

The TDS reader works by measuring Electronic conductivity(EC) of water and calculating it and bringing TDS value. This is measured in PPM (Parts Per Million).

Pure H2O water or distilled water does not conduct electricity, so if a TDS reader is immersed in fully distilled water the result will be “0” or a very low number in the event that there are trace minerals in the Water. It is the charge of electrons that make up the minerals that conducts electricity. In short, a water with more minerals conducts more electricity than a water without minerals.

Making of Arduino TDS Meter

Product Requirements:

  • Arduino UNO R3
  • Gravity analog TDS sensor
  • DS18B20 One-Wire Waterproof Temperature Sensor
  • JHD162A 16X2  LCD Display ( to dislay the data on mini LCD screen)
  • 10k Potentiometer
  • 4.7k Resistor
  • ESP8266 (ESP-01 or any compatible) (If you need the data over network on blynk).

Software Requirements:

  • Arduino IDE
  • GravityTDS.h Library
  • OneWire.h
  • DallasTemperature.h
  • ESP8266WiFi

New Product specs:

Gravity Analog TDS sensor:

This sensor is specially designed to be compatible with arduino for measuring water for drinking, aquaponics and more. it operates between input voltages 3.3v to 5v. So it can be uses with multiple compatible MCU’s available, like Arduino, ESP32, Nodemcu, and more. It outputs an analog voltage from 0 to 2.3v.

As the DC signal can add polarization errors to the value and corrode the probe pins used, this sensor uses an AC signal because of no polarity to get better accuracy and for long term usage of the waterproof TDS Probe. The probe has 2 metallic pins through which the electrical conductivity is calculated.

Technical Specs:

  • Input DC – 3.3 to 5v
  • Output AC  – 0  to 2.3v
  • Current – 3 to 6 mA
  • TDS Measurement Range: 0 ~ 1000ppm
  • TDS Measurement Accuracy: ± 10% F.S. (25 ℃)
  • Module Interface: PH2.0-3P
  • Electrode probe has 2 metal pins.
  • Electrode Interface: XH2.54-2P

Note or warnings:

This electrode probe should be placed in the middle of water placing it near the edges gives wrong values, this probe doesn’t work at temperatures above 55 degree Celsius.

Here we are going to make this project in 3 methods:

  1. Interfacing with only Arduino and 2 Sensors to watch the readings in Serial monitor.
  2. Interfacing with Arduino and 2 sensors with LCD display to watch the readings on 16×2 LCD Display.
  3. Interfacing wirh Arduino and 2 sensors with ESP8266 to watch the readings over wifi with blynk on mobile.

Method1: Results on Serial Monitor

In this method we will interface an Arduino Uno R3 with Gravity TDS sensor and Temperature sensor and monitor the TDS and temperature values on Serial monitor of PC or laptop.

Circuit Diagram:

TDS meter with readings only in serial monitor
Circuit diagram with readings only in serial monitor

This is a very simple circuit among the other two just connect the electrode probe with the sensor chip on one side where the other side has 3 pins where one goes to 5v power, second goes to GND, and third goes to Analog pin on arduino A1. And we connect the temperature sensor to digital pin D7 with the help of a 4.7k ohm resistor.

Working: 

Upload the below code and connect the components as shown above. then put the TDS and Temperature senors inside the water glass whose TDS value is to be checked.  Then open the serial monitor, and you can see the TDS and temperature values. If you don’t want to use temperature sensor you can add the standard temperature value inside code. So, the TDS value is calculated according to the given temperature.

Code:

 

This is the advanced code where the temperature compensation calculations are not to be written in the code as all those complex tasks like calibrating the device with electric conductivity (EC) are already written inside the GravityTDS library.

So the output in the serial monitor looks as below:

TDS meter serial monitor output readingsAlways remember to follow the advice’s provided above to get nearly accurate readings. refer above warnings.

Method 2: Values on LCD Display connected to Arduino

In this method we are just going to add the JHD162A 16X2  LCD Display to the arduino so that the value which where displayed in serial monitor in the previous method are displayed on the LCD Display. So you can make use of the device even with out the PC or laptop.

Working:

Same as the method 1 but Arduino sends the output data to the LCD display. To adjust the contrast of the LCD display you can add a potentiometer of 10k.

Circuit Diagram with LCD Display

tds meter circuit with results on lcd displayIf you face any issue like no display or black display shown in LCD adjust the potentiometer contrast till the text is visible.

Code:

 

Method 3: Interfacing TDS meter with ESP8266 to get results online with blynk

If you want to implement this TDS meter inside any water purifier or any water flow and monitor the values on your mobile real-time wirelessly this method suit you. In this we are going to add the WiFi functionality to the previous method to send the data to blynk server and fetch the data to your mobile.

Here in this method we are using Node MCU as the main board and connecting the Gravity TDS meter and Temperature sensor to it. As NodeMCU has the Inbuilt WiFi ESP8266 we can use this to ease our project where connecting a WiFi module ESP-01 to Arduino is a very hard and tricky task.

Connect the Node MCU to our sensors as shown in the following schematic diagram.

Circuit diagram:

Tds meter interfaced with nodemcu

Connect the above circuit and upload the code into Node MCU.

Before that install all the libraries required

Then upload the below code to the node mcu

Code:

 

If You have any doubt or got any errors please comment below. If you like this project please share it with your friends.

CircuitSchools Staff

We at CircuitSchools publish on basics of electronics and electric components and everything related to evolution of electrical technology with complete analysis of development boards and modules along with latest projects with innovative ideas.

Related Articles

Back to top button