Read IR Temperature Sensor

Some of the module development boards like the LaunchPad BoosterPack incorporate an external infrared (IR) temperature sensor. This sensor uses a thermopile to absorb the infrared energy emitted from the object being measured and uses the corresponding change in thermopile voltage to determine the object temperature. It also measures the ambient (air) temperature.

Note that due to the amount of floating point math required, this example does NOT fit in the 4kB code size limited version of IAR compiler.

Measuring Ambient Temperature
In addition to measuring the temperature of an object, the IR Temperature sensor can measure the ambient air temperature. While many micro-controllers have an internal temperature sensor, that sensor usually needs to be calibrated prior to use whereas external temperature sensors do not. The external temperature sensor IC (refer to module development board documentation for exact part number) connects to the micro-controller via I2C and continually measures the temperature. The micro-controller periodically retrieves the temperature from temperature sensor over the I2C inteface. Note that if the temperature sensor is on the same PCB as an IC that generates heat (like a micro-controller or RF module) then the measured temperature will be slightly higher than ambient.

Measuring Object Temperature
As we mentioned above, the sensor measures the amount of infrared energy emitted from the object, as well as the ambient air temperature. The sensor does not directly output the object temperature, this needs to be computed through some fancy math. This could also be implemented in a lookup table instead.

Under the Hood
In the code, to use the temperature sensor we need to first call tmp006Init to initialize the I2C interface. To read both temperatures (ambient and object) we call tmp006getTemp which does the following:
 * 1) Initialize the I2C bus. Needed since we share the bus amongst multiple peripherals
 * 2) Read object voltage via I2C
 * 3) Read ambient temperature via I2C
 * 4) Use both and some fancy math to compute the temperature of the object.

The "fancy math" is in the private method tmp006CalculateTemp.



For more information, see Read IR Temperature Sensor Logic Analyzer Trace.

Next Example: Timer Interrupt

Previous: Read Supply Voltage

Top: Module_Examples

