Platform agnostic Rust driver for the TMP006/TMP006B non-contact infrared (IR) thermopile temperature sensor, based on the embedded-hal traits.
This is a platform agnostic Rust driver for the TMP006/TMP006B non-contact
infrared (IR) thermopile temperature sensor, based on theembedded-hal
traits.
This driver allows you to:
enable()
.read_object_temperature()
.read_sensor_data()
.calculate_object_temperature()
.set_conversion_rate()
.enable_drdy_pin()
.is_data_ready()
.reset()
.read_manufacturer_id()
.read_device_id()
.The TMP006 and TMP006B are the first in a series of temperature sensors
that measure the temperature of an object without the need to make contact
with the object. This sensor uses a thermopile to absorb the infrared
energy emitted from the object being measured and uses the corresponding
change in thermopile voltage to determine the object temperature.
Infrared sensor voltage range is specified from -40°C to +125°C to enable
use in a wide range of applications. Low power consumption along with low
operating voltage makes the device suitable for battery-powered
applications. The low package height of the chip-scale format enables
standard high- volume assembly methods, and can be useful where limited
spacing to the object being measured is available.
Datasheet:
To use this driver, import this crate and an embedded_hal
implementation,
then instantiate the device.
Please find additional examples in this repository: driver-examples
use linux_embedded_hal::I2cdev;
use nb::block;
use tmp006::{SlaveAddr, Tmp006};
fn main() {
let dev = I2cdev::new("/dev/i2c-1").unwrap();
let address = SlaveAddr::default();
let mut sensor = Tmp006::new(dev, address);
let calibration_factor = 6e-14;
let temperature = block!(sensor
.read_object_temperature(calibration_factor))
.unwrap();
println!("Temperature: {}K", temperature);
}
For questions, issues, feature requests, and other changes, please file an
issue in the github project.
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.