Jump to content
43oh

accuracy of the 2553's built in temperature sensor?


Recommended Posts

I am trying to use the msp430g2553's built in temperature sensor to measure the ambient temprature surrounding the device, but the temperature seems to very from between 7 to 10 degrees higher than the temprature measured by a seperate self-contained digital thermometer placed directly beisde the msp.

 

 

In cas it matters, the code I am using is:

 

 

void ConfigADC(void)
{
    /* Configure ADC Temp Sensor Channel */
    ADC10CTL1 = INCH_10 + ADC10DIV_3;       // Temp Sensor ADC10CLK/4
    ADC10CTL0 = SREF_1 + ADC10SHT_3 + REFON + ADC10ON;
    __delay_cycles(1000);                   // Wait for ADC Ref to settle
}
 
inline void take_temp(void)
{
    unsigned int adc;
                                            // take temperature reading
    ADC10CTL0 |= ENC + ADC10SC;                // Sampling and conversion start
    while (!(ADC10CTL0 & ADC10IFG));
    adc = ADC10MEM;
    temp = (((48724L * adc) - 30634388L) >> 16);
    // formula from http://forum.43oh.com/topic/1954-using-the-internal-temperature-sensor/
    while (ADC10CTL0 & ADC10BUSY);            // wait for non-busy
    ADC10CTL0 &= ~ENC;
    ADC10CTL0 &= ~ADC10IFG;
}

 

thanks...

Link to post
Share on other sites

It looks like you're not using the temperature sensor calibration values stored in info A on the 2553. I'm not sure if that's sufficient to cause the inaccuracy you're seeing, but it's worth a shot.

 

The calibration values are mentioned in chapter 24 of the MSP430x2xx Family User's Guide and also on page 15 of the 2553 datasheet:

 

The temperature sensor is calibrated using the internal voltage references. At VREF2_5 = 0 and 1, the
12-bit conversion result at 30

Link to post
Share on other sites

 Barring that, I wouldn't think that the chip could be +10 degrees hotter than then surrounding air, 

It probably shouldn't be, so maybe you just need to subtract by a constant.  You can try reading the temperature at different clock speeds to see if it is different.

Link to post
Share on other sites

Sorry, I should have been a bit clearer in my last post. If you use the formula I posted it will make your readings even higher - it's based on the calibration values specific to the chip I have here.

 

I was trying to find out whether the conversion formula based on typical values could differ significantly from the calibrated version. On my chip the difference was a couple of degrees at most - not enough to account for the difference you're seeing. Having said that, maybe my chip just happens to produce results that are quite close to the typical ones in the datasheet...

 

Do you have any way of inspecting the flash memory of your chip? The debugger in CCS can do that, if that's what you're using. If you can grab the contents of flash from 0x10C0 to 0x10FF (Info A memory block) we'll be able to see the calibration values for your chip.

 

Also, what clock speed are you running the msp430 at?

Link to post
Share on other sites

Do you have any way of inspecting the flash memory of your chip? The debugger in CCS can do that, if that's what you're using. If you can grab the contents of flash from 0x10C0 to 0x10FF (Info A memory block) we'll be able to see the calibration values for your chip.

 

Also, what clock speed are you running the msp430 at?

 

I am using CCS, but in Linux. I can load it up in VirtualBox and see if I can figure out how to get that and I'll report back.

Link to post
Share on other sites

The tags in info segment A can be displayed with this code:

 

http://forum.43oh.com/topic/2026-tlv-data-calibration-parse-and-display/

 

The only G series chips I have seen with temperature cal is the G2452.

 

Here is code that will read the cal data and use it:

 

http://forum.43oh.com/topic/2027-how-to-use-temperature-calibration-data/

Link to post
Share on other sites

The only G series chips I have seen with temperature cal is the G2452.

 

The 2553 has it too. Thanks for the TLV code!

 

EDIT: I've just been reading the threads oPossum linked and it seems that the 2553 didn't always have temperature calibration values (they were zeroed). Mine does have valid data, so perhaps TI only started calibrating them sometime in the last year or so.

Link to post
Share on other sites

Thank you both. Hmm... I originally tried to compile this for the 2452, but it wouldn't program to that chip... I wonder if that might work better? I don't know.. but I will try to get those values as soon as I get a chance. If y'all happen across my other thread, you'll see that I am working on a more pressing issue with this project :)

Link to post
Share on other sites

I tried this on a 2452 tonight and I still get a temperature that is anywhere between 7 to 13 degrees hotter than the surrounding air. And the chip feels as cool as a cucumber...

 

I am just going to reuse the code that I used on my Coffee Pot Fish Tank and use an external temperature sensor, since that seems to read much closer to right.

 

I was re-going over that code tonight and, just for my own curiosity, can anyone explain how this formula is able to display the temperature in one degree steps? I would think that, since the loop breaks once the raw analog input is greater than any one of the values stored in the table and performs the same calculation on the result, the temperature reading could only be one of (in my case) 40 possible values (20 in the original). Rather than repost the code here, I will just link to the original thread: http://forum.43oh.com/topic/2004-thermistor-code-for-msp430/

 

I tried asking for help there a long time ago (I since figured that out on my own0 but I never got a response, so I thought I'd try here.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...