Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

How to Use 16304-SparkFun_Qwiic_TMP102_Digital_Temp_Sensor: Examples, Pinouts, and Specs

Image of 16304-SparkFun_Qwiic_TMP102_Digital_Temp_SensorDesign with 16304-SparkFun_Qwiic_TMP102_Digital_Temp_Sensor in Cirkit Designer

Introduction

The 16304-SparkFun Qwiic TMP102 Digital Temp Sensor is a high-precision digital temperature sensor designed for easy integration into projects and products. Utilizing the TMP102 sensor chip, this breakout board is ideal for environmental temperature sensing for home automation, industrial systems, and weather stations. Its Qwiic connector system enables quick, solderless connection to other Qwiic-compatible devices, making it a convenient choice for rapid prototyping and educational purposes.

Explore Projects Built with 16304-SparkFun_Qwiic_TMP102_Digital_Temp_Sensor

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of ESP8266 NodeMCU with DS18B20 Temperature Sensor Monitoring: A project utilizing 16304-SparkFun_Qwiic_TMP102_Digital_Temp_Sensor in a practical application
ESP8266 NodeMCU with DS18B20 Temperature Sensor Monitoring

This circuit features an ESP8266 NodeMCU microcontroller connected to a DS18B20 temperature sensor. The sensor's data line (DQ) is connected to the D2 pin of the NodeMCU through a 4.7k ohm pull-up resistor, which is a common configuration for one-wire temperature sensors. The sensor is powered by the 3.3V supply from the NodeMCU, and both the sensor and the NodeMCU share a common ground.

Open Project in Cirkit Designer
Image of ESP32-Based Infrared Thermometer with I2C LCD Display: A project utilizing 16304-SparkFun_Qwiic_TMP102_Digital_Temp_Sensor in a practical application
ESP32-Based Infrared Thermometer with I2C LCD Display

This circuit features an ESP32 microcontroller interfaced with an MLX90614 infrared temperature sensor and a 16x2 I2C LCD display for temperature readouts. A tactile button is connected to the ESP32 to trigger temperature measurements, and an LED indicates when a measurement is in progress. The circuit is powered by an 18650 Li-Ion battery, with appropriate resistors for LED current limiting and button debouncing.

Open Project in Cirkit Designer

Common Applications and Use Cases

Technical Specifications

Key Technical Details

Pin Configuration and Descriptions

Pin Number Name Description
1 GND Ground connection
2 VCC Power supply (1.4V to 3.6V)
3 SDA I2C Data line
4 SCL I2C Clock line
5 ADD0 Address select pin
6 ALRT Alert pin

Usage Instructions

How to Use the Component in a Circuit

  1. Powering the Sensor: Connect the VCC pin to a power supply within the range of 1.4V to 3.6V and the GND pin to the ground of your system.
  2. I2C Communication: Connect the SDA and SCL pins to your microcontroller's I2C data and clock lines, respectively.
  3. Address Selection: If multiple TMP102 sensors are used on the same I2C bus, configure the ADD0 pin to set different addresses.
  4. Alert Functionality: The ALRT pin can be used as an interrupt or comparator output for temperature threshold events.

Important Considerations and Best Practices

Example Code for Arduino UNO

#include <Wire.h>

// TMP102 I2C address is 0x48 (default)
#define Addr 0x48

void setup() {
  // Initialise I2C communication as MASTER
  Wire.begin();
  // Initialise serial communication, set baud rate = 9600
  Serial.begin(9600);
  
  // Start I2C Transmission
  Wire.beginTransmission(Addr);
  // Select configuration register
  Wire.write(0x01);
  // Set continuous conversion mode, 12-bit resolution
  Wire.write(0x60);
  // Stop I2C Transmission
  Wire.endTransmission();
  delay(300);
}

void loop() {
  unsigned int data[2];

  // Start I2C Transmission
  Wire.beginTransmission(Addr);
  // Select data register
  Wire.write(0x00);
  // Stop I2C Transmission
  Wire.endTransmission();

  // Request 2 bytes of data
  Wire.requestFrom(Addr, 2);

  // Read 2 bytes of data
  // temp msb, temp lsb
  if (Wire.available() == 2) {
    data[0] = Wire.read();
    data[1] = Wire.read();
  }

  // Convert the data to 12-bits
  int temp = ((data[0] * 256) + (data[1] & 0xF0)) / 16;
  if (temp > 2047) {
    temp -= 4096;
  }
  float celsius = temp * 0.0625;
  float fahrenheit = (celsius * 1.8) + 32;

  // Output data to serial monitor
  Serial.print("Temperature in Celsius: ");
  Serial.print(celsius);
  Serial.println(" C");
  Serial.print("Temperature in Fahrenheit: ");
  Serial.print(fahrenheit);
  Serial.println(" F");

  delay(500);
}

Troubleshooting and FAQs

Common Issues Users Might Face

Solutions and Tips for Troubleshooting

FAQs

Q: Can the sensor be used with a 5V system? A: While the sensor operates at 1.4V to 3.6V, level shifters can be used for interfacing with a 5V system.

Q: How can I change the I2C address of the sensor? A: The I2C address can be changed by connecting the ADD0 pin to GND, VCC, SDA, or SCL, corresponding to addresses 0x48, 0x49, 0x4A, or 0x4B, respectively.

Q: What is the maximum distance for the I2C bus? A: I2C is typically used for short distances, but with proper bus buffering and termination, longer distances can be achieved. Keep the lines as short as possible for reliable communication.