Arduino Forum

Products => Arduino Yún => Topic started by: pothina_bala on Jul 01, 2015, 03:12 pm

Title: TDS/EC sensor interfacing with arduino
Post by: pothina_bala on Jul 01, 2015, 03:12 pm
Hello,

When I am Interfacing TDS/EC Sensor to Arduino ,I am getting some TDS value.

But When compare to arduino TDS values and TDS Meter values ,both are not matching

Here the my code and Circuit diagram of TDS sensor is:




/*
 Water Conductivity Monitor
 Sketch for an Arduino gadget that measures the electrical
 conductivity of water.
*/
const float ArduinoVoltage = 5.00; // CHANGE THIS FOR 3.3v Arduinos
const float ArduinoResolution = ArduinoVoltage / 1024;
const float resistorValue = 10000.0;
int threshold = 3;
int inputPin = A0;
int ouputPin = A5;
float temp;
int tempPin=A2;
void setup()
{
 Serial.begin(9600);
 pinMode(ouputPin, OUTPUT);
 pinMode(inputPin, INPUT);
 pinMode(tempPin,INPUT);
}
void loop()
{
 int analogValue=0;
 int oldAnalogValue=1000;
 float returnVoltage=0.0;
 float resistance=0.0;
 double Siemens;
 float TDS=0.0;
 temp=analogRead(tempPin);
 temp=temp*0.48828125;
 Serial.print("Temperature:");
 Serial.print(temp);
 Serial.print("'C");
 Serial.println();
 delay(500);
 while(((oldAnalogValue-analogValue)>threshold) || (oldAnalogValue<50))
 {
 oldAnalogValue = analogValue;
 digitalWrite( ouputPin, HIGH );
 delay(10); // allow ringing to stop
 analogValue = analogRead( inputPin );
 digitalWrite( ouputPin, LOW );
 }
 Serial.print("Return voltage = ");
 returnVoltage = analogValue *ArduinoResolution;
 Serial.print(returnVoltage);

 Serial.println(" volts");
 Serial.print("That works out to a resistance of ");
 resistance = ((5.00 * resistorValue) / returnVoltage) - resistorValue;
 Serial.print(resistance);
 Serial.println(" Ohms.");
 Serial.print("Which works out to a conductivity of ");
 Siemens = 1.0/(resistance/1000000);
 if(150<=Siemens & Siemens<=800)
 Siemens=Siemens+120;
 else if(801<=Siemens |  Siemens>=1900)
 Siemens=Siemens+300;
 Serial.print(Siemens);
 Serial.println(" microSiemens.");
 Serial.print("Total Dissolved Solids are on the order of ");
 TDS = 500 * (Siemens/1000);
 Serial.print(TDS);
 Serial.println(" PPM.");
 if (returnVoltage>4.9) Serial.println("Are you sure this isn't metal?");
 delay(2000);
 Serial.println("");
}



and above test results are:

                   Arduino Serial monitor          TDS Meter

Test-1                 330                                   320
Test-2                 420                                   408 
Test-3                 550                                   700
Test-4                 1200                                  1550
Test-5                 1300                                  1720



How to calibrate TDS/EC Sensor Exactely like tds sensor.
Title: Re: TDS/EC sensor interfacing with arduino
Post by: pothina_bala on Jul 02, 2015, 06:40 am
Above all Test Results in microSiemens.........
Title: Re: TDS/EC sensor interfacing with arduino
Post by: jessemonroy650 on Jul 03, 2015, 07:51 am
@pothina_bala,
when posting code, please use markup. See attached image.
TIA
Jesse
Title: Re: TDS/EC sensor interfacing with arduino
Post by: mihir_chate on Sep 30, 2015, 12:00 pm
can you explain the following statements in the code
 while(((oldAnalogValue-analogValue)>threshold) || (oldAnalogValue<50))
and also
 if(150<=Siemens & Siemens<=800)
 Siemens=Siemens+120;
 else if(801<=Siemens |  Siemens>=1900)
 Siemens=Siemens+300;
Title: Re: TDS/EC sensor interfacing with arduino
Post by: sonnyyu on Sep 30, 2015, 03:27 pm
Hello,

When I am Interfacing TDS/EC Sensor to Arduino ,I am getting some TDS value.

But When compare to arduino TDS values and TDS Meter values ,both are not matching
...
Code: [Select]
const float ArduinoVoltage = 5.00; // CHANGE THIS FOR 3.3v Arduinos

Unless you have latest version Yun Release 5, not matching is normal.

Arduino Yun 5v pin/USB port doesnt provide 5 volt.

http://forum.arduino.cc/index.php?topic=209836.msg1542386#msg1542386 (http://forum.arduino.cc/index.php?topic=209836.msg1542386#msg1542386)

