Part

Temperature sensor, TMP117

A 0.1 degree class thermometer over I2C, 7.8125 m°C a count, with averaging, one-shot and an ALERT pin.

See every part
  • 6 pins
  • 1 setting
  • In 1 project
Drawn live by the editor's own code, at the size you see it.
At a glance

The Temperature sensor, TMP117 in brief

What it is, and every setting the properties panel gives it.

The TMP117 is Texas Instruments’ precision digital thermometer, rated to a tenth of a degree, on an I2C breakout with pull-ups and a pulled-down ADD0 pad. It reports temperature as a signed 16-bit count of 7.8125 thousandths of a degree, can average up to 64 samples per result, can convert once and sleep, and has an ALERT pin for limits or for a fresh result. ADD0 picks one of four addresses, 0x48 to 0x4B, depending on whether it goes to ground, VIN, SDA or SCL. In Mokxi a slider sets the temperature from -55 to 150 °C. The model keeps the real power-up quirk, a reading of -256 °C until the first conversion is done, the conversion cycle that gives one result a second by default, the alert and therm modes, the offset register and the EEPROM that brings settings back after a reset. It does not add noise, so the reading is the slider rounded to the chip’s step.

Family
Sensors
Pins
6
temperature
22.5
Pins

6 pins

Named as the editor names them, so a wire lands where you expect it.

Pin
What it does
VIN
Supply, 3 to 5 V on the boards.
GND
Ground.
SCL
I2C, with 10k pull-ups on the board.
SDA
I2C, with 10k pull-ups on the board.
ALERT
Open drain, pulled up on the board: the alert flags, or Data_Ready. Active low unless POL is set.
ADD0
The address strap, pulled down on the board.
How to use it

How to use the TMP117 thermometer with an Arduino

The breakout needs four wires: VIN to 5 V, GND to GND, SDA to SDA and SCL to SCL (on an Uno those header pins are the same as A4 and A5). With ADD0 left unwired the board’s pull-down holds it low and the chip answers at 0x48. In the built-in project a VEML7700 light sensor shares the bus at 0x10, and the sketch prints both every second.

Adafruit’s library does the waiting for you. tmp117.begin() looks for the chip at 0x48, and tmp117.getEvent(&temp) blocks until a new result is ready and fills temp.temperature in degrees Celsius. Move the temperature slider while it runs and the next printed value follows, to two decimal places.

The project’s comment suggests a test worth doing: wire ADD0 to VIN. The chip moves to 0x49, begin() finds nothing at 0x48, and the sketch reports it. That is the same check to run when a real board will not answer.

Part pin
Board pin
VIN
5 V
GND
GND
SDA
SDA (A4)
SCL
SCL (A5)
ADD0
Not wired: address 0x48
ALERT
Not wired

The breakout takes 3 to 5 V, so it runs unchanged from an ESP32’s or a Pico’s 3.3 V pin. SparkFun’s TMP117 library compiles here too, if your code was written for that.

Arduino Uno: TMP117 and VEML7700 on one buslive0.000 s 0.00x
Click to open it in the editor
This is the simulator itself, running here. Click anything to open it in the editor.
One reading, from the temperature and light sketch
#include <Adafruit_TMP117.h>

Adafruit_TMP117 tmp117;

void setup() {
  Serial.begin(9600);
  if (!tmp117.begin()) {
    Serial.println("No TMP117 at 0x48");
    while (1) {}
  }
}

void loop() {
  sensors_event_t temp;
  tmp117.getEvent(&temp);   // waits for a new result
  Serial.println(temp.temperature, 2);
}
Common errors

Common Temperature sensor, TMP117 errors and fixes

What goes wrong
The fix
The first reading after power-up is -256 °C.
That is the result register’s power-on value, 0x8000, before any conversion has finished. Wait for Data_Ready, which getEvent() already does, instead of reading the register at once.
begin() fails although the wiring looks right.
Check where ADD0 goes. To VIN the chip is at 0x49, to SDA 0x4A and to SCL 0x4B. Pass that address to begin(), or run an I2C scanner to see it.
An alert seems to vanish before your code sees it.
Reading the configuration register clears both the alert flags and Data_Ready. Read it in one place and keep what it told you.
The value only changes once a second.
That is the default cycle at power-up. Shorten the conversion setting or the averaging if you need results more often.
Questions

Questions and answers

How accurate is the TMP117?

The real chip is specified to within 0.1 °C over a wide range. In the simulator the reading is exactly the slider, rounded to 7.8125 thousandths of a degree, with no error or noise added.

How many TMP117 sensors can share one I2C bus?

Four, one at each address from 0x48 to 0x4B, set by wiring ADD0 to GND, VIN, SDA or SCL.

Can the TMP117 store its settings?

Yes. With the EEPROM unlocked, the configuration, limits and offset are written to it and come back after a reset. Each write keeps the chip busy for 7 ms.

What does the ALERT pin do?

It goes low when a result passes the high or low limit, or, if you set it to, each time a new result is ready. On the breakout it already has a pull-up.

How it is modeled

What is true about the Temperature sensor, TMP117, here

In its help article’s own words: what the simulation gets right, and where it stops.

Modeled

The registers. Sixteen bits, high byte first, through a pointer: the result (0x00, two's complement, 7.8125 m°C a count), the configuration (0x01), the high and low limits (0x02, 0x03), the EEPROM unlock (0x04), EEPROM1 to EEPROM3 (0x05, 0x06, 0x08), the offset (0x07, added to every result) and the device ID, 0x0117 (0x0F).

Power-on. The result reads 0x8000, -256 °C, until the first conversion ends.

The conversion cycle. Each conversion averages 1, 8, 32 or 64 samples of 15.5 ms. In continuous mode a result lands at the end of the averaging and the cycle lasts the longer of the CONV setting (15.5 ms to 16 s) and the averaging's minimum, as the datasheet's table lists: one a second at power-on. One-shot converts once and shuts down. Data_Ready is set with each result and cleared by reading the result or the configuration.

The alerts. In alert mode a result above the high limit or below the low one latches its flag until the configuration is read. In therm mode the high flag sets above the high limit and clears below the low one. ALERT follows the flags, or Data_Ready with DR/Alert set.

Reset and the EEPROM. Soft_Reset reloads the power-on settings after 2 ms. With the EEPROM unlocked, writes to the configuration, the limits, the offset and EEPROM1 to EEPROM3 are programmed into it (busy for 7 ms) and come back after a reset.

Not modeled

The accuracy: the result is the slider exactly, rounded to 7.8125 m°C, with no noise to average away, where the real part is within 0.1 °C. The general-call reset, the SMBus alert-response address and the supply current are not modeled either.

From TMP117 temperature sensor, in full.

Projects

See the Temperature sensor, TMP117 in a project

One built-in project uses it. It opens in the editor, already wired.

Boards

The boards it is shown on

This board has a built-in project with the Temperature sensor, TMP117 in it.

Libraries

Arduino libraries for the Temperature sensor, TMP117

Built in, so the sketch compiles with nothing to install. Each page has the calls, the wiring and an example to run.

Wire up the Temperature sensor, TMP117

Open the editor and push it into the breadboard. It is free, and it runs on your own machine.