Computation of temperature using Temp Sensor Lm35 with LPC1768

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

Computation of temperature using Temp Sensor Lm35 with LPC1768

2,647 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by newbie on Sat Aug 17 02:24:34 MST 2013
Hi,

I have connected a LM35 to ADC channel 1 of LPC1768. getting a value of 306(adc reading).

Vref =5V
For 12 bit ADC
Step size = 5V/4096=1.22mV
to calculate the output voltage.
Vout in mV = adc_reading*Step size
   = 306*1.22mV= 373.32mV

LM35 sensor gives an output of 10mV for every 1 degree centigrade.
so the measured temperature is = 373.32/10= 37 degree centigrade

But bangalore's(Today's temp -17/08/2013) temperature reading is 29 degree centigrade.

Referred Mazidi's AVR Microcontroller and Embedded Systems book,
The digital output from ADC is calculated by the below formula
Vout = analog input voltage/step size
if Vout is calculated with the above formula then o/p voltage is
Vout = 306/1.22=250.819mV

Voltage to temperature conversion = 250.819mV/10mV = 25.08 degree centigrade.

Unable to figure out what is right. Kindly help. Sorry for this silly question.

Also connected an LDR to ADC channel 0 of LPC1768. Calculated the measured output voltage
Vout = adc_reading*step size.
for adc_reading = 55-> vout = 0.064713
adc_reading = 3245-> vout = 3.962149
adc_reading = 4095-> vout = 4.999995

May be you experts can throw some light on this. confused as to why i am unable to get the right temperature as per my city.

Labels (1)
0 Kudos
5 Replies

1,683 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by beetty glvz on Mon Mar 17 13:46:13 MST 2014
how do you get the factor
Vref =5V
For 12 bit ADC
Step size = 5V/4096=1.22mV
to calculate the output voltage.
Vout in mV = adc_reading*Step size
= 306*1.22mV= 373.32mV
0 Kudos

1,683 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Irappa on Tue Sep 10 05:49:12 MST 2013
Hi,

Please send me code i will work with LPC1769.
0 Kudos

1,683 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by newbie on Fri Aug 23 08:55:37 MST 2013
Thanks for pointing the mistake. I had used 5V instead of 3V3. Now getting the right temperature. Thanks again wmues and NXP_Paul.
0 Kudos

1,683 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by NXP_Paul on Tue Aug 20 07:38:00 MST 2013
As Wolfgang has suggested, it looks like you are operating outside the valid voltage range of the ADC in the LPC1768.  The maximum voltage on VREFP is VDDA.  VDDA is specified to be 3.6V max (see Table 7 in the data sheet).  You should also limit the voltage on the ADC inputs to VDDA (see Table 18 in the data sheet).
Operating outside the device specification may damage the device.

- Paul
0 Kudos

1,683 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by wmues on Sat Aug 17 04:00:07 MST 2013
Is Vref = 5V inside the valid voltage range?
Can you check with Vref = 3V3?

Maybe you have an offset error? Measure an input which is connected to ground.

regards
Wolfgang
0 Kudos