Schm1tz1/ESPressIoT

Add a support of PT100RTD sensors and Adafruit MAX31865

ZH-A opened this issue · 3 comments

ZH-A commented

Trying to figure out how to set up the PT100 RTD sensor and Adafruit MAX31865.

Please have a look at espressiot/sensor_tsic.ino and espressiot/simulation.ino. You need to provide the functions setupSensor (to initialize), updateTempSensor (perform reading) and getTemp (conversion and return of measurement). Currently I am switching via #defines which is not optimal. I have started a more object-oriented approach with an interface in the Platformio-branch, but unfortunately this is not completely finished and tested. Any help is very welcome if you'd like to contribute.

ZH-A commented

Thanks for the answer, I see what I can do.

Tell me please what these variables mean
float lastT = 0.0;
float SumT = 0.0;
int CntT = 0;

and what happens in this functions:
void updateTempSensor() {
if (abs(millis() - lastSensTime) >= TSIC_SMP_TIME) {
if(TSens1.getTemperature(&raw_temp)) {
float curT = TSens1.calc_Celsius(&raw_temp);

  // very simple selection of noise hits/invalid values 
  if(abs(curT-lastT)<1.0 || lastT<1) {
    SumT+=curT;
    CntT++;        
  }     
  lastSensTime=millis();
}

}
}

float getTemp() {
float retVal=gInputTemp;

if(CntT>=1) {
retVal=(SumT/CntT);
SumT=0.;
CntT=0;
}

return retVal;
}

I'm new to programming and still learning and I still don't understand some points

Is this issue still open? Please have a look at the sensor-code at https://github.com/zcmack/ESPressIoT - this should solve it. Will be merged into master very soon.