Introduction
However, the emphasis of this paper is on having to continuously assess water quality to provide good-quality drinking water. The aforesaid condition is total dissolved salts or TDS reflecting the concentration of salts and very small portions of organic matter in water. High TDS is not suitable for drinking and other uses. Manual assessment of TDS using equipment available in laboratories is tiresome, time-consuming, and needs technical skills. The following project is on a basic approach with low cost in the measurement of TDS using an Arduino UNO microcontroller board.
Methodology
The project measures the electrical conductivity (EC) of water samples using probe sensors connected to an Arduino. EC is directly proportional to TDS – the higher the salts dissolved, the higher the EC. An empirical equation relates EC in decisions per meter (dS/m) to TDS in parts per million (ppm). The Arduino codes the EC readings, calculates the TDS using the equation, and displays the result on an LCD screen.
Block Diagram and Key Components
A block diagram represents the most important parts of the creation: the Arduino UNO microcontroller, probe sensors to measure the EC, LCD, and cables. The Arduino UNO is an open-source versatile board that is used in developing simple electronics projects. This has I/O pins that connect with sensors, displays, motors, etc using a simple code input and output.
Working Principle
Two probe sensors made of stainless steel are dipped in the water sample. A fixed alternating voltage is applied across the probes through an AC excitation circuit in the Arduino. The probes act as electrodes – the more dissolved ions, the higher the conductivity through the water. The Arduino measures the AC current via the probes, relating it to EC in milliSiemens. It then calculates TDS in ppm using the formula: TDS = EC x 640. The result is displayed continuously on the LCD screen.
Components in Detail
Arduino UNO:
- Microcontroller chip ATmega328 with 32KB flash memory and 2KB SRAM
- Clock speed 16MHz
- 14 digital I/O pins, 6 analog pins
- Powered via USB or external power supply
- Open-source IDE for simple programming
Probe Sensors:
- Made of stainless steel for stability and accuracy
- Fixed distance between probes maintained
- Must be thoroughly cleaned and calibrated periodically
LCD Display:
- 16×2 character LCD with blue backlight
- Requires 4 data lines, 3 control lines interfaced to Arduino
- Displays TDS results and other messages clearly
Advantages and Uses
- Provides fast, inexpensive TDS measurement without laboratory equipment
- Easy to operate – just dip probes and read the result
- Helps test water quality at source for drinking or irrigation purposes
- Can monitor treatment plant processes and detect contamination
- Suitable for schools, communities, and industries with basic electrical skills
Programming and Testing Procedure
Detailed steps are provided to interface components, upload the Arduino sketch code, and test the prototype:
- Connect probe sensors to Arduino analog pins
- Interface LCD to Arduino via control/data lines
- Power Arduino board via USB or external supply
- Upload code written in Arduino IDE
- Dip probes in a sample and start reading after 10 seconds
- Record TDS displayed on LCD for different water types
- Clean probes between tests for accurate measurements
Sample Arduino Code Explained
The code contains functions to initialize components, read EC analog values, compute TDS equation, and display on LCD. Key points:
- void setup() function runs once at start-up to configure pins
- void loop() function runs continuously to measure and display
- Analog readings are converted to EC values using a voltage reference
- TDS is calculated using the given formula and printed on an LCD
- Programming structure and syntax follow C/C++ conventions
Results and Observations
Different water samples tested ranged from tap water to dissolved salt solutions. Readings were stable and consistent on repeating tests. Tap water showed around 200-300 ppm TDS as per regulations. Higher TDS of over 1500 ppm was seen for salt solutions, validating the principle. Minor variations may occur due to probe cleanliness or water temperature changes affecting conductivity slightly. Overall, the prototype gave reasonable results comparable to commercial TDS meters.
Code:
We are still working on this code. Stay tuned to receive automatic updates from our server…!
#include <LiquidCrystal.h> int rs=2,en=3,d4=4,d5=5,d6=6,d7=7; LiquidCrystal lcd(rs,en,d4,d5,d6,d7); // User Defined Variables int R1= 1000; int Ra=25; //Resistance of powering Pins int ECPin = A0; int ECGround = A1; int ECPower = A4; // Converting to ppm [Learn to use EC it is much better // Hana [USA] PPMconverion: 0.5 // Eutech [EU] PPMconversion: 0.64 // Tranchen [Australia] PPMconversion: 0.7 float PPMconversion=0.64; // Cell Constant For Ec Measurements float K=2.9; // Temp Probe Related // #define ONE_WIRE_BUS 10 // Data wire For Temp Probe is plugged into pin 10 on the Arduino // const int TempProbePossitive =8; //Temp Probe power connected to pin 9 // const int TempProbeNegative=9; //Temp Probe Negative connected to pin 8 // END Of Recomended User Inputs float EC=0; float EC25 =0; int ppm =0; float raw= 0; float Vin= 5; float Vdrop= 0; float Rc= 0; float buffer=0; // Setup - runs Once and sets pins etc void setup() { lcd.begin(16,2); lcd.clear(); // clears previous message on the display delay(2000); pinMode(ECPin,INPUT); pinMode(ECPower,OUTPUT);//Setting pin for sourcing current pinMode(ECGround,OUTPUT);//setting pin for sinking current digitalWrite(ECGround,LOW);//We can leave the ground connected permanantly delay(100); // Adding Digital Pin Resistance to [25 ohm] to the static Resistor R1=(R1+Ra);// Taking into acount Powering Pin Resitance } void loop() { GetEC(); //Calls Code to Go into GetEC() Loop [Below Main Loop] // dont call this more that 1/5 hhz [once every five seconds] // or you will polarise the water PrintReadings(); // Cals Print routine [below main loop] delay(5000); }
Conclusion
This low-cost Arduino-based TDS meter provides a viable solution for measuring water quality parameters easily. With some code refinements and automated logging, it can serve as a basic water monitoring system. The open hardware and software nature also allows modifications as per specific application needs. Further developments may include integrated data storage, wireless data transfer, and smartphone control for remote community monitoring of water resources. Overall, the project demonstrates an effective Internet of Things (IoT) approach for environmental monitoring and management.
For further details or future updates on this project visit: Low-Cost Arduino-Based TDS Meter for Water Quality Monitoring