# Thermistor calibration

Is there a way to adjust the calibration of a thermocouple sensor? My readings have a slope of about 4% too low with an offset about 3.6°C low: At a hotend body temperature of 100° Repetier reports 92.3°C and at 220°C Repetier reports 207.8°C
Specifics are: RAMPS/Mega2560, Two hotends with type K thermocouples and Adafruit AD8495 thermocouple conditioners, Repetier Firmware 0.92.9

Thanks for any help or advice you can give,

Mike

• For thermocouples it is in extruder.cpp line 2555
case 60: // AD8495 (Delivers 5mV/degC vs the AD595's 10mV)
#if CPU_ARCH == ARCH_AVR
currentTemperatureC = ((float)currentTemperature * 1000.0f / (1024 << (2 - ANALOG_REDUCE_BITS)));
currentTemperatureC = ((float)currentTemperature * 660.0f / (1024 << (2 - ANALOG_REDUCE_BITS)));
break;
case 61: // AD8495 1.25V Vref offset (like Adafruit 8495 breakout board)
#if CPU_ARCH == ARCH_AVR
currentTemperatureC = ((float)currentTemperature * 1000.0f / (1024 << (2 - ANALOG_REDUCE_BITS))) - 250.0f;
currentTemperatureC = ((float)currentTemperature * 660.0f / (1024 << (2 - ANALOG_REDUCE_BITS))) - 250.0f;
break;

You see here is no correction. It is just conversion of voltage to a linear equation from the sensor type.

But that would be the place where you can modify currentTemperatureC with some equation after computation. Then the corrected temperature would be used instead.
• Thank you Repetier.
I have now checked out the second hot-end/thermocouple/AD8495 plus a spare and I get a bit of a scatter from 4% low to 1% high on slope though somewhat more consistent on offset. This seems to be within the believable sum of errors for the class 2 thermocouple, Adafruit conditioning board, and Mega2560 voltage reference.
I think the best answer is to go old school and build replacement conditioning boards with slope and offset trimmers.

Mike
• I forget one option. You can add gain/bias support to calibrate it. Requires latest dev version as I just fixed a bug there. Then you mod temperature like
newTemp = bias + oldTemp*gain

Default is bias 0 and gain 1.
You need to have TEMP_GAIN 1 defined in configuration for this.
• Thank you Repetier, that now works better than I could have hoped. Adjusting the gain and bias through the EEPROM I was able to set up within minutes and it now is within 1 degree from 150 degrees to 250 degrees on both hotends.

Mike