Expand description
The TMP102 device is a digital temperature sensor designed for NTC/PTC thermistor replacement where high accuracy is required. The device offers an accuracy of ±0.5°C without requiring calibration or external component signal conditioning. Device temperature sensors are highly linear and do not require complex calculations or lookup tables to derive the temperature. The on-chip 12-bit ADC offers resolutions down to 0.0625°C.
§Usage (sync)
use embedded_devices::devices::texas_instruments::tmp102::{TMP102Sync, address::Address, registers::Temperature};
use embedded_devices::sensor::OneshotSensorSync;
use uom::si::thermodynamic_temperature::degree_celsius;
// Create and initialize the device. Default conversion mode is continuous.
let mut tmp102 = TMP102Sync::new_i2c(delay, i2c, Address::Gnd);
// Read the latest temperature conversion in °C
let temp = tmp102
.read_temperature()?
.get::<degree_celsius>();
println!("Current temperature: {:?}°C", temp);
// Perform a one-shot measurement now and return to sleep afterwards.
let temp = tmp102.measure()?
.temperature.get::<degree_celsius>();
println!("Oneshot temperature: {:?}°C", temp);§Usage (async)
use embedded_devices::devices::texas_instruments::tmp102::{TMP102Async, address::Address, registers::Temperature};
use embedded_devices::sensor::OneshotSensorAsync;
use uom::si::thermodynamic_temperature::degree_celsius;
// Create and initialize the device. Default conversion mode is continuous.
let mut tmp102 = TMP102Async::new_i2c(delay, i2c, Address::Gnd);
// Read the latest temperature conversion in °C
let temp = tmp102
.read_temperature().await?
.get::<degree_celsius>();
println!("Current temperature: {:?}°C", temp);
// Perform a one-shot measurement now and return to sleep afterwards.
let temp = tmp102.measure().await?
.temperature.get::<degree_celsius>();
println!("Oneshot temperature: {:?}°C", temp);Modules§
Structs§
- Measurement
- Measurement data
- TMP102
Async - The TMP102 is a general purpose digital temperature sensor. It provides a 13-bit temperature result with a resolution of 0.0625 °C and an accuracy of up to ±3 °C across the temperature range of –40 °C to 125 °C with no calibration.
- TMP102
Sync - The TMP102 is a general purpose digital temperature sensor. It provides a 13-bit temperature result with a resolution of 0.0625 °C and an accuracy of up to ±3 °C across the temperature range of –40 °C to 125 °C with no calibration.