LM75A Temperature Sensor
Contents
LM75 Brief History
For a sensor with a digital interface the LM75 temperature sensor has been around for quite awhile. It was first introduced by National Semiconductor in 1985. National Semiconductor was bought out by Texas Instruments (TI) in 2011. TI still manufacturers this sensor.
Analog Devices Inc (ADI) acquired the LM75A design from National Semiconductor in the early 2000's. From there variants, LM75B and LM75C, emerged that offered a wider temperature and improved accuracy but pin and interface fully compatible.
TI meanwhile has developed a series of replacements that have evolved from the original LM75A design. Some are drop-in replacements such as the TMP1075 while others have the same functionality but with a different pinout such as the TMP110.
NXP Semiconductors are another manufacturer of the LM75A sensor. Interestingly their LM75A version has 11-bit temperature resolution, an improvement over the standard (and original) 9-bit resolution. The NXP chip is often found in breakout boards from the large retailers.
The LM75A, in its various guises, is still a very commonly used sensor.
LM75A Sensor Description

Temperature is measured with a bandgap temperature sensor. This class of sensor relies upon the temperature dependent voltage characteristic of a silicon diode. They are can be more accurate and with better resolution than other measurement systems such as RTDs and thermocouples but don't have the extreme temperature range capability.
The supply voltage for this sensor is 2.7V to 5.5V. Thus it is suitable for both 3.3V and 5V microcontrollers.
The current draw for the LM75A during the measurement cycle depends upon which manufacturer's datasheet is referenced; with a range from 285 µA to 1 mA given. This will reflect whether it is a cycle average (I2C bus idle) or peak current (I2C bus in use).
Sensor Precision and AccuracyThe traditional LM75A produces a 9-bit measurement. This means that it has a resolution of 0.5°C.
The LM75A from NXP Semiconductors has an 11-bit resolution i.e. 0.125°C.
The accuracy (6-sigma) is quoted as:
- ±2°C (-25°C to 100°C)
- ±3°C (-55°C to 125°C)
There are several LM75A (and family) manufacturers, all producing this sensor with slightly different SMT (surface mount technology) packages. TI offer the following options:
- SOIC : 4.90 mm x 3.91 mm
- VSSOP : 3.00 mm x 3.00 mm
The LM75A has 8 pins arranged in two rows of four.

Pin descriptions:
- VS, GND
Positive power pin and Ground pin respectively.
- SDA, SCL
I2C pins; serial data pin and serial clock pin respectively.
- OS
Overtemperature Shutdown; output pin for the sensor's watchdog function.
- A0, A1, A2
i2C address pins; connected independently to either VS or GND to give a choice of eight different I2C addresses. That means that up to eight of these sensors can be connected to the same I2C bus.
LM75A Registers
The LM75A has four registers available to the user:
Address | Register | Description |
---|---|---|
0x00 | Temperature | Read-only 16-bit register with the last °C conversion. |
0x01 | Configuration | Read/Write 8-bit register configures power and watchdog modes. |
0x02 | THYST | Read/Write 16-bit register stores the THYST value. |
0x03 | TOS | Read/Write 16-bit register stores the TOS value. |
The watchdog parameters, THYST and TOS, are discussed below.
The required register address is written by the master via the I2C interface. That register can then be written to or read from.
Unlike many other I2C slaves the register address of the LM75A is not auto-incremented. Multiple reads will always read the same register. This is useful in the case of only the temperature being required and the watchdog functions aren't being used.
Reading Temperature
The LM75A continually takes temperature measurements. There is no ability for the user to initiate one-shot readings. The datasheets state that a conversion takes 100 ms to a maximum of 300 ms to complete. After each conversion the sensor will drop back to a low power state till the next measurement/conversion cycle is internally triggered by the chip.
There is no publicly available information on how many measurements are taken per second.
The temperature data can be requested at any time through the I2C interface. If the sensor is actively doing a conversion when a temperature data request is made the conversion will be put on hold till the data has been sent.
A single byte (0x00) is written to the sensor. Then two bytes (16-bits) are read. The MSB (most significant byte) contains the integer portion of the temperature reading in °C. It is in two's complement format so that a negative value can be possible.
The LSB (least significant byte) contains the decimal portion. Only bit[15] is used[1] where a '1' is 0.5 and a '0' is 0.0 This follows the algorithm known as Q format which is quite commonly used for encoding the decimal portion of a temperature value.
The product datasheet gives several examples that make it very clear how this works. Texas Instruments have published a great guide to using the two's complement and Q format encoding of rational numbers. The publication How to Read and Interpret Digital Temperature Sensor Output Data is available online and well worth a read.
Temperature Watchdog
Many digital temperature-only sensors have a watchdog function. High temperature threshold(s) are set and the watch dog will monitor these upper thresholds against measured temperature and raise an alarm condition if reached or exceeded.
The LM75 raises an over-temperature alarm by changing the state of the chip's OS pin. Whether the pin changes from LOW to HIGH or the other way around depends on the OS Polarity bit (Bit[2]) in the Configuration register:
ModesThere are two watchdog modes; with the mode selected by the value of the Cmp/Int bit (Bit[1]) in the Configuration register.
- Comparator Mode
- Interrupt Mode
There are two temperature setpoints, both configurable by the user:
- TOS : This is the over-temperature setpoint that is monitored with an alarm set if reached or exceeded. The user can set (or read) this value by writing (or reading) to the 16-bit TOS register.
- THYST : If an over-temperature alarm has occurred it is considered active till the temperature has cooled to this setting. The user can set (or read) this value by writing (or reading) to the 16-bit THYST register.
If the LM75A is being used in a 'noisy' (e.g. industrial) environment to monitor the temperature of some equipment or process there may be false alarms issued. The chip offers some protection against this by allowing a faults queue. The number of consecutive over-temperature faults registered before an over-temperature alarm occurs can be configured.
This can be configured to 1, 2, 4 or 6 faults. The Configuration register Bits[7:5] are used for this purpose.
This is just a very brief summary of the watchdog. You are referred to the product's datasheet for full details.
Power Modes
The LM75A has an Active Mode and a Shutdown Mode. The mode is determined by the value of the Shutdown bit (bit[0]) in the Configuration register. Writing a 0 enables Active Mode while writing a 1 forces the sensor into Shutdown Mode.
Shutdown Mode significantly reduces power supply current. No temperature readings are taken so the watchdog is also inactive. The I2C bus is still active, allowing the same read/write access to the sensor's registers as in Active Mode.
LM75A MicroPython Driver for micro:bit
An LM75A MicroPython driver specifically for the micro:bit has been developed as part of this series on MicroPython for the microbit. The driver webpage also provides a detailed description of the driver's methods with sample code.
The driver allows a user to easily connect and control these sensors from a micro:bit.
The LM75A driver is implemented as a class. It's easy for a knowledgeable user to extend the class.
The driver is a full implementation of the LM75A capabilities as described in the product datasheets.