Arduino

Arduino Wiring

You can easily wire this sensor to any microcontroller, we'll be using an Arduino
  • Connect Vdd to the power supply, 3V or 5V is fine. Use the same voltage that the microcontroller logic is based off of. For most Arduinos, that is 5V
  • Connect GND to common power/data ground
  • Connect the SCL pin to the I2C clock SCL pin on your Arduino. On an UNO & '328 based Arduino, this is also known as A5, on a Mega it is also known as digital 21 and on a Leonardo/Micro, digital 3
  • Connect the SDA pin to the I2C data SDA pin on your Arduino. On an UNO & '328 based Arduino, this is also known as A4, on a Mega it is also known as digital 20 and on a Leonardo/Micro, digital 2
The TMP007 has a default I2C address of 0x40 but you can set the address to any of 8 values between 0x40 and 0x47 so you can have up to 8 of these sensors all sharing the same SCL/SDA pins.

Download Adafruit_TMP007

To begin reading sensor data, you will need to download Adafruit_TMP007 from our github repository. You can do that by visiting the github repo and manually downloading or, easier, just click this button to download the zip
Rename the uncompressed folder Adafruit_TMP007 and check that the Adafruit_TMP007 folder contains Adafruit_TMP007.cpp and Adafruit_TMP007.h

Place the Adafruit_TMP007 library folder your arduinosketchfolder/libraries/ folder.
You may need to create the libraries subfolder if its your first library. Restart the IDE.

We also have a great tutorial on Arduino library installation at:
http://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use

Load Demo

Open up File->Examples->Adafruit_TMP007->tmp007 and upload to your Arduino wired up to the sensor
Thats it! Now open up the serial terminal window at 9600 speed to see the temperature in real time. You can try putting your hand or a cold glass of water over the sensor (not touching) to see the thermopile sensor adjust!
Library Reference
The TMP007 library is pretty straight forward! Start by creating the Adafruit_TMP007 object with:
Download: file
Adafruit_TMP007 tmp007;
Or with an i2c address assigned
Download: file
Adafruit_TMP007 tmp007(0x41);  // start with a diferent i2c address!
Then you can initialize & configure
Download: file
tmp007.begin()
or, to set the samples/reading with:
Download: file
tmp007.begin(TMP007_CFG_1SAMPLE)
We suggest the default, 16 samples for best accuracy. begin() will return true or false based on whether it found the sensor, check it using an if statment like so:
Download: file
  if (! tmp007.begin()) {
    Serial.println("No sensor found");
    while (1);
  }
Now you can read the Die temperature (the temperature of the physical sensor itself) and Object temperature (the temperature of the stuff in front of the sensor)
Download: file
tmp007.readObjTempC();
tmp007.readDieTempC();
The readings are floating point values, in degrees C.

Then wait 4 seconds between readings to get a new reading!
Download: file
delay(4000); // 4 seconds per reading for 16 samples per reading
This guide was first published on Aug 05, 2014. It was last updated on Aug 05, 2014. This page (Arduino) was last updated on Jun 16, 2019.