#temperature-sensor #temperature #sensor #i2c-driver #driver #i2c #embedded-hal-driver

no-std lm75

Platform-agnostic Rust driver for the LM75 temperature sensor and thermal watchdog

5 releases (1 stable)

1.0.0 Jan 18, 2024
0.2.0 Sep 2, 2021
0.1.2 Jan 30, 2021
0.1.1 Oct 20, 2018
0.1.0 Oct 19, 2018

#362 in Embedded development

Download history 107/week @ 2023-12-18 76/week @ 2023-12-25 98/week @ 2024-01-01 149/week @ 2024-01-08 246/week @ 2024-01-15 144/week @ 2024-01-22 114/week @ 2024-01-29 101/week @ 2024-02-05 205/week @ 2024-02-12 201/week @ 2024-02-19 250/week @ 2024-02-26 265/week @ 2024-03-04 153/week @ 2024-03-11 172/week @ 2024-03-18 297/week @ 2024-03-25 438/week @ 2024-04-01

1,086 downloads per month
Used in 4 crates


573 lines

Rust LM75 Temperature Sensor and Thermal Watchdog Driver

crates.io Docs Minimum Supported Rust Version Build Status Coverage Status

This is a platform agnostic Rust driver for the LM75 temperature sensor and thermal watchdog, based on the embedded-hal traits.

This driver allows you to:

  • Enable/disable the device.
  • Read the temperature.
  • Set the fault queue.
  • Set the OS temperature.
  • Set the hysteresis temperature.
  • Set the OS operation mode.
  • Set the OS polarity.
  • Set the sample rate of temperature measurements (PCT2075 only)

The device

The LM75 temperature sensor includes a delta-sigma analog-to-digital converter, and a digital overtemperature detector. The host can query the LM75 through its I2C interface to read temperature at any time. The open-drain overtemperature output (OS) sinks current when the programmable temperature limit is exceeded. The OS output operates in either of two modes, comparator or interrupt. The host controls the temperature at which the alarm is asserted (TOS) and the hysteresis temperature below which the alarm condition is not valid (THYST). Also, the LM75's TOS and THYST registers can be read by the host. The address of the LM75 is set with three pins to allow multiple devices to work on the same bus. Power-up is in comparator mode, with defaults of TOS= +80ºC and THYST= +75ºC. The 3.0V to 5.5V supply voltage range, low supply current, and I2C interface make the LM75 ideal for many applications in thermal management and protection.


This driver is also compatible with at least LM75A, LM75B, LM75C, AT30TS75A, DS1775, DS75, DS7505, G751, MAX7500/1/2/3/4, MAX6625, MCP9800/1/2/3, STDS75, TCN75, PCT2075.


Please find additional examples using hardware in this repository: driver-examples

use linux_embedded_hal::I2cdev;
use lm75::{Lm75, Address};

fn main() {
    let dev = I2cdev::new("/dev/i2c-1").unwrap();
    let address = Address::default();
    let mut sensor = Lm75::new(dev, address);
    let temp_celsius = sensor.read_temperature().unwrap();
    println!("Temperature: {}ºC", temp_celsius);


For questions, issues, feature requests and other changes, as well as if you are interested in supporting a similar sensor, please file an issue in the github project.

Minimum Supported Rust Version (MSRV)

This crate is guaranteed to compile on stable Rust 1.62 and up. It might compile with older versions but that may change in any new patch release.

The MSRV will not be updated in any patch release.


Licensed under either of

at your option.


Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.