4.48 volt at 5v pin will cause some shield fail, and low voltage at USB port cause a lot of USB device fail.

Arduino Yun release 5 is fixed 5v pin/USB port problem, provide exactly 5 volt which I saw the demo at maker faire nyc yesterday.
Title: Re: TDS/EC sensor interfacing with arduino
Post by: sonnyyu on Sep 30, 2015, 03:37 pm
can you explain the following statements in the code
 while(((oldAnalogValue-analogValue)>threshold) || (oldAnalogValue<50))
and also
 if(150<=Siemens & Siemens<=800)
 Siemens=Siemens+120;
 else if(801<=Siemens |  Siemens>=1900)
 Siemens=Siemens+300;
Code: [Select]
while(((oldAnalogValue-analogValue)>threshold) || (oldAnalogValue<50))

Keep mesure until both "threshold of this mesure  and last mesure <= 3" Or "oldAnalogValue<50" meet.

Code: [Select]
if(150<=Siemens & Siemens<=800)
 Siemens=Siemens+120;
 else if(801<=Siemens ||  Siemens>=1900)
 Siemens=Siemens+300;


for calibrate  Siemens value here using an other conductivity meter.

https://github.com/ejgertz/EMWA/blob/master/chapter-5/WaterConductivity (https://github.com/ejgertz/EMWA/blob/master/chapter-5/WaterConductivity)

Environmental Monitoring with Arduino (http://www.amazon.com/Environmental-Monitoring-Arduino-Building-Devices/dp/1449310567/)

Use Yún Release 5 please.


Title: Re: TDS/EC sensor interfacing with arduino
Post by: HeySammy on Mar 29, 2017, 06:00 pm
Can you please mention the link from where you have bought TDS sensor?
Title: Re: TDS/EC sensor interfacing with arduino
Post by: im_anithp on Aug 09, 2017, 01:19 pm
Can i get the sensor name?
Actually i require for making one of my project, it will be great help! :)
Title: Re: TDS/EC sensor interfacing with arduino
Post by: Pham on Oct 26, 2017, 07:36 am
Can you tell me where the TDS sensor is purchased
Title: Re: TDS/EC sensor interfacing with arduino
Post by: sonnyyu on Nov 02, 2017, 11:50 pm
https://www.amazon.com/Liquid-PH0-14-Sensor-Electrode-Arduino/dp/B01LWLHPRR (https://www.amazon.com/Liquid-PH0-14-Sensor-Electrode-Arduino/dp/B01LWLHPRR)



Title: Re: TDS/EC sensor interfacing with arduino
Post by: internetmonster on Nov 26, 2017, 09:34 pm
Code: [Select]
while(((oldAnalogValue-analogValue)>threshold) || (oldAnalogValue<50))

Keep mesure until both "threshold of this mesure  and last mesure <= 3" Or "oldAnalogValue<50" meet.

Code: [Select]
if(150<=Siemens & Siemens<=800)
 Siemens=Siemens+120;
 else if(801<=Siemens ||  Siemens>=1900)
 Siemens=Siemens+300;


for calibrate  Siemens value here using an other conductivity meter.

https://github.com/ejgertz/EMWA/blob/master/chapter-5/WaterConductivity (https://github.com/ejgertz/EMWA/blob/master/chapter-5/WaterConductivity)

Environmental Monitoring with Arduino (http://www.amazon.com/Environmental-Monitoring-Arduino-Building-Devices/dp/1449310567/)

Use Yún Release 5 please.



https://github.com/ejgertz/EMWA/blob/master/chapter-5/WaterConductivity
can you please share the sensor as well? for this same code? i want to make a water conductivity controller via arduino all i need is a code with water conductivity sensor.
Title: Re: TDS/EC sensor interfacing with arduino
Post by: lori_carmrs on Jul 31, 2019, 10:32 am
I had a similar requirement and if anyone is still looking for a TDS meter, I used this TDS meter that can be interfaced directly with arduino over here (https://www.ebay.com/itm/254255270042 (https://www.ebay.com/itm/254255270042)). Works quite well.
Title: Re: TDS/EC sensor interfacing with arduino
Post by: jerryadam on Jun 17, 2020, 08:43 am
Which sensor was used in in your project, Can you please specify can i connect to using the ESP8266 to utilize the wifi functionality, I found an article here https://www.circuitschools.com/tds-meter-with-tds-sensor-and-arduino-for-water-quality-monitoring/ (https://www.circuitschools.com/tds-meter-with-tds-sensor-and-arduino-for-water-quality-monitoring/) where they added nodemcu but im not able to find the sensor they used. Could someone get a link for the sensor.