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 temperature reading is 27 degree centigrade.
Refering to 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.