This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

ADC and LM35

Other Parts Discussed in Thread: LM35

Hi,

i use the LM35 to read the temp.. And i use the ADC from CC1111 to change it or make it digital. And then i send it to my pc with uart. The sending isn't a porblem. But ADC or LM35 there is a problem. I send every time 00. But i have to send for example 27 degree. What can be wrong? 

ADC configuration i did this:

ADCCON2 = ADCCON2_SREF_AVDD | ADCCON2_SDIV_256 | ADCCON2_SCH_AIN7;
ADCCON1 = STSEL_FULL_SPEED | BIT1 | BIT0;

 ADCCFG |= ADCCFG_5;

adc_result = ADCL & 0xC0;
adc_result |= (ADCH << 8);

adc_result = adc_result *100;                // the LM35 gives value of 0.25 for example. I multiplicate it with 100 to get                                                                          25 degree.

Do you think there is the problem? Or is my ADC configuration wrong?

Thank you

  • Do you think my misstake is, that i calculate wrong? For example, i configurate my ADC with 10 Bits. That is 2^10= 1024. My LM35 has a spectrum of 2degree to 150 degree. Also 148 degree. I think i have to divide it. Also 148/1024. Now i have one bit resolution. 

    After that i have to multiply the ADC result with this one bit value. After that multiplay it with 100. İs that right?

    But i don't anderstand. My LM35 gives me a value for example 300mV/C. And that is my degree. I have to multiplay it with 100 only. Then i have 30 degrees. But what did my ADC with the 300mV/C value? It makes it digital. That means i have not more 300mV/C, i have what?

    If i make the calcuation which i wrote, then i won't get 30 degrees. What is wrong?

    Please help 

  • I'm not familiar with the sensor but it has a slope equal to 10 mV/C. From figure 1 in the LM35 datasheet it looks like the output is 0 V for 0 degrees. For 30 degrees you should have 300 mV out. Then it will depend on what you have selected as reference voltage on the ADC.

    The ADC resolution is Vref/1024. 1 degree is then 10mV/Vref*1024 code steps. 

  • Hi,

    thanks for youre help. But youre calculation is not quite right. Becouse you sad. 300mV for 30 degrees. If i calculate with youre formula, then i get not 30 degrees.

    300mV/Vref*1024 ( Vref = 3.3V) = 93 degrees.

    From CC1111 Datsheet: i can choose only internal 1.25V as reference or VDD on the AVDD pin and that is 3.3 V.

    Selects reference voltage used for the sequence of conversions
    00 Internal 1.25V reference
    10 VDD on the AVDD pin

    What is wrong? 

  • 10 mV/Vref*1024=3.1 LSB

    Hence to get degrees you have to divide the ADC read by 3.1