TMP006 IR Temperature Sensor


In this project Survy and I interfaced the mbed micro controller with the new TMP006 IR Temperature Sensor. You will only need the sensor, the mbed, and a few jumper wires to get it working. From


"The TMP006 Breakout can measure the temperature of an object without making contact with it. By using a thermopile to detect and absorb the infrared energy an object is emitting, the TMP006 Breakout can determine how hot or cold the object is.

The TMP006 Breakout has a wide temperature detection range of -40°C to 125°C and an optimal operating voltage of 3.3V to 5V (tolerant up to 7V max). This breakout works great with most micro controllers connecting via the I2C bus."

The sensor uses a thermopile to take in infrared radiating from the object and uses these changes to determine the object's temperature.



The Schematic

Since the TMP006 uses I2C communications, you can use two sets of pins on the mbed.

  • p9 & p10
  • p27 & p28

The TMP006 also has the ability to chain up to eight sensors. The ADDR0 and ADDR1 pins are used for this purpose. For this demo, we will only use one sensor, so these two pins will be grounded.



The Code

The main.cpp code below is an easy demo to read the current temperature and display it on the console.


#include "mbed.h"
#include "TMP006.h"

#define Address 0x80 
TMP006 sensor(p9, p10, Address); 
int main()
  while(1) {
    printf("Temperature: %f \r \n", sensor.readObjTempC(Address));

Below are the libraries.

Import libraryTMP006_lib

These are the methods to interface the TMP006 sensor with the mbed controller.

Public Member Functions

voidconfig(uint8_t addr, uint16_t samples)Configures sensor, use before reading from it
int16_treadRawDieTemperature(uint8_t addr)Read raw sensor temperature
int16_treadRawVoltage(uint8_t addr)Read raw thermopile voltage
doublereadObjTempC(uint8_t addr)Calculate object temperature (C) based on raw sensor temp and thermopile voltage
doublereadObjTempF(uint8_t addr)Calculate object temperature (F) based on raw sensor temp and thermopile voltage
doublereadDieTempC(uint8_t addr)Caculate sensor temperature (C) based on raw reading
doublereadDieTempF(uint8_t addr)Caculate sensor temperature (F) based on raw reading

Here is a quick video of the output of the sample program. link here if video does not show


  • If you have trouble communicating with the sensor, try this: The I2C documentation originally said for us to use 0x40 as our I2C address. We later found out that the address needs to be shifted once to the left, making it 0x80.

2 comments on TMP006 IR Temperature Sensor:

13 Oct 2014

i2c address of TMP006 (with adr1, adr2 shorted to gnd) should be 0x40. but that's the upper 7-bit of a byte, the last bit indicates read/write. the way mbed handles i2c address byte is confusing.

It takes 8-bit address byte, and automatically set the last bit as 0 or 1 depending on read/write. That's why TMP006 address 0x40 becomes 0x80.

21 Mar 2016

Hi What is the maximum distance measuring the temperature of a planar object such as a wall.

Christian Dupaty

Please log in to post comments.