1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

displaying tempture

Discussion in 'Microcontrollers' started by TucsonDon, Sep 13, 2017.

  1. TucsonDon

    TucsonDon Member

    Joined:
    Sep 4, 2016
    Messages:
    45
    Likes:
    0
    I am using the ADC on a PIC18F46K22 with a 10kΩ thermistor. How do I take the result from the ADC and convert to °F to display on a LCD?
     
  2. KeepItSimpleStupid

    KeepItSimpleStupid Well-Known Member Most Helpful Member

    Joined:
    Oct 30, 2010
    Messages:
    9,964
    Likes:
    1,099
    ONLINE
    10K thermister doesn't mean a whole lot. You need to know the type and you know that the resistance at 25C is 10K.

    You can do:
    1. Lookup
    2. use the Steinhart-Hart eqn
    3. Use a dedicated thermister IC which may linearize for you. (See linear technology)
    4. Piecewise linearization

    A lot of times the thermister range that you need is intentionally small so a simple voltage divider works.
    Application notes on http://www.analog.com

    Open and shorted is another problem entirely.
     
  3. alec_t

    alec_t Well-Known Member Most Helpful Member

    Joined:
    Jul 10, 2011
    Messages:
    9,315
    Likes:
    1,230
    Location:
    Cardiff, Wales
    You can take ADC readings with the thermistor at several different temperatures to calibrate the system, scale the readings to degrees F for display, then use interpolation to determine/display other temperatures.
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. TucsonDon

    TucsonDon Member

    Joined:
    Sep 4, 2016
    Messages:
    45
    Likes:
    0

    alec_t I am unsure how to do that in code. If I have a resistance scale can't I figure the result?
     
  6. OBW0549

    OBW0549 Member

    Joined:
    Apr 26, 2015
    Messages:
    98
    Likes:
    26
    Location:
    Southeast PA, USA
    There's a tutorial here which shows how to do it.
     
  7. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,304
    Likes:
    914
    Location:
    Rochdale UK
    ONLINE
  8. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,304
    Likes:
    914
    Location:
    Rochdale UK
    ONLINE
    Sorry OBW.... Same time....
     
  9. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,233
    Likes:
    645
    Location:
    Ex Yorks' Hants UK

    Attached Files:

    • A02.gif
      A02.gif
      File size:
      33.2 KB
      Views:
      29
  10. KeepItSimpleStupid

    KeepItSimpleStupid Well-Known Member Most Helpful Member

    Joined:
    Oct 30, 2010
    Messages:
    9,964
    Likes:
    1,099
    ONLINE
    So, you have the R vs T scale.

    Figure out just what T range your concerned about. The entire range will be a lot tougher.

    The simplest is a voltage reference, a fixed resistor and the thermister to ground selected so your A/D has a good range and meets resolution requirements.min and max temperature. It may not meet one and you;ll have to change your method.
     
  11. TucsonDon

    TucsonDon Member

    Joined:
    Sep 4, 2016
    Messages:
    45
    Likes:
    0
    If I am understanding what you are saying, the ADC on the PIC18F46K22 uses an internal reference that is software selected correct?

    This is all good information but, what I am trying to figure out is how to convert the ADC result to a string that can be displayed on the LCD
     
  12. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,304
    Likes:
    914
    Location:
    Rochdale UK
    ONLINE
    Okay... Are you doing C or ASM?

    If C then you can just look through my articles... Most of which will be applicable to your application... Anything that isn't there. Just ask??
     
    • Like Like x 1
  13. hyedenny

    hyedenny Member

    Joined:
    Jan 17, 2009
    Messages:
    86
    Likes:
    4
    Why would anyone want to use a thermistor for anything but crude min/max limits? There are other easier, inexpensive, and WAY more accurate (repeatable, reliable, and precise) ways to measure temperature!
     
  14. KeepItSimpleStupid

    KeepItSimpleStupid Well-Known Member Most Helpful Member

    Joined:
    Oct 30, 2010
    Messages:
    9,964
    Likes:
    1,099
    ONLINE
    Microwave oven temperature probes and ovens use thermisters.

    The OP/TS really has to state what his problem is.

    1. Is it the conversion of a number read from the A/D to temperature
    2. Is it the electrical interface? The simplest is the voltage divider
    3. Is it the display of any number on an LCD display.

    I think we have answered the perceived question in general terms based on the information provided.
     
  15. TucsonDon

    TucsonDon Member

    Joined:
    Sep 4, 2016
    Messages:
    45
    Likes:
    0
    I did look through and found some algorithms that will convert the ADC result to temp reading using the Steinhart-Hart Thermistor Equation
     
  16. atferrari

    atferrari Well-Known Member

    Joined:
    Oct 8, 2003
    Messages:
    2,816
    Likes:
    121
    Location:
    Buenos Aires - Argentina
    To really help the TS/OP you could give a specific link or just name those WAY more accurate.
     
  17. hyedenny

    hyedenny Member

    Joined:
    Jan 17, 2009
    Messages:
    86
    Likes:
    4
    I would, but the OP never mentioned what the application is, so it would be a waste of time. Google is easy enough to use...
    However, RTDs, and monolithics such as LM34 come to mind. Just about anything is more accurate and easier (and more linear) than a simple thermistor!
    For mass production -- like the microwave ovens previously mentioned -- then it might be worth figuring out how to implement a super-cheap thermistor.
     

Share This Page