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 ();
}
}
leander07:
lcd.clear();
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;
Hello,
Welcome to the Arduino Forum.
This guide explains how to get the best out of this forum. Please read and follow the instructions below.
Being new here you might think this is having rules for the sake of rules, but that is not the case. If you don’t follow the guidelines all that happens is there is a long exchange of posts while we try to get you to tell us what we need in order to help you, which is frustrating for you and frustrating for us.
The people who try to help with your pro…
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
Thanks.. Tom...
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...
@paulpaulson , Thx it works!!!
@Railroader thx for the correction.
@TomGeorge noted for next, thx for the tips,
system
Closed
January 9, 2022, 10:52am
7
This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.