使用されているIR温度センサー「TI TMP006」は、object temperatureとthe ambient temperatureの2種類のデータが取得できます。SensorTagの温度センサー「TMP006」は、最少時間「250ms」で更新されます。
SensorTagの 温度センサーへのデータアクセス
ハンドルを用いたSensorTagの IR温度センサー「TI TMP006」(U5)への問い合わせは、次のテーブルに従います。
| Type | UUID | Handle | Read/Write | Format |
|---|---|---|---|---|
| <Data> | F000AA01 * | 0×25 | Read/Notify | ObjLSB ObjMSB AmbLSB AmbMSB (4 bytes) |
| <Data Notification> | 0×26 | R/W | 2 bytes | |
| <Configuration> | F000AA02 * | 0×29 | R/W | 1 byte |
温度センサーデータの温度への変換式
Objはobject temperatureで、Ambはthe ambient temperatureを示します。
IR温度センサー「TI TMP006」から入力したデータ(Handle:0x25)を、次の計算式により温度に変換します。

温度センサーデータ変換のプログラム
t1,2はobject temperatureで、t3,4はambient temperatureを示します。上記のIR温度センサーの変換式をjava言語とc言語でコード化した例を示します。
java言語で記述すると次のようになります。
import static java.lang.Math.*;
public class IrTemperature {
/**/
private double calcTmpLocal(int rawT)
{
//-- calculate die temperature [°C] -
double m_tmpAmb = (double) rawT / 128.0;
// Used in also in the calc. below
return m_tmpAmb;
}
/* Conversion algorithm for target temperature */
private double calcTmpTarget(int rawT)
{
//-- calculate target temperature [°C] -
double Vobj2 = (double) rawT;
Vobj2 *= 0.00000015625;
double Tdie2 = this.calcTmpLocal(0x321) + 273.15;
double S0 = 6.4E-14; // Calibration factor
double a1 = 1.75E-3;
double a2 = -1.678E-5;
double b0 = -2.94E-5;
double b1 = -5.7E-7;
double b2 = 4.63E-9;
double c2 = 13.4;
double Tref = 298.15;
double S = S0 * (1 + a1 * (Tdie2 - Tref) + a2 * pow((Tdie2 - Tref), 2));
double Vos = b0 + b1 * (Tdie2 - Tref) + b2 * pow((Tdie2 - Tref), 2);
double fObj = (Vobj2 - Vos) + c2 * pow((Vobj2 - Vos), 2);
double tObj = pow(pow(Tdie2, 4) + (fObj / S), .25);
tObj = (tObj - 273.15);
return tObj;
}
}
C言語で記述すると次のようになります。
/* Conversion algorithm for die temperature */
double calcTmpLocal(uint16 rawT)
{
// calculate die temperature [°C]
m_tmpAmb = (double)((qint16)rawT)/128.0; // Used in also in the calc. below
return m_tmpAmb;
}
import static java.lang.Math.pow;
/* Conversion algorithm for target temperature */
double calcTmpTarget(uint16 rawT)
{
//-- calculate target temperature [°C] -
double Vobj2 = (double)(qint16)rawT;
Vobj2 *= 0.00000015625;
double Tdie2 = m_tmpAmb + 273.15;
const double S0 = 6.4E-14; // Calibration factor
const double a1 = 1.75E-3;
const double a2 = -1.678E-5;
const double b0 = -2.94E-5;
const double b1 = -5.7E-7;
const double b2 = 4.63E-9;
const double c2 = 13.4;
const double Tref = 298.15;
double S = S0*(1+a1*(Tdie2 - Tref)+a2*pow((Tdie2 - Tref),2));
double Vos = b0 + b1*(Tdie2 - Tref) + b2*pow((Tdie2 - Tref),2);
double fObj = (Vobj2 - Vos) + c2*pow((Vobj2 - Vos),2);
double tObj = pow(pow(Tdie2,4) + (fObj/S),.25);
tObj = (tObj - 273.15);
return tObj;
}