Thermocouple Equation
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Thermocouple Equation

by bigginsking on Mon Jul 17, 2017 1:41 am


I've got two of the " Analog Output K-Type Thermocouple Amplifier - AD8495" boards and I've been doing some testing with boiling water, ice and room temperature.

When I use the suggested equation I get about 10 C lower than expected at room temp and boiling and around 6.5 C lower than expected in ice water.

I'm not 100% sure what the right equation is but it is something closer to (Vout-1.2)/0.005

Code I'm using is here:
Code: Select all | TOGGLE FULL SIZE
unsigned long  timer;
  unsigned long printinterval = 1000000;
    unsigned long printtime = 100000;
    float temp1;
    float temp2;
  float sensorValue1;
  float sensorValue2;

      int cyclepin=4;
// the setup routine runs once when you press reset:
void setup() {

  pinMode(cyclepin, OUTPUT);
  // initialize serial communication at 9600 bits per second:
      temp1 = 0 ;
      temp2 = 0 ;
     timer = micros();   
// the loop routine runs over and over again forever:
void loop() {
     timer = micros();
  // read the input on analog pin 0:
   sensorValue1 = analogRead(A0)*0.01+sensorValue1*0.99; // this does some averaging between analog reads to try to cancel out noise
   sensorValue2 = analogRead(A1)*0.01+sensorValue2*0.99;
PORTD^= B00010000; 

if (timer > printtime)
    temp1 = ((5*sensorValue1/1024)-1.2)/0.005; // the equation in question, I think that the value subtracted from the voltage should be 1.2 rather than 1.25.
    temp2 = ((5*sensorValue2/1024)-1.2)/0.005;
  // print out the value you read:
  Serial.print(" ");
  printtime = printtime+printinterval;

Posts: 1
Joined: Mon Jul 17, 2017 1:32 am

Re: Thermocouple Equation

by adafruit_support_bill on Mon Jul 17, 2017 10:33 am

No sensor is perfect. Virtually all sensors require calibration for accurate results.

With analog sensors you also have the added variability of your ADC to account for. As long as the response is linear, the most straightforward approach is to use the formula shown here:
https://learn.adafruit.com/calibrating- ... alibration

Posts: 61671
Joined: Sat Feb 07, 2009 10:11 am

Please be positive and constructive with your questions and comments.