The TMP102 is a very simple, yet accurate, ambient temperature sensor which is capable of detecting .0625ºC changes between -25 and +85°C, with an accuracy of 0.5°C. And the real kicker… It does all of this while only consuming 10µA (10 millionths of an amp). The thing is quite tiny, so SparkFun has put it on a breakout board to make things easier.
Naturally, you probably already ordered a few of these for your room-to-room sensor-network to prove to your landlord that the heat is dropping below the agreed temperature. Wait… That’s just me? You just want to know how to hook one up to your Arduino? Ok… I can help with that.
The TMP102 is an I2C device, so when we are done with it, it will actually tell you the temperature, not send an analog signal that you then need to interpret. But that also means it is a little harder (code-wise) than just using an ADC and reading an analog voltage. But, in return for the added complexity, It is also more accurate then any analog reading the Arduino is capable of. So, if you actually care what the ambient temperature is, and not just checking to see if the temperature has changed, this is your guy. I say ambient temperature because it would be a little hard to connect this to anything, and it doesn’t support a thermocouple.
For this, and all other I2C devices connected to your arduino, all you need to know is that I2C is a 2-wire serial connection, SDA (Data) and SCL (Clock) – On your Arduino (everything but the mega) SDA is on analog pin 4, and SCL is on analog pin 5. On an arduino mega, SDA is digital 20, and SCL is digital 21. Like most I2C devices, when communicating with one on an Arduino, we will be using the Wire library to do so.
The sensor has an address pin (ADD0) that is used to change the address the sensor is located at. This is useful if you need more than one of these hooked up to one Arduino, you can still call them independently even on the same bus. We are grounding this pin so that the sensor will use the address of 72 (0x48 in hex). Connecting this pin to V+ (3.3v on the arduino) would set the address to 73 (0x49 in hex), and you would just need to change that address at the top of the code ( int tmp102Address = 0x49; ).
For more detail: How’s the weather? TMP102 + Arduino