PPM Sensor result on LCD blinking

Hai, im trying to Use Ec/Tds Sensor probe , with 0-5V , Max 2000PPM, RS485 https://id.aliexpress.com/item/32953353638.html , before calibrate and after calibrate the Volt and PPm result on LCD is blinking fast, is someone know why?
below the code,

#include <LCD_I2C.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#define tds A1
LiquidCrystal_I2C lcd(0x27,20,4);

unsigned long lastTime = 0;
unsigned long timerDelay = 1000;

void setup()
{
lcd.init();
}

void loop()
{
lcd.backlight();
lcd.clear();
lcd.setCursor(5,0);
lcd.print("A1");
lcd.setCursor(0,3);
lcd.print("A3");

if ((millis () - lastTime ) > timerDelay) {

float voltageTds = analogRead(tds) * (float)5 / 1024;
float tdsValue = 2000 / 5 * voltageTds ;

lcd.setCursor(7,1);
lcd.print(" ");
lcd.setCursor(7,2);
lcd.print(" ");

lcd.setCursor(0,1);
lcd.print("Volt ; ");
lcd.print(voltageTds,2);

lcd.setCursor(0,2);
lcd.print("PPM ; ");
lcd.print(tdsValue,0);
daelay
lastTime = millis ();
}
}

You have a.m. instruction inside the loop().

Hi, @leander07
Can you post your code in tags please?
To add code please click this link;

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks.. Tom... :smiley: :+1: :coffee: :australia:

That code does not compile. Error at code "daelay" down near the end. Probably some mistake there.

Hi, @leander07

float voltageTds = analogRead(tds) * (float)5 / 1024;
float tdsValue = 2000 / 5 * voltageTds ;

Would be better

float voltageTds = analogRead(tds) * 5.0 / 1024.0;
float tdsValue = 2000.0 * voltageTds  / 5.0;

Tom... :smiley: :+1: :coffee: :australia:

@paulpaulson , Thx it works!!!
@Railroader thx for the correction.
@TomGeorge noted for next, thx for the tips,

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