[][src]Crate mlx9061x

This is a platform agnostic Rust driver for the MLX90614/MLX90615 infrared thermometers using the embedded-hal traits.

This driver allows you to:

The devices

The MLX90614/MLX90615 are a infrared thermometers for non-contact temperature measurements. Both the IR sensitive thermopile detector chip and the signal conditioning ASSP are integrated in the same TO-39/TO-46 can. Thanks to its low noise amplifier, 17-bit/16-bit ADC and powerful DSP unit, a high accuracy and resolution of the thermometer is achieved.

Depending on the MLX90614 model they feature a single-zone or dual-zone thermopile.

The chips feature an 10-bit PWM and SMBus interface.

The readout resolution is 0.01°C (MLX90614) / 0.02°C (MLX90615).

This driver uses the SMBus interface.

Documentation:

Usage examples (see also examples folder)

To use this driver, import this crate and an embedded_hal implementation, then instantiate the device.

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

Read the object 1 temperature with an MLX90614

Some models feature single-zone or dual-zone thermopiles.

use linux_embedded_hal::I2cdev;
use mlx9061x::{Mlx9061x, SlaveAddr};

let dev = I2cdev::new("/dev/i2c-1").unwrap();
let addr = SlaveAddr::default();
let mut sensor = Mlx9061x::new_mlx90614(dev, addr, 5).unwrap();
let obj_temp = sensor.object1_temperature().unwrap_or(-1.0);
println!("Object temperature: {:.2}ºC", obj_temp);

Read the ambient temperature with an MLX90615

let addr = SlaveAddr::default();
let mut sensor = Mlx9061x::new_mlx90615(dev, addr, 5).unwrap();
let temp = sensor.ambient_temperature().unwrap_or(-1.0);
println!("Ambient temperature: {:.2}ºC", temp);

Get the device ID of an MLX90614

let mut sensor = Mlx9061x::new_mlx90614(dev, addr, 5).unwrap();
let id = sensor.device_id().unwrap_or(0);
println!("ID: 0x{:x?}", id);

Set the emissivity

This change will be permanently stored in the device EEPROM.

use linux_embedded_hal::{I2cdev, Delay};
use mlx9061x::{Mlx9061x, SlaveAddr};

let dev = I2cdev::new("/dev/i2c-1").unwrap();
let addr = SlaveAddr::default();
let mut sensor = Mlx9061x::new_mlx90614(dev, addr, 5).unwrap();
let mut delay = Delay{};
sensor.set_emissivity(0.8, &mut delay).unwrap();

Change the device address

This change will be permanently stored in the device EEPROM.

use linux_embedded_hal::{I2cdev, Delay};
use mlx9061x::{Mlx9061x, SlaveAddr};

let dev = I2cdev::new("/dev/i2c-1").unwrap();
let addr = SlaveAddr::default();
let mut sensor = Mlx9061x::new_mlx90614(dev, addr, 5).unwrap();
let mut delay = Delay{};
sensor.set_address(SlaveAddr::Alternative(0x5C), &mut delay).unwrap();

Modules

ic

IC marker

Structs

Mlx9061x

MLX90614/MLX90615 device driver

Enums

Error

All possible errors in this crate

SlaveAddr

Possible slave addresses