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.
您好!
我想使用它的10位 ADC 将 TMP61传感器与 MSP430FR2433连接。 我使用 TI 热敏电阻设计工具在固件中应用四阶多项式以及过采样和平均值计算。 我使用的是基于硬件的低通滤波器、具有0.1uF 电容器和10k 电阻器。 完成所有这些操作后、我将获得大约14C 的读数、但实际温度大约为26 (使用 TMP116传感器进行检查)。
我想知道是否可以使用10位 ADC 获得接近实际值的值。 我还使用12位 ADC (MSP430FR2476 MCU)尝试了相同的配置、结果非常接近。
谢谢
Jeevant Sah
您好、Jeevant、
您可能需要考虑过采样以提高10位 ADC 的分辨率。 我们有一份应用手册对此进行了介绍。 请告诉我这是否能为您提供更好的结果。 此外、请记住、您需要在1个温度点提供偏移校正(室温正常)。
我已经在固件中进行过采样、 以上14C 的结果是进行过采样。 关于偏移、即使我这么做、校正值也会达到15、即使在这种情况下、实际温度差仍在11°C 左右。
还有其他方法可以实现它吗?
您好、Jeevant、
如果您最初看到14C 误差、看起来基本上是关闭的。 我有一个 MSP430FR2433 Launchpad、我将使用 TMP61器件进行测试。 我明天会给你们看我的结果。
您好、Eddie、
是否有更新?
Jeevant、
我仍在进行这方面的工作。 MSP430F5529的一切都正常、但这使用12位 ADC。 在具有10位 ADC 的 MSP430FR2433上、我无法获得正确的 ADC 读数。 我认为这与默认情况下1.5V 的内部基准电压有关。 并将提供更新。
Jevant、
我能够通过使用1.5V 偏置而不是3.3V 来解决这个问题。 这是因为 MSP430FR2433只有1.5V 的内部基准电压。 我已附加一些 Energia 代码、用于配置器件并通过终端上的 UART 发送数据。 请参阅以下在~8C 下测得的测试结果。 红线是用于参考的 TMP117、蓝线是滤波和偏移后的 TMP61。 请告诉我、您是否也能够利用此功能来解决您的问题。
这是代码。
/* 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 }
感谢 Eddie 的帮助。
没问题。 祝您在测试中一切顺利!