lpcware

Computation of temperature using Temp Sensor Lm35 with LPC1768

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
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.

Outcomes