TMP006/TMP007 Infrared Thermopile Sensor

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

Detailed Description

Driver for the Texas Instruments TMP00X sensor.

The TI TMP00X (Infrared Thermopile Contactless Temperature Sensor) measures the temperature of an object without need of direct contact with the object. After initialization the sensor can be set active for periodic measurements.
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*}

Constants:

\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 TMP00X User's Guide SBOU107.

This driver provides [S]ensor [A]ctuator [U]ber [L]ayer capabilities.

Modules

 TMP006/TMP007 Infrared Thermopile Sensor driver compile configuration
 

Files

file  tmp00x.h
 Interface definition for the TMP00X sensor driver.
 
file  tmp00x_params.h
 Default configuration for TMP00X (TMP006 and TMP007) devices.
 
file  tmp00x_regs.h
 Register definitions for TMP00X (TMP006 and TMP007) devices.
 

Data Structures

struct  tmp00x_params_t
 Parameters needed for device initialization. More...
 
struct  tmp00x_t
 Device descriptor for TMP00X sensors. More...
 

Macros

#define BUS   (dev->p.i2c)
 BUS.
 
#define ADDR   (dev->p.addr)
 ADDR.
 

Enumerations

enum  {
  TMP00X_OK, TMP00X_ERROR_BUS, TMP00X_ERROR_DEV, TMP00X_ERROR_CONF,
  TMP00X_ERROR
}
 TMP00X specific return values. More...
 

Functions

int tmp00x_init (tmp00x_t *dev, const tmp00x_params_t *params)
 Initialize the TMP00X sensor driver. More...
 
int tmp00x_reset (const tmp00x_t *dev)
 Reset the TMP00X sensor, afterwards it should be reinitialized. More...
 
int tmp00x_set_active (const tmp00x_t *dev)
 Set active mode, this enables periodic measurements. More...
 
int tmp00x_set_standby (const tmp00x_t *dev)
 Set standby mode. More...
 
int tmp00x_read (const tmp00x_t *dev, int16_t *rawv, int16_t *rawt, uint16_t *drdy)
 Read sensor's data. More...
 
void tmp00x_convert (int16_t rawv, int16_t rawt, float *tamb, float *tobj)
 Convert raw sensor values to temperature. More...
 
int tmp00x_read_temperature (const tmp00x_t *dev, int16_t *ta, int16_t *to)
 Convenience function to get ambient and object temperatures in [°C]. More...
 

Conversion rate and AVG sampling configuration

#define TMP00X_CONFIG_CR_AS1   (0x00)
 Conversion Time 0.25s, AVG Samples: 1.
 
#define TMP00X_CONFIG_CR_AS2   (0x01)
 Conversion Time 0.5s, AVG Samples: 2.
 
#define TMP00X_CONFIG_CR_AS4   (0x02)
 Conversion Time 1s, AVG Samples: 4.
 
#define TMP00X_CONFIG_CR_AS8   (0x03)
 Conversion Time 2s, AVG Samples: 8.
 
#define TMP00X_CONFIG_CR_AS16   (0x04)
 Conversion Time 4s, AVG Samples: 16.
 
#define TMP00X_CONFIG_CR_DEF   TMP00X_CONFIG_CR_AS4
 Default for Testing.
 

Constants for TMP00X calibration

#define TMP00X_CCONST_S0   (6.4E-14)
 Calibration Factor.
 
#define TMP00X_CCONST_A1   (1.75E-3)
 Constant $a_{\mathrm{1}}$.
 
#define TMP00X_CCONST_A2   (-1.678E-5)
 Constant $a_{\mathrm{2}}$.
 
#define TMP00X_CCONST_TREF   (298.15)
 Constant $T_{\mathrm{REF}}$.
 
#define TMP00X_CCONST_B0   (-2.94E-5)
 Constant $b_{\mathrm{0}}$.
 
#define TMP00X_CCONST_B1   (-5.7E-7)
 Constant $b_{\mathrm{1}}$.
 
#define TMP00X_CCONST_B2   (4.63E-9)
 Constant $b_{\mathrm{2}}$.
 
#define TMP00X_CCONST_C2   (13.4)
 Constant $c_{\mathrm{2}}$.
 
#define TMP00X_CCONST_LSB_SIZE   (156.25E-9)
 Sensor Voltage Register LSB Size.
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

TMP00X specific return values.

Enumerator
TMP00X_OK 

Success, no error.

TMP00X_ERROR_BUS 

I2C bus error.

TMP00X_ERROR_DEV 

internal device error

TMP00X_ERROR_CONF 

invalid device configuration

TMP00X_ERROR 

general error

Definition at line 206 of file tmp00x.h.

Function Documentation

◆ tmp00x_convert()

void tmp00x_convert ( int16_t  rawv,
int16_t  rawt,
float *  tamb,
float *  tobj 
)

Convert raw sensor values to temperature.

Parameters
[in]rawvobject voltage value
[in]rawtraw die temperature value
[out]tambconverted ambient temperature
[out]tobjconverted object temperature

◆ tmp00x_init()

int tmp00x_init ( tmp00x_t dev,
const tmp00x_params_t params 
)

Initialize the TMP00X sensor driver.

Parameters
[out]devdevice descriptor of sensor to initialize
[in]paramsconfiguration parameters
Returns
0 on success
-TMP00X_ERROR_BUS on I2C bus error
-TMP00X_ERROR_DEV if sensor test failed
-TMP00X_ERROR_CONF if sensor configuration failed

◆ tmp00x_read()

int tmp00x_read ( const tmp00x_t dev,
int16_t *  rawv,
int16_t *  rawt,
uint16_t *  drdy 
)

Read sensor's data.

Parameters
[in]devdevice descriptor of sensor
[out]rawvobject voltage value
[out]rawtraw die temperature
[out]drdydata ready, 0 if a conversion is in progress
Returns
0 on success
-1 on error

◆ tmp00x_read_temperature()

int tmp00x_read_temperature ( const tmp00x_t dev,
int16_t *  ta,
int16_t *  to 
)

Convenience function to get ambient and object temperatures in [°C].

Note
Temperature scaled by x100 for accuracy and avoid floats
Parameters
[in]devdevice descriptor of sensor
[out]taconverted ambient temperature
[out]toconverted object temperature
Returns
TMP00X_OK on success
-TMP00X_ERROR if data read not ready
-TMP00X_ERROR_BUS on I2C error

◆ tmp00x_reset()

int tmp00x_reset ( const tmp00x_t dev)

Reset the TMP00X sensor, afterwards it should be reinitialized.

Parameters
[out]devdevice descriptor of sensor
Returns
0 on success
-1 on error

◆ tmp00x_set_active()

int tmp00x_set_active ( const tmp00x_t dev)

Set active mode, this enables periodic measurements.

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

◆ tmp00x_set_standby()

int tmp00x_set_standby ( const tmp00x_t dev)

Set standby mode.

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