temperature sensor

Thread Starter

pinkscorpio

Joined May 28, 2008
8
Hi,

im interfacing a temperature sensor to a microcontroller. How should i go about in inserting a lookup table to this program?
 

roddefig

Joined Apr 29, 2008
149
Hello. More detail, please. Specifically, what microcontroller, what temperature sensor, and how do you have them hooked up?
 

Thread Starter

pinkscorpio

Joined May 28, 2008
8
Im using a pic18f2620 microcontroller and a type j thermocouple. We have connected the thermocouple in way that it can monitor the room temperature.
 

roddefig

Joined Apr 29, 2008
149
Is the thermocouple connected to the ADC input? You'll have to forgive me because I've never used a thermocouple before, but reading the Wikipedia article it looks like the manufacturer should specify the coefficients to a polynomial which you then use to determine the temperature difference.

If you wanted to do a LUT I would calculate temperature differences for a set of voltages and then store these in memory. To actually implement the table, store the values in memory and then use the voltage to calculate the appropriate address and then retrieve the temperature difference. I can't get more specific than that because I have never used PICs before, but that is how I implement LUTs in other processors using assembly.
 

mik3

Joined Feb 4, 2008
4,843
Hi,

im interfacing a temperature sensor to a microcontroller. How should i go about in inserting a lookup table to this program?
You have to amplify the output signal of the thermocouple before read it with the PIC ADC.

What do you mean by lookup table?
 

Thread Starter

pinkscorpio

Joined May 28, 2008
8
Actually I want to know how to implement a lookup table for a thermocouple. Ive already connected the thermocouple to the adc. I then converted the adc values to voltage. Now i need to know how to implement the lookup table in the code so that the program can convert the voltage to the corresponding temperature.
 

roddefig

Joined Apr 29, 2008
149
I can't tell you how to do it exactly with PIC code. But I can give you the general idea.

You need to store the temperature values in memory. Then you need to come up with a method to convert the voltages to addresses.
 

Arm_n_Legs

Joined Mar 7, 2007
186
Deriving the equation:

I have a temperature sensor LM35 (gives 10mV per C) feeding into a 8-bit ADC with a Vreference of 5V.

Means.....
0C = 0V = 0000 0000 (converted digital value)
500C = 5V = 1111 1111 (converted digital value)

Take 500/255 = 1.96 (approximate to 2)

Means.. 1 unit of the converted value represent 2C.

unsigned char temperatureTranslate(unsigned char adcValue)
// 1 ADC unit = 0.0196V = 2C
{
return(adcValue * 2);
}
 

MrChips

Joined Oct 2, 2009
30,824
If you can measure the cold junction temperature with a thermistor, why not skip the thermocouple and measure your temperature with the thermistor in the first place.
 
Top