Programmed Offset

Hey there. So I’m back revisiting my first arduino project. A thermistor datalogging rig. prompts for filename and all that good stuff. Has a timer. I think for a first arduino project it came out rather well. But some trouble has been found with the thing. Inside of it there are voltage dividers for the thermistor readings, one side has “10kOhms” and the other is the thermistor. I “” the 10K because its gotten y 2 10k resistors in parallel going into a 10K pot placed there so that the unit could be calibrated a bit if any large error were to show up because of the resistors.

Now its worked well, just its a bit annoying having to open up the unit from time to time to adjust a trimpot.

What im wondering. So heres the math that came with the thermistors we’re using. Turned into code.

        test = analogRead(therm);       // read the analog pin and put its value into test
        voltage = test * 0.0048828;      // convert the number into a voltage
        Rtherm = (voltage * 10000) / (5 - voltage);       // convert that into a resistance
        ratio = Rtherm/R25;                              // find the ratio of resistance to R25
        test = voltage;                               // put voltage into the test variable for storage
        Serial.print("   ");
        if (ratio > 3.27700)        // Checks Rt/R25 relative to 0C set point                     
          check = 1;  // error
        // If temp is between 0 and 50 degrees C, use these vars for temp calc
        else if (ratio >= 0.359900)   // Checks Rt/R25 relative to 50C set point
          a = 0.0033540170;
          b = 0.00025617244;
          c = 0.0000021400943;
          d = -0.000000072405219;
          check = 0;
        //if temp between 50 and 100C use these for temp calc
        else if (ratio >= 0.068160)   // Checks Rt/R25 relative to 100C set point
          a = 0.0033530481;
          b = 0.00025420230;
          c = 0.0000011431163;
          d = -0.000000069383563;
          check = 0; 
        // if temp 100-150c use these
        else if (ratio >= 0.018730)   // Checks Rt/R25 relative to 150C set point
          a = 0.0033536166;
          b = 0.00025377200;
          c = 0.00000085433271;
          d = -0.000000087912262;
          check = 0; 
        // if temp too high, flash screen red
        else if( ratio < 0.018730)
          check = 1; //error
        //if everything OK and its not out of range, go calculate the temp
        if (check == 0) //if everything is fine
          lnRatio = log(ratio);    // take the log of ratio and put it into the lnratio
          K = 1 / (a  + (b * lnRatio) + (c * pow(lnRatio, 2)) + (d * pow(lnRatio, 3)));   // calculate thermistor temp in K
          C = K - 273.15;     // convert the K into degrees C
          F = (K * 9/5) - 459.67;        // disregard what we just did and go straight from Kelvin to Rankine to Fahrenheit
          temp = F;               // put degrees Fahrenheit into temp

Now the only thing we’re actually modding with the trimpots is the voltage incoming to the arduino. So would it be practical to store on the arduino (or the microSD for the datalogging) a set of user input offsets for the incoming voltage, that way one doesn’t have to break the box open all the time whenever somethign gets a little off.

Another thing I was thinking. perhaps have another thermistor built in permanently, that has a precisely known resistance value for its voltage divider. Thus for its measurement I could put in 1 offset for it. Then at the start of the program. it would referance all of the other thermistors against the calibration one. Then do some math until all of the therms are are the same reading, then prompt the user to finish setup.

I dunno, not really a necessary for the project thing to do. But figured it might be nice as a next stage of the project. If anyone can suggest another way to calibrate the thermistors without having to manually do it, it would be appreciated.

Rather than endeavouring to apply software fixes to what must be a physical problem, why not try and cure the basic problem at source.

I presume you are using "normal" resistors which are not really suitable for precision measurement. Typically they probably have a 20% tolerance and similar thermal instability.

Resistance values can change for a number of reasons, but the one giving you most grief is probably change due to thermal effects. These can be caused by changes in ambient temperature and self-heating. Obviously tolerance can be compensated by use of a trimmer pot but not thermal instability.

With an increase in measured temperature, the RTD value drops resulting in the current in the voltage divider increasing; this in turn increases the heat generated within the 10k resistors which increases their value and so acts as a negative compensation to the measured temperature.

I'd suggest trying precision resistors, with a nominal 0.1% tolerance and thermal stability.

The attached link is an example