Tds meter not working

hi, I am using a keyestudio tds meter

#include <EEPROM.h>
#include "GravityTDS.h"
#define TdsSensorPin A1
GravityTDS gravityTds;

float temperature = 25 ,tdsValue = 0;

void setup()
{
Serial.begin(115200);
gravityTds.setPin(TdsSensorPin);
gravityTds.setAref(5.0); //reference voltage on ADC, default 5.0V on Arduino UNO
gravityTds.setAdcRange(1024); //1024 for 10bit ADC;4096 for 12bit ADC
gravityTds.begin(); //initialization
}

void loop()
{
gravityTds.setTemperature(temperature); // set the temperature
gravityTds.update(); //sample and calculate
tdsValue = gravityTds.getTdsValue(); // then get the value
Serial.print(tdsValue,0);
Serial.println("ppm");
delay(1000);
}

I haven't added a temperature compensation yet but still, if I run this code the serial monitor shows "ovf" when submerged.

what could be the problem with this??
please help.

Hi, @anurag_3902
Welcome to the forum.

Please read the post at the start of any forum , entitled "How to use this Forum".

The instructions will show you how to postt your code in a scrolling windows that is more friendly to C++ coding.

Can you please post a link to the tds meter?

Thanks.. Tom.. :grinning: :coffee: :australia:

Hi,
I'm not too sure but floats may need the values assigned to them to be in float format

float temperature = 25.0  ,tdsValue = 0.0;

Tom... :grinning: :+1: :coffee: :australia:

Have you done a calibration? Send ENTER in Serial Monitor to enter calibration mode. Follow the instructions in Serial Monitor.

Exactly. I was just looking at that myself. GravityTDS/GravityTDSExample.ino at master · DFRobot/GravityTDS · GitHub

I'm guessing that is a divide by 0 or similar problem because of the missing calibration.

No, the compiler will figure it out.

Although, I'd recommend only having one variable definition / initialization per line. Avoid the Comma Operator until you know what you're doing. Then, don't use it.

1 Like

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.