Parts: I2C digital thermometer (TC74)

Microchip’s TC74 is an inexpensive digital temperature sensor with a simple I2C interface. It has a resolution of 1 degree Celsius, and a range of -40 to +125 degrees. This is an easy way to add temperature measurement to a project without an analog to digital converter. We’ll show you how to use the TC74 below.

The TC74 comes in five pin through-hole and surface mount packages, see the TC74 datasheet (PDF). We couldn’t find a Cadsoft Eagle footprint for any version of this part, if you know of one please link to it in the comments.

Different versions of the TC74 are calibrated for specific voltages, but all work from 2.7-5volts. The TC74A5 we used is most accurate when operating at 5volts, but we powered it from a 3.3volt supply. The I2C connection needs 2 pull-up resistors to hold the bus high (R1, R2), 2K-10K should work. C1 is a 0.1uF decoupling capacitor.

We used the Bus Pirate universal serial interface in I2C mode to test drive the TC74, but the same principals apply to any microcontroller. We powered the TC74 from the Bus Pirate’s 3.3volt supply, and used the on-board pull-up resistors to hold the I2C bus high.

Bit 6 of the configuration register is 0 at power-on, and changes to 1 when the first valid temperature reading is available. Bit 7 is writable, and puts the TC74 in a power saving standby mode. Reading the register involves two steps: use a partial write command to select the register, then use the read command to retrieve the value.

First, we select the configuration register with a partial write command. This doesn’t actually write a value, it selects the register to read and write. { creates the I2C start condition, followed by the TC74 write address (0x9a) and the select configuration register command (0x01). } issues the I2C stop condition and ends the transaction.

The read address (0x9b) returns the one byte register value (r). The configuration register value, 0x40 or 01000000, shows that the device is out of standby (bit 7=0), and a valid temperature reading is available (bit 6=1).

The TC74 has a low-power standby mode. Enable it by writing 1 to bit 7 of the configuration register.

The register is written with single three-byte command. First we send the write address (0x9a), followed by the register to select (0x01), and finally the value to write (0x80). Only bit 7 of the configuration register is writable, the values of bits 6-0 are ignored.

The temperature is an integer value of degrees Celsius, negative numbers are represented as a twos complement. Positive values from 0 to 127 degrees Celsius are simply represented by that value. Negative temperatures have bit 7 set, and range from -1 to -65 (255-128), see table 4.4 on page 8 of the datasheet. The hexadecimal value 0x18 is equal to 24 in decimal, so the temperature reading is 24C (75F).

> It says “A 0.1uF capacitor (C1) decouples the chip
> from the power supply.” What does “decouples”
> mean in that sentence and why is the capacitor on
> the ground side and not the vcc side?

Looks like C1 connects to both Pin 5, which is 3.3V and to GND. ‘Decouples’ means to basically provide some power protection against RF pickup – RF will go through the cap to ground, leaving the DC clean.

The component variety and quality of these posts is astounding. Short and sweet. I’m hoping to see some more complex devices requiring longer tutorials such as the DS28EA00 (1wire temp sensor with I/o pins) or perhaps one of the new Dallas RTC’s with 4Kbytes or more of NVRAM. What is already posted is pure gold.

ds1621+ from maxim is a temp sensor with i2c interface and has better resolution than this one. Without much effort, you can easily get .5°C resolution from this ic. only downside i guess is the package

is there any way of changing the address of the sensor? I would like to have more then one on a I2C bus. I can order small qualities of TC74 with address 9a but have to order 350 to get any of the other addresses.

“is there any way of changing the address of the sensor? I would like to have more then one on a I2C bus.”
Nope. Unfortunately not. I think this catches a lot of people out but I can buy them in single units thankfully :)

From the TC74 Manual: ” Eight SMBus/I2C addresses are programmable for the TC74, which allows for a multi-sensor configuration. ” This suggests that the TC74 has eight programmable addresses. Like Jim said above, its near on impossible to get individually coded packages without ordering some serious numbers, so if you want multiple sensors on the same channel you need to program. I’ve scoured the internet for guides on how to program this chip, but there appears to be nothing out there. This is by far the most comprehensive guide but still to access to change the address.