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

Multiple TDS Sensors #7

Open
LucaP88 opened this issue Feb 12, 2021 · 1 comment
Open

Multiple TDS Sensors #7

LucaP88 opened this issue Feb 12, 2021 · 1 comment

Comments

@LucaP88
Copy link

LucaP88 commented Feb 12, 2021

Hi there, it's possible add 2/3/4 sensor in the same controller? How can i manage them? Many thanks :)

@ylnest2018
Copy link

its 3 years late but I finally figured it out myself

Seems you need to define them up above and then reference them separately, I'm still yet to understand how to calibrate the 3 sensors independently though, if you have since figured it out please share

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

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

2 participants