Problem in measure temperature by thermocouple

Hello, I am having some trouble measuring temperature with a type K thermocouple. I am using resistors to create a gain of 100 and an LM324 amplifier IC to amplify the thermocouple's signal so that it can be read by an Arduino. However, when I run the code, the temperature value is almost always zero, occasionally jumping to 30, etc. I am not sure how to fix this; please help me.


//Potentiometer is connected at analog pin 0:
int analogPin = A0;
int val = 0;
//variable to store the value read
void setup () 
{
 Serial.begin (9600);
//Setup serial
}

void loop () 
{
    val = analogRead (analogPin);
    //Used to read the input pin
    float voltage = val/1023.0*5.0;
    float temp = voltage/0.00041;
     Serial.println(temp);
     delay(1000);
}

To measure temperatures with a thermocouple, you need a reference junction, which in your circuit is not well defined by the connections to the input resistors. Are all connections carefully soldered?

I recommend using a thermocouple amplifier module, which takes care of the reference junction problem automatically.

See this guide to thermocouple measurements, which discusses the reference junction:

2 Likes

I'm NOT a thermocouple expert but I know they are tricky-finicky...

It's probably better to buy a pre-made thermocouple board. Or, if you're not dealing with high temperatures there are lots of semiconductor temperature sensors that are easier to use and in the real world, usually more accurate and reliable. (If you are trying to measure the temperature in an oven or kiln, or the temperature of a flame, a thermocouple is probably your best option. Oh... There are also thermistors which can be easier than thermocouples.

Thermocouple voltages are tiny and temperature changes make even tinier voltage changes. That means you need a high gain, low-noise, low-drift "instrumentation amplifier". That's not an easy thing to build and the LM324 probably won't cut it.

"Traditionally", thermocouples needed a 2nd "cold reference", usually an ice-water bath which is reliably zero degrees C. But special thermocouple chips have a built-in reference/compensation circuit so you don't need that.

Using your formula, each ADC count is about 12 degrees and that's the best resolution you can get. But, if the voltage into the Arduino is less than 1V at the maximum temperature, you can use the optional 1.1V reference for about 5 times the resolution (about 2 degrees if your formula is correct.) But that doesn't account for any other resolution limits, noise, or drift.

2 Likes

I would heed what Jremington has covered. Just for starters your circuit shows no CJC (Cold Junction Compensation) and also note what DVDdoug has covered as to resolution.

I would just take a simple inexpensive approach. I would just go with one of these MAX6675 Module,Aideepen DC 3-5V MAX6675 k thermocouple sensors Type K SPI Interface.

Keep in mind also that sans a calibration a standard Type K thermocouple is +/- 2.0 Degrees F on a good day. Designing an actual TC amplifier takes considerable skill. These modules make for easy, inexpensive and convenient. They come in several flavors so make sure you get what you want/need. Here is an example of using one such module with an Arduino.

Ron

2 Likes

In this project, we are only allowed to use Opamps. I currently have an AD620, but I don't know how to wire it with the thermocouple to measure the signal. Do you have a solution to help me?

Consult the AD620 data sheet for wiring diagrams. Note that the AD620 is not "an Opamp", it is an instrumentation amplifier.

The device data sheet should always be your first and best source of information. The TI thermocouple application note linked above is also very useful.

I followed the AD620 datasheet and found that when I want Vout max = 5V, my Gain should be 90.91 (Vin max of the K thermocouple is 55mV), so I determined that the gain resistor for the circuit should be approximately 560K Ohms. However, when I run the simulation on Proteus, my Vout is not amplified.
1HV526T4F_6751LC
1HV52EH24_6751LC
1HV52F0JA_6751LC

Hello, I have solved the signal amplification problem for the AD620, but when I use Arduino to read the output signal of the AD620 and convert it into temperature according to the code below, I find that the read values are deviated from the actual values (specifically, they are lower than the actual values). Moreover, the higher the temperature, the greater the deviation, but I don't know how to compensate for this temperature discrepancy. Please help me.


// Potentiometer is connected at analog pin 0:
int analogPin = A0;
int currentVal = 0;
int previousVal = 0;

void setup() 
{
    Serial.begin(9600); // Setup serial
}

void loop() 
{
    previousVal = currentVal; // Lưu giá trị analog trước đó
    currentVal = analogRead(analogPin); // Đọc giá trị analog hiện tại
    
    float voltage = currentVal / 1023.0 * 5.0;
    float temp = voltage / 0.0041;

    
    Serial.print("Analog value: ");
    Serial.println(currentVal);
    Serial.print("Voltage: ");
    Serial.println(voltage);
    Serial.print("Temperature: ");
    Serial.println(temp);

    
    delay(1000);
}

Unless you give us figures we cant be much help.

You MUST expect an offset as you are not allowing for the "cold junction" which effectively will be ambient temperature.

Also where did you get the magic numbers? Good practise is to define them so we know what they represent.

int range = 1024; // number of "bins" for a 10 bit ADC
float reference = 5.0; //volts  - but its it actually 5.0V?  makes more sense to work in mV
float tJcold = 20.0 ; // ambient temperature 
float sTherm = 0.00041; //  4.096mV for 100C
 float voltage = currentVal / 1023.0 * 5.0; //???
    float temp = voltage / 0.0041;

For a type-K thermocouple, the
voltage changes by 41µV/°C, which approximates the
thermocouple characteristic with the following linear equation:
1HV6MICCN_6751LC

int analogPin = A0;
int currentVal = 0;
int previousVal = 0;

void setup() 
{
    Serial.begin(9600); // Setup serial
}

void loop() 
{
    previousVal = currentVal; // Lưu giá trị analog trước đó
    currentVal = analogRead(analogPin); // Đọc giá trị analog hiện tại
    
    float voltage = currentVal / 1023.0 * 5.0;
    float temp = voltage / 0.003727; //0.0041 = 41uV * 90.91 (90.91 is the gain)

    
    Serial.print("Analog value: ");
    Serial.println(currentVal);
    Serial.print("Voltage: ");
    Serial.println(voltage);
    Serial.print("Temperature: ");
    Serial.println(temp);

    
    delay(1000);
}

you seem to have a few wires missing. An electrical signal (a voltage) needs to have two wires so you can see the "potential difference".

SO you need to have a connection to the "protuino" ground.

Do you have a physical circuit or is it all just simulated?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.