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.

How to measure temperature with NTC only using a GPIO (P1.5/TA1) and Timer?

Now for limited peripheral and resource, I can only use a GPIO(P1.5/TA1) and Timer to measure temperature with NTC resistor. I want to measure NTC resistor value based on R-C discharge theory which I refer to MSP430 Capacitive Touch RC method.  The circuit and measurement methodology is as follows,

When I implement the code,  I has some questions that need your help,

Q1: Is this method feasible? Would you please kindly give me any other better choice?

Q2: Based on the measurement methodology, when discharge, it sets Px.y as Input with H-L INT enabled.  Why don't use Timer Capture mode directly? What's the different between GPIO H-L edge INT and Timer capture on falling edge? which is more accurate?

Q3: Based on the discharge time, I need to calculate the resistor value with this formula: V(after-discharge) = V(before-discharge)* e^(-t/(RC)), if V(before-discharge)=3.0V (Vcc=3.0V), then what's the value for V(after-discharge)? I mean when get the GPIO H-L edge INT or timer capture the falling edge, at this time, what's the value for V(after-discharge)?

Thanks a lot. O(∩_∩)O~

 (F1-circuit)

 (F2-measurement methodology)

  • Lina Lian said:
    I mean when get the GPIO H-L edge INT or timer capture the falling edge, at this time, what's the value for V(after-discharge)?

    Good question. There's hi/lo level tolerances and you can't be sure about exact voltage here. That's why better to use comparator connected to timer capture, please refer to user guide chapter "Comparator_A+ Used to Measure Resistive Elements".

  • Thanks a lot for your kindly help. The major problem is that  the device I use don't have the comparator peripheral. Limited peripheral and limited resource.

  • Lina Lian said:
    The major problem is that  the device I use don't have the comparator peripheral.

    Other problem is - you don't specify your device :)

  • Ilmars said:

     please refer to user guide chapter "Comparator_A+ Used to Measure Resistive Elements".

    Thanks a lot, Ilmars. I think I can try the method similar to "Comparator_A+ Used to Measure Resistive Elements" even if it doesn't have a comparator. O(∩_∩)O~

  • Lina Lian said:
    Thanks a lot, Ilmars. I think I can try the method similar to "Comparator_A+ Used to Measure Resistive Elements" even if it doesn't have a comparator. O(∩_∩)O~

    Well.. I don't like this.

    Next idea: First you have to modify circuit, capacitor stays connected to GND, ground of NTC you have to connect to pin which you will be switching between 0 and input (hopefully high impedance) state. Then you need reference resistor (having low thermal drift), switchable same way as NTC. So you measure time with R_reference, then measure time with R_NTC. In result you don't need to know ANY voltage: t_reference/R_reference = t_ntc/R_NTC.

  • IImars,

    Thanks a lot for more detailed information. This is exactly what I want to implement,

    1. Set P1 as input and P2 as output and output low level to discharge C using R(NTC);

    2. Set P2 as input and P1 as output and output low level to discharge C using R(ref);

    then get R(NTC) by this formula

    R(NTC) = R(ref) * t(discharge using R(NTC)) / t(discharge using R(ref))

    Well, whatever, you provide the clue and reminder.  :)

  • Be my guest :) If possible, please report your intermediate and final results here - especially what kind of precision you can get using approach I made-up for you.

    BTW you are working on new appnote or just homework or hobby?

**Attention** This is a public forum