+ Post New Thread
Results 1 to 13 of 13
  1. #1
    Newbie level 3
    Points: 2,038, Level: 10
    Achievements:
    7 years registered

    Join Date
    Mar 2009
    Posts
    6
    Helped
    0 / 0
    Points
    2,038
    Level
    10

    Temprature sensors. LM35 vs MCP9700

    Hi, I'm using Arduino R3 nano to read tempratures from 2 sensors.
    A LM35 and a MCP9700.
    There is quite a difference between the readings. Which sensor should I believe?
    I also have a digital sensor in the room that is reading 22,6.

    Sample output.
    LM35 : 23.86 MCP9700 : 20.13 Temp AVG : 21.99
    LM35 : 23.87 MCP9700 : 20.13 Temp AVG : 22.00
    LM35 : 23.88 MCP9700 : 20.14 Temp AVG : 22.01
    LM35 : 23.89 MCP9700 : 20.13 Temp AVG : 22.01
    LM35 : 23.90 MCP9700 : 20.14 Temp AVG : 22.02
    LM35 : 23.90 MCP9700 : 20.14 Temp AVG : 22.02
    LM35 : 23.90 MCP9700 : 20.14 Temp AVG : 22.02
    LM35 : 23.90 MCP9700 : 20.15 Temp AVG : 22.03
    LM35 : 23.89 MCP9700 : 20.15 Temp AVG : 22.02
    LM35 : 23.89 MCP9700 : 20.14 Temp AVG : 22.02
    LM35 : 23.88 MCP9700 : 20.14 Temp AVG : 22.01
    LM35 : 23.85 MCP9700 : 20.13 Temp AVG : 21.99
    LM35 : 23.83 MCP9700 : 20.12 Temp AVG : 21.97
    Thank in advance. Stan

  2. #2
    Super Moderator
    Points: 32,514, Level: 44
    ads-ee's Avatar
    Join Date
    Sep 2013
    Location
    USA
    Posts
    7,524
    Helped
    1762 / 1762
    Points
    32,514
    Level
    44

    Re: Temprature sensors. LM35 vs MCP9700

    I don't see why there is anything wrong between the two, they are tracking very well.

    I just see a need for calibration being done on the sensor(s).



  3. #3
    Super Moderator
    Points: 85,257, Level: 71
    Achievements:
    7 years registered
    Awards:
    2nd Helpful Member
    betwixt's Avatar
    Join Date
    Jul 2009
    Location
    Aberdyfi, West Wales, UK
    Posts
    14,029
    Helped
    4669 / 4669
    Points
    85,257
    Level
    71

    Re: Temprature sensors. LM35 vs MCP9700

    .... and did you compensate for the zero offset on the MCP9700? The devices are not directly interchangeable.

    Brian.
    PLEASE - no friends requests or private emails, I simply don't have time to reply to them all.
    It's better to share your questions and answers on Edaboard so we can all benefit from each others experiences.



    •   AltAdvertisement

        
       

  4. #4
    Newbie level 3
    Points: 2,038, Level: 10
    Achievements:
    7 years registered

    Join Date
    Mar 2009
    Posts
    6
    Helped
    0 / 0
    Points
    2,038
    Level
    10

    Re: Temprature sensors. LM35 vs MCP9700

    Hi Brian,

    Yes I did compensate for zero offset.
    Code C - [expand]
    1
    2
    3
    4
    5
    
    // LM35
        TA[0] = TA[0] + analogRead(A0)*vREF/1024*100;
    // MCP9700
        TA[1] = TA[1] + (analogRead(A1)- 500)*vREF/1024*100;
        delay(2);

    Regards, Stan



    •   AltAdvertisement

        
       

  5. #5
    Newbie level 3
    Points: 2,038, Level: 10
    Achievements:
    7 years registered

    Join Date
    Mar 2009
    Posts
    6
    Helped
    0 / 0
    Points
    2,038
    Level
    10

    Re: Temprature sensors. LM35 vs MCP9700

    AH yes, calibration, that's going to be challenge.
    Thank you for your response. Stan



    •   AltAdvertisement

        
       

  6. #6
    Super Moderator
    Points: 83,859, Level: 70
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    17,049
    Helped
    3853 / 3853
    Points
    83,859
    Level
    70

    Re: Temprature sensors. LM35 vs MCP9700

    Hi,

    my recommendation: Read the datasheets. Both datasheets specify accuracy.
    At least this is the way I`d do it.

    Klaus
    Please don´t contact me via PM, because there is no time to respond to them. No friend requests. Thank you.



  7. #7
    Advanced Member level 5
    Points: 15,683, Level: 30
    Achievements:
    7 years registered
    schmitt trigger's Avatar
    Join Date
    Apr 2013
    Posts
    2,605
    Helped
    834 / 834
    Points
    15,683
    Level
    30

    Re: Temprature sensors. LM35 vs MCP9700

    Calibration is difficult for a hobbyist, but you can perform a pair of steps:

    -Put some ice on a bucket, and let it slowly melt. When you have about 50/50 ice and water, that will be your 0-C point
    -If you live at sea level or close to it, you can get water to start boiling, and that will be your 100-C point.
    My batteries are recharged by "Helpful Post" ratings.
    If you feel that I've helped you, please indicate it as a Helpful Post



  8. #8
    Super Moderator
    Points: 85,257, Level: 71
    Achievements:
    7 years registered
    Awards:
    2nd Helpful Member
    betwixt's Avatar
    Join Date
    Jul 2009
    Location
    Aberdyfi, West Wales, UK
    Posts
    14,029
    Helped
    4669 / 4669
    Points
    85,257
    Level
    71

    Re: Temprature sensors. LM35 vs MCP9700

    Code:
    TA[1] = TA[1] + (analogRead(A1)- 500)*vREF/1024*100;
    Are you sure that subtracting 500 is the correct value. I'm not familiar with the Arduino Nano but the final measured voltage should have around 400mV subtracted. The exact amount has to be determined as detailed above.

    What vREF did you use?

    Brian.
    PLEASE - no friends requests or private emails, I simply don't have time to reply to them all.
    It's better to share your questions and answers on Edaboard so we can all benefit from each others experiences.



  9. #9
    Super Moderator
    Points: 32,514, Level: 44
    ads-ee's Avatar
    Join Date
    Sep 2013
    Location
    USA
    Posts
    7,524
    Helped
    1762 / 1762
    Points
    32,514
    Level
    44

    Re: Temprature sensors. LM35 vs MCP9700

    The other option to "calibrate" either of the parts is to use a reference like the digital sensor in the room as the "golden" reference and adjust the reading accordingly with an offset. This only has a chance of working correctly if the calculation of the reading from the sensor to a temperature is correctly done and if the sensor you use (LM or MCP) gives linear readings across its temperature range.



  10. #10
    Newbie level 3
    Points: 2,038, Level: 10
    Achievements:
    7 years registered

    Join Date
    Mar 2009
    Posts
    6
    Helped
    0 / 0
    Points
    2,038
    Level
    10

    Re: Temprature sensors. LM35 vs MCP9700

    Hi Brian vREF is the internal reference voltage the arduino.
    Its 1.1v on the data sheet. I measured it to be 1.097 volts.



  11. #11
    Newbie level 3
    Points: 2,038, Level: 10
    Achievements:
    7 years registered

    Join Date
    Mar 2009
    Posts
    6
    Helped
    0 / 0
    Points
    2,038
    Level
    10

    Re: Temprature sensors. LM35 vs MCP9700

    I will try the ice.
    I live at about 5700 feet above see level so boiling water would be around 96-98 degrees.
    I though of using a medical thermometer around 35 degrees. It has a scale marked off at 0.1 degree intervals.



  12. #12
    Newbie level 3
    Points: 2,038, Level: 10
    Achievements:
    7 years registered

    Join Date
    Mar 2009
    Posts
    6
    Helped
    0 / 0
    Points
    2,038
    Level
    10

    Re: Temprature sensors. LM35 vs MCP9700

    I have digital sensor from our old Computer centre, so I will compare my readings to that at the moment.
    I'm not sure how accurate it is.



    •   AltAdvertisement

        
       

  13. #13
    Super Moderator
    Points: 85,257, Level: 71
    Achievements:
    7 years registered
    Awards:
    2nd Helpful Member
    betwixt's Avatar
    Join Date
    Jul 2009
    Location
    Aberdyfi, West Wales, UK
    Posts
    14,029
    Helped
    4669 / 4669
    Points
    85,257
    Level
    71

    Re: Temprature sensors. LM35 vs MCP9700

    Assuming the ADC is 10-bits, with 1.097 vREF the ADC would read 373 with 400mV input.

    Where does the 500 come from in your calculation?

    For reference, I use MCP9701 devices extensively, they are the same temperature sensor but with an internal amplifier to align their output with typical ADC steps. I find them very accurate although I do calibrate them by adding long wires to a bundle at a time and placing them together inside a fridge at 2C for 30 minutes.

    Brian.
    PLEASE - no friends requests or private emails, I simply don't have time to reply to them all.
    It's better to share your questions and answers on Edaboard so we can all benefit from each others experiences.



--[[ ]]--