Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help with calibration for 3 sensors #12

Open
ylnest2018 opened this issue Mar 7, 2024 · 0 comments
Open

Help with calibration for 3 sensors #12

ylnest2018 opened this issue Mar 7, 2024 · 0 comments

Comments

@ylnest2018
Copy link

ylnest2018 commented Mar 7, 2024

Hi, I have 3 TDS sensors and have the following code, wondering how I enter calibration function for the other 2 sensors

float temperature = 25;
float tdsValue_SUP = 0;
float tdsValue_PREDI = 0;
float tdsValue_OUT = 0;
float kValue_SUP = 0;
float kValue_PREDI = 0;
float kValue_OUT = 0;

GravityTDS gravityTds_SUP;
GravityTDS gravitytds_PREDI;
GravityTDS gravityTds_OUT;

  gravityTds_SUP.setPin(TDS_SUP_Pin);
  gravityTds_SUP.setAref(5.0);       //reference voltage on ADC, default 5.0V on Arduino UNO
  gravityTds_SUP.setAdcRange(1024);  //1024 for 10bit ADC;4096 for 12bit ADC
  gravityTds_SUP.setKvalueAddress(4); //set the EEPROM address to store the k value,default address:0x08
  gravityTds_SUP.begin();            //initialization
  gravitytds_PREDI.setPin(tds_PREDI_Pin);
  gravitytds_PREDI.setAref(5.0);       //reference voltage on ADC, default 5.0V on Arduino UNO
  gravitytds_PREDI.setAdcRange(1024);  //1024 for 10bit ADC;4096 for 12bit ADC
  gravitytds_PREDI.setKvalueAddress(8); //set the EEPROM address to store the k value,default address:0x08
  gravitytds_PREDI.begin();            //initialization
  gravityTds_OUT.setPin(TDS_OUT_Pin);
  gravityTds_OUT.setAref(5.0);       //reference voltage on ADC, default 5.0V on Arduino UNO
  gravityTds_OUT.setAdcRange(1024);  //1024 for 10bit ADC;4096 for 12bit ADC
  gravityTds_OUT.setKvalueAddress(12); //set the EEPROM address to store the k value,default address:0x08
  gravityTds_OUT.begin();            //initialization


  gravityTds_SUP.setTemperature(temperature);   // set the temperature and execute temperature compensation
  gravityTds_SUP.getKvalue();
  gravityTds_SUP.update();                      //sample and calculate
  tdsValue_SUP = gravityTds_SUP.getTdsValue();  // then get the value

  //Calculate TDS from Output of Membrane
  gravitytds_PREDI.setTemperature(temperature);      // set the temperature and execute temperature compensation
  gravitytds_PREDI.getKvalue();
  gravitytds_PREDI.update();                         //sample and calculate
  tdsValue_PREDI = gravitytds_PREDI.getTdsValue();  // then get the value
  
  //Calculate TDS from Output
  gravityTds_OUT.setTemperature(temperature);   // set the temperature and execute temperature compensation
  gravityTds_OUT.getKvalue();
  gravityTds_OUT.update();                      //sample and calculate
  tdsValue_OUT = gravityTds_OUT.getTdsValue();  // then get the value

If I use ENTER > CAL:

It updates only the GravityTDS gravityTds_SUP

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant