The friendly Operating System for the Internet of Things
TMP006 Infrared Thermopile Sensor

Driver for the Texas Instruments TMP006 sensor. More...

Detailed Description

The sensor measures the temperature of an object without the need of direct contact with the object. After initialization and set active the sensor will make measurements at periodic times. The conversion duration depends on oversample ratio.
The oversample ratio can be determined by sensor initialization.
The target object temperature can be calculated as follows:

Temperature of sensor's die (2 times right shifting and devide-by 32):

\begin{eqnarray*} T_{\mathrm{DIE}} &=& \frac{T_{\mathrm{RAW}}}{128} \end{eqnarray*}

Difference Temperature in Kelvin:

\begin{eqnarray*} T_{\mathrm{DIFF}} &=& T_{\mathrm{DIE}} - T_{\mathrm{REF}} \end{eqnarray*}

Sensitivity of the thermopile sensor, with $S_{\mathrm{0}}$ as calibration factor:

\begin{eqnarray*} S &=& S_{\mathrm{0}} \cdot ( 1 + a_1 \cdot T_{\mathrm{DIFF}} + a_2 \cdot T_{\mathrm{DIFF}}^2 ) \\ \end{eqnarray*}

Sensor's voltage (the LSB size is $ 156.25\,\mathrm{nV} $):

\begin{eqnarray*} V_{\mathrm{OBJ}} &=& V_{\mathrm{RAW}} \cdot 156.25\,\mathrm{nV} \end{eqnarray*}

Offset voltage:

\begin{eqnarray*} V_{OS} &=& b_0 + b_1 \cdot T_{\mathrm{DIFF}} + b_2 \cdot T_{\mathrm{DIFF}}^2 \\ \end{eqnarray*}

Seebeck coefficients of the thermopile:

\begin{eqnarray*} f(V_{\mathrm{OBJ}}) &=& (V_{\mathrm{OBJ}} - V_{O\mathrm{S}}) + c_2 \cdot (V_{\mathrm{OBJ}} - V_{\mathrm{OS}})^2 \\ \end{eqnarray*}

Temperature of the target object:

\begin{eqnarray*} T_{\mathrm{OBJ}} &=& \sqrt[4]{T_{\mathrm{DIE}}^4 + \frac{f(V_{\mathrm{OBJ}})}{S}} \\ \end{eqnarray*}


\begin{eqnarray*} a_{\mathrm{1}} &=& 1.75 \cdot 10^{-3} \\ a_{\mathrm{2}} &=& -1.678 \cdot 10^{-5} \\ T_{\mathrm{REF}} &=& 298.15\,\mathrm{K} \\ b_{\mathrm{0}} &=& -2.94 \cdot 10^{-5} \\ b_{\mathrm{1}} &=& -5.7 \cdot 10^{-7} \\ b_{\mathrm{2}} &=& 4.63 \cdot 10^{-9} \\ c_{\mathrm{2}} &=& 13.4 \end{eqnarray*}

        The calculation and constants are wrapped from TI TMP006 User's Guide SBOU107.


file  tmp006.h
 Interface definition for the TMP006 sensor driver.

Data Structures

struct  tmp006_t
 Device descriptor for TMP006 sensors. More...


#define TMP006_I2C_ADDRESS   0x41
 TMP006 Sensor Default Address.
#define TMP006_CONVERSION_TIME   1E6
 Default Conversion Time in us.
#define TMP006_CONFIG_CR_AS1   0x00
 Conversion Time 0.25 s, AVG Samples: 1.
#define TMP006_CONFIG_CR_AS2   0x01
 Conversion Time 0.5 s, AVG Samples: 2.
#define TMP006_CONFIG_CR_AS4   0x02
 Conversion Time 1 s, AVG Samples: 4.
#define TMP006_CONFIG_CR_AS8   0x03
 Conversion Time 2 s, AVG Samples: 8.
#define TMP006_CONFIG_CR_AS16   0x04
 Conversion Time 4 s, AVG Samples: 16.
 Default for Testing.
#define TMP006_CCONST_S0   6.4E-14
 Calibration Factor.
#define TMP006_CCONST_A1   1.75E-3
 Constant $a_{\mathrm{1}}$.
#define TMP006_CCONST_A2   -1.678E-5
 Constant $a_{\mathrm{2}}$.
#define TMP006_CCONST_TREF   298.15
 Constant $T_{\mathrm{REF}}$.
#define TMP006_CCONST_B0   -2.94E-5
 Constant $b_{\mathrm{0}}$.
#define TMP006_CCONST_B1   -5.7E-7
 Constant $b_{\mathrm{1}}$.
#define TMP006_CCONST_B2   4.63E-9
 Constant $b_{\mathrm{2}}$.
#define TMP006_CCONST_C2   13.4
 Constant $c_{\mathrm{2}}$.
#define TMP006_CCONST_LSB_SIZE   156.25E-9
 Sensor Voltage Register LSB Size.


int tmp006_test (tmp006_t *dev)
 TMP006 sensor test. More...
int tmp006_init (tmp006_t *dev, i2c_t i2c, uint8_t address, uint8_t conv_rate)
 Initialize the TMP006 sensor driver. More...
int tmp006_reset (tmp006_t *dev)
 Reset the TMP006 sensor. More...
int tmp006_set_active (tmp006_t *dev)
 Set active mode, this enables periodic measurements. More...
int tmp006_set_standby (tmp006_t *dev)
 Set standby mode. More...
int tmp006_read (tmp006_t *dev, int16_t *rawv, int16_t *rawt, uint8_t *drdy)
 Read sensor's data. More...
void tmp006_convert (int16_t rawv, int16_t rawt, float *tamb, float *tobj)
 Convert raw sensor values to temperature. More...

Function Documentation

void tmp006_convert ( int16_t  rawv,
int16_t  rawt,
float *  tamb,
float *  tobj 
[in]rawvobject voltage value
[in]rawtraw die temperature value
[out]tambconverted ambient temperature
[out]tobjconverted object temperature
int tmp006_init ( tmp006_t dev,
i2c_t  i2c,
uint8_t  address,
uint8_t  conv_rate 
[out]devdevice descriptor of sensor to initialize
[in]i2cI2C bus the sensor is connected to
[in]addresssensor's I2C slave address
[in]conv_ratenumber of averaged samples
0 on success
-1 if conv_rate is wrong
-2 if initialization of I2C bus failed
-3 if sensor test failed
-4 if sensor configuration failed
int tmp006_read ( tmp006_t dev,
int16_t *  rawv,
int16_t *  rawt,
uint8_t *  drdy 
[in]devdevice descriptor of sensor
[out]rawvobject voltage value
[out]rawtraw die temperature
[out]drdydata ready, 0 if a conversion is in progress
0 on success
-1 on error
int tmp006_reset ( tmp006_t dev)

After that, the sensor should be reinitialized.

[out]devdevice descriptor of sensor
0 on success
-1 on error
int tmp006_set_active ( tmp006_t dev)
[in]devdevice descriptor of sensor
0 on success
-1 on error
int tmp006_set_standby ( tmp006_t dev)
[in]devdevice descriptor of sensor
0 on success
-1 on error
int tmp006_test ( tmp006_t dev)

This function looks for Device ID of the TMP006 sensor.

[in]devdevice descriptor of sensor
0 on success
-1 on error