temperature sensor

Discussion in 'Embedded Systems and Microcontrollers' started by pinkscorpio, Jul 7, 2008.

  1. pinkscorpio

    Thread Starter New Member

    May 28, 2008
    8
    0
    Hi,

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

    Active Member

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

    Thread Starter New Member

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

    Active Member

    Apr 29, 2008
    149
    0
    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.
     
  5. mik3

    Senior Member

    Feb 4, 2008
    4,846
    63
    You have to amplify the output signal of the thermocouple before read it with the PIC ADC.

    What do you mean by lookup table?
     
  6. thingmaker3

    Retired Moderator

    May 16, 2005
    5,072
    6
  7. pinkscorpio

    Thread Starter New Member

    May 28, 2008
    8
    0
    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.
    [​IMG]
     
  8. roddefig

    Active Member

    Apr 29, 2008
    149
    0
    Do you know the equation to take the voltage to a temperature? That's the first piece of information you need.
     
  9. pinkscorpio

    Thread Starter New Member

    May 28, 2008
    8
    0
  10. roddefig

    Active Member

    Apr 29, 2008
    149
    0
    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.
     
  11. pinkscorpio

    Thread Starter New Member

    May 28, 2008
    8
    0
    hey, thanks for your help:)
     
  12. Arm_n_Legs

    Active Member

    Mar 7, 2007
    183
    10
    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);
    }
     
  13. MrChips

    Moderator

    Oct 2, 2009
    12,440
    3,361
    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.
     
Loading...