The LM75 is the de facto standard temperature sensor with an I2C connection. Of the seven bits of its address only the upper four are fixed (at 1001); the other three bits can be set using external circuitry. Up to eight LM75s can therefore be connected to a single I2C bus, with addresses ranging from 0x48 to 0x4F. So if, for example, LM75s are to be used in a temperature monitoring application in a desktop PC, it is possible to measure the temperature at up to eight different places within the case.
Internally the LM75 has four registers, which are addressed using two bits (see Figure 1):
• 00H: a 16-bit temperature register, which can only be read from;
• 01H: an 8-bit configuration register;
• 02H: a 16-bit hysteresis register;
• 03H: a 16-bit threshold register.
At power up the temperature register is selected by default, but even if that is the only register you wish to access it is always a good idea to write the register’s address before reading it. When writing to a register the address must be given: the first byte after the write command is always interpreted by the LM75 as a register number.
After the register number come the data. In the case of a 16-bit register the more significant byte is transferred first, followed by the less significant byte.
In contrast to some other I2C devices the LM75 does not automatically increment the register number after each access: the register pointer remains fixed. If there is only one bus master and only the temperature reading is of interest, it is therefore unnecessary to reset the register pointer to zero before each access. All you need to do in the read operation is simply transfer the two data bytes representing the temperature. The accuracy of the LM75 does leave a little to be desired. According to the datasheet the reading can be in error by up to 2 °C. However, there are alternative devices, such as the TMP275, which are more accurate and in general protocol- and register-compatible with the LM75.
The LM75 is also rather sensitive to interference on its power supply lines. To avoid collecting garbage instead of temperature readings, it is wise to stick to the ‘one 100 nF capacitor per package’ rule of thumb.