

The TMP102 is a high-accuracy digital temperature sensor that communicates via the I2C interface. It provides precise temperature readings with a resolution of 0.0625°C and operates with low power consumption, making it ideal for battery-powered applications. The TMP102 is commonly used in environmental monitoring, HVAC systems, industrial temperature control, and IoT devices.








| Pin Name | Pin Number | Description |
|---|---|---|
| VCC | 1 | Power supply input (1.4V to 3.6V). |
| GND | 2 | Ground connection. |
| SDA | 3 | I2C data line. |
| SCL | 4 | I2C clock line. |
| ADD0 | 5 | Address pin to configure I2C address. |
| ALERT | 6 | Open-drain output for temperature alert. |
Below is an example of how to use the TMP102 with an Arduino UNO to read temperature data:
#include <Wire.h> // Include the Wire library for I2C communication
#define TMP102_ADDRESS 0x48 // Default I2C address of TMP102
void setup() {
Wire.begin(); // Initialize I2C communication
Serial.begin(9600); // Start serial communication for debugging
Serial.println("TMP102 Temperature Sensor Example");
}
void loop() {
float temperature = readTemperature(); // Read temperature from TMP102
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.println(" °C");
delay(1000); // Wait 1 second before reading again
}
float readTemperature() {
Wire.beginTransmission(TMP102_ADDRESS); // Start communication with TMP102
Wire.write(0x00); // Point to the temperature register
Wire.endTransmission();
Wire.requestFrom(TMP102_ADDRESS, 2); // Request 2 bytes of data
if (Wire.available() == 2) {
// Read the two bytes from the TMP102
byte msb = Wire.read(); // Most significant byte
byte lsb = Wire.read(); // Least significant byte
// Combine the bytes and calculate the temperature
int16_t rawTemperature = ((msb << 8) | lsb) >> 4;
float temperature = rawTemperature * 0.0625; // Convert to Celsius
return temperature;
} else {
Serial.println("Error: No data received from TMP102");
return NAN; // Return Not-a-Number if no data is received
}
}
No Data Received from TMP102
Incorrect Temperature Readings
I2C Communication Errors
ALERT Pin Not Functioning
Q: Can the TMP102 be used with a 5V microcontroller like Arduino UNO?
A: Yes, but you must use a logic level shifter or ensure that the I2C lines (SDA and SCL) are pulled up to 3.3V instead of 5V. The TMP102 itself should be powered with a voltage between 1.4V and 3.6V.
Q: How do I change the I2C address of the TMP102?
A: Use the ADD0 pin to configure the address. Connect it to GND, VCC, SDA, or leave it floating to select one of the four possible addresses (0x48, 0x49, 0x4A, or 0x4B).
Q: What is the maximum cable length for I2C communication with the TMP102?
A: The maximum cable length depends on the pull-up resistor values and the I2C clock speed. For typical setups, keep the cable length under 1 meter to ensure reliable communication.
Q: Can the TMP102 measure negative temperatures?
A: Yes, the TMP102 can measure temperatures as low as -40°C. Negative temperatures are represented in two's complement format in the temperature register.