LPC11U68 - internal temperature sensor

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC11U68 - internal temperature sensor

Jump to solution
3,324 Views
johanntaferl
Contributor I

Hello all,

since I have no luck in another thread (https://community.nxp.com/message/764698), I want to ask my question in a different way.

I do use an LPC11U68 on an Xpresso V2 Rev C

The data sheet and manuals say that there is an 12bit ADC.

The internal temperature sensor is connected to channel 0 when powered up.

The sensor measures the temperature inverse to the ADC value.

The temperature range is from -40 to 105°C.

I get a raw ADC value of about 650.

So I calculate:

const constexpr std::int32_t maxRawValue = 4095; //12bit ADC
const constexpr std::int32_t temperatureRange = 145;
const constexpr std::int32_t temperatureOffset = 40;

const std::int32_t rawValue = getRawValue();
const std::int32_t invertedRawValue = maxRawValue - rawValue;
const std::int32_t result = (invertedRawValue * temperatureRange / maxRawValue) - temperatureOffset;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

My result is than -17.

When I use some coolant spray, the rawValue will not change much.

Does anybody have some suggestions what I could do wrong?

Thanks a lot!

PS: I get correct ADC values when I turn off the internal temperature sensor and do connect a potentiometer.

Labels (1)
Tags (1)
0 Kudos
Reply
1 Solution
2,534 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Johanntaferl,

   What the temperature formula you are using?

  From the lpc11u68 datasheet, we can get that:

pastedImage_1.png

pastedImage_2.png

So, the temperature formula should be:

Vtemp= -2.36T+606;

=>T=(Vtemp-606)/(-2.36),

Take care, Vtemp should be mV.

Besides, in the code, please note the user manual mentioned points:

For an accurate measurement of the temperature sensor by the ADC, the ADC must be configured in single-channel burst mode. The last value of a nine-conversion (or more)
burst provides an accurate result.
After the Temperature Sensor is powered, it requires some time to stabilize and output a voltage that correctly represents the device temperature. A much shorter settling time
applies after switching the A/D converter to use the sensor output. Software can deal with both of these factors by repeatedly converting and reading the Temperature Sensor output
via the A/D converter until a consistent result is obtained.

Please also do the calibration of the temperature sensor in the code.

Please check these points, and test it again.

Wish it helps you.


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
Reply
3 Replies
2,534 Views
rocketdawg2
Contributor II

there is an example

LPCOpen Software for LPC11XX|NXP 

0 Kudos
Reply
2,534 Views
johanntaferl
Contributor I

Hello David,

I found the example "periph_temp", but it only prints the raw 12bit hex values from the ADC. I try to figure out how to translate these values to degree Celsius.

Did I miss another example, or the conversion?

Thanks,

Johann

0 Kudos
Reply
2,535 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Johanntaferl,

   What the temperature formula you are using?

  From the lpc11u68 datasheet, we can get that:

pastedImage_1.png

pastedImage_2.png

So, the temperature formula should be:

Vtemp= -2.36T+606;

=>T=(Vtemp-606)/(-2.36),

Take care, Vtemp should be mV.

Besides, in the code, please note the user manual mentioned points:

For an accurate measurement of the temperature sensor by the ADC, the ADC must be configured in single-channel burst mode. The last value of a nine-conversion (or more)
burst provides an accurate result.
After the Temperature Sensor is powered, it requires some time to stabilize and output a voltage that correctly represents the device temperature. A much shorter settling time
applies after switching the A/D converter to use the sensor output. Software can deal with both of these factors by repeatedly converting and reading the Temperature Sensor output
via the A/D converter until a consistent result is obtained.

Please also do the calibration of the temperature sensor in the code.

Please check these points, and test it again.

Wish it helps you.


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply