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.

TMP61: Can we achieve 1C accuracy using 10Bit ADC(MSP430FR2433 MCU)?

Part Number: TMP61
Other Parts Discussed in Thread: MSP430FR2433, , TMP116, MSP430FR2476, MSP430F5529, ENERGIA, TMP117

Hello,

I want to interface TMP61 sensor with MSP430FR2433 using its 10Bit ADC. I have used the Ti Thermistor Design Tool to apply 4th order polynomial and oversampling and averaging in the firmware. I am using hardware based low pass filter with 0.1uF capacitor and 10k resistor. After doing all this I am getting reading around 14C but actual temperature is around 26 (checked using TMP116 sensor).

I want to know if it is possible to get value near to real value using 10bit ADC. I also tried the same configuration with 12 bit ADC(MSP430FR2476 MCU) and it was giving very close result.

Thanks

Jeevant Sah

  •  Hi Jeevant,

    You may want to consider oversampling to increase the resolution of the 10 bit ADC.  We have an app note describing this below.  Let me know if this provides better results for you.  Also, keep in mind, you will need to provide an offset correction at 1 temperature point(room temp is fine).

    https://www.ti.com/lit/an/sboa448/sboa448.pdf 

  • I have already done oversampling in the firmware, above result of 14C is after doing oversampling. Regarding offset even if I do that correction value will get upto 15 and even in this case actual temperature difference is still around 11C.

    Is there any other way to do it?

  • Hi Jeevant,

    Something seems like it is fundamentally off if you are seeing a 14C error initially.  I have a MSP430FR2433 launchpad that I will test with the TMP61 device.  I will get back to you tomorrow with my results.

  • Hi Eddie,

    Any updates?

  • Jeevant,

    I am still working on this.  Everything is working fine with the MSP430F5529, but this uses the 12 bit ADC.  On the MSP430FR2433 with 10 bit ADC, I am having trouble getting the proper ADC readings.  I think this has to do with the internal reference voltage of 1.5V by default.  Working on figuring this out and will provide an update.

  • Jevant,

    I was able to resolve the problem by using a 1.5V bias instead of 3.3V.  This is because the MSP430FR2433 only has a 1.5V internal reference voltage.  I have attached some Energia code which configures the device and sends the data via UART on a terminal.  See the test results below measured at ~8C.  The red line is the TMP117 used for reference and the blue line is the TMP61 after filtering and offset.  Let me know if you are able to make use of this to resolve your issue as well.

  • Here is the code.

    /*
      AnalogReadSerial TMP6
      Reads an analog input on pin 6, prints the result to the serial monitor.
      Attach the center pin of a potentiometer to pin A3, and the outside pins to ~3V and ground.
    
      Hardware Required:
        MSP-EXP430F5529 LaunchPad
        TMP6 with bias resistor
        hook-up wire
    
      This example code is in the public domain.
    
    
    */
    #include <Wire.h>
    int sensorPin = A6;    // select the input pin for the potentiometer
    int sensorValue = 0;
    float VTEMP = 0;
    float AMB_TEMP = 0;
    float Meas_Temp = 0;        //
    float Alpha = 0.01;       // .001<α<1, adjust as required
    float Filtered_Temp = 21;        // Set a default filtered temperature value equal to the first measured value to reduce the ramp time
    //float THRM_A0 =  -5.479495E+02 ;     //using TMP6131DYAR here on MSP430F5529LP
    //float THRM_A1 = 7.540674E+02  ;
    //float THRM_A2 =   -4.376661E+02 ;
    //float THRM_A3 =   1.387438E+02  ;
    //float THRM_A4 =   -1.366970E+01 ;
    
        float THRM_A0 =  -4.054532E+02 ;
        float THRM_A1 = 9.517609E+02  ;
        float THRM_A2 =   -7.891225E+02 ;
        float THRM_A3 =   3.701203E+02  ;
        float THRM_A4 =   2.121926E+01  ;
    
    
    
    
    // the setup routine runs once when you press reset:
    void setup() {
      // initialize serial communication at 115200 bps:
      Serial.begin(115200);
      Wire.begin(0);
      Wire.setTimeout(0);
      delay(1000);
    
      //    analogReference (DEFAULT);
          analogReference (INTERNAL1V5);
    //      analogReference (INTERNAL2V5);
    //      analogReference (EXTERNAL);
    }
    
    // the loop routine runs over and over again forever:
    void loop() {
      // read the input on analog pin A6:
      sensorValue = analogRead(sensorPin);
      // convert to voltage
      VTEMP = ((1.5 / 1023) * sensorValue);
      //convert to temp in C
      AMB_TEMP = ((THRM_A4 * powf(VTEMP, 4)) + (THRM_A3 * powf(VTEMP, 3)) + (THRM_A2 * powf(VTEMP, 2)) + (THRM_A1 *  powf(VTEMP, 1)) + THRM_A0); // 4th order regression to get temperature
    
      //  Serial.print(",");
      //  Serial.println(sensorValue);
      //
    //    Serial.print(",");
    //    Serial.println(VTEMP, 4);
    
      //  Serial.print(AMB_TEMP, 4);
      //  Serial.print(",");
    
      // Filter
      Meas_Temp = AMB_TEMP;        // It's assumed that you have read the ADC and calculated your temperature
      Filtered_Temp = Filtered_Temp - (Alpha * (Filtered_Temp - Meas_Temp));
      Serial.print(Filtered_Temp + 0, 4);  //set offset
      Serial.print(",");
    
      //Read from the TMP117
    //  Wire.requestFrom(72, 2);
    //  while (Wire.available())
    //  {
    //    int Byte = Wire.read(); //reads the first Byte
    //    Byte = Byte << 8; // shifts the first byte by 8 making it the high byte valuexz
    //    Byte += Wire.read(); // reads the next byte and appends to the first byte
    //    double tmp117_temp = Byte * .0078125; //converts the data to temp
    //    Serial.println(tmp117_temp, 4); // displays the data
    //   //     Serial.print(",");
    //  }
    //  delay(50); // delay in between reads for stability
    }
    

    /*
      AnalogReadSerial TMP6
      Reads an analog input on pin 6, prints the result to the serial monitor.
      Attach the center pin of a potentiometer to pin A6, and the outside pins to ~1.5V and ground.
    
      Hardware Required:
        MSP430FR2433 LaunchPad
        TMP6 with bias resistor
        hook-up wire
    
      This example code is in the public domain.
    
    
    */
    #include <Wire.h>
    int sensorPin = A6;    // select the input pin for the potentiometer
    int sensorValue = 0;
    float VTEMP = 0;
    float AMB_TEMP = 0;
    float Meas_Temp = 0;        //
    float Alpha = 0.01;       // .001<α<1, adjust as required
    float Filtered_Temp = 21;        // Set a default filtered temperature value equal to the first measured value to reduce the ramp time
    //float THRM_A0 =  -5.479495E+02 ;     
    //float THRM_A1 = 7.540674E+02  ;
    //float THRM_A2 =   -4.376661E+02 ;
    //float THRM_A3 =   1.387438E+02  ;
    //float THRM_A4 =   -1.366970E+01 ;
    
        float THRM_A0 =  -4.054532E+02 ;   //using TMP6131DYAR here on MSP430FR2433LP
        float THRM_A1 = 9.517609E+02  ;
        float THRM_A2 =   -7.891225E+02 ;
        float THRM_A3 =   3.701203E+02  ;
        float THRM_A4 =   2.121926E+01  ;
    
    
    
    
    // the setup routine runs once when you press reset:
    void setup() {
      // initialize serial communication at 115200 bps:
      Serial.begin(115200);
      Wire.begin(0);
      Wire.setTimeout(0);
      delay(1000);
    
      //    analogReference (DEFAULT);
          analogReference (INTERNAL1V5);
    //      analogReference (INTERNAL2V5);
    //      analogReference (EXTERNAL);
    }
    
    // the loop routine runs over and over again forever:
    void loop() {
      // read the input on analog pin A6:
      sensorValue = analogRead(sensorPin);
      // convert to voltage
      VTEMP = ((1.5 / 1023) * sensorValue);
      //convert to temp in C
      AMB_TEMP = ((THRM_A4 * powf(VTEMP, 4)) + (THRM_A3 * powf(VTEMP, 3)) + (THRM_A2 * powf(VTEMP, 2)) + (THRM_A1 *  powf(VTEMP, 1)) + THRM_A0); // 4th order regression to get temperature
    
      //  Serial.print(",");
      //  Serial.println(sensorValue);
      //
    //    Serial.print(",");
    //    Serial.println(VTEMP, 4);
    
      //  Serial.print(AMB_TEMP, 4);
      //  Serial.print(",");
    
      // Filter
      Meas_Temp = AMB_TEMP;        // It's assumed that you have read the ADC and calculated your temperature
      Filtered_Temp = Filtered_Temp - (Alpha * (Filtered_Temp - Meas_Temp));
      Serial.print(Filtered_Temp + 0, 4);  //set offset
      Serial.print(",");
    
      //Read from the TMP117
    //  Wire.requestFrom(72, 2);
    //  while (Wire.available())
    //  {
    //    int Byte = Wire.read(); //reads the first Byte
    //    Byte = Byte << 8; // shifts the first byte by 8 making it the high byte valuexz
    //    Byte += Wire.read(); // reads the next byte and appends to the first byte
    //    double tmp117_temp = Byte * .0078125; //converts the data to temp
    //    Serial.println(tmp117_temp, 4); // displays the data
    //   //     Serial.print(",");
    //  }
    //  delay(50); // delay in between reads for stability
    }

  • Thanks Eddie for the help.

  • No problem.  Good luck with your testing!