veml6075 0.2.0

Platform-agnostic Rust driver for the VEML6075 UVA and UVB light sensor.
Documentation

Rust VEML6075 UVA and UVB Light Sensor Driver

crates.io Docs Build Status Coverage Status

This is a platform agnostic Rust driver for the VEML6075 UVA and UVB light sensor, based on the embedded-hal traits.

This driver allows you to:

  • Enable/disable the sensor. See: enable().
  • Read calibrated UVA, UVB and UV index measurement. See: read().
  • Read raw measurement. See: read_uva_raw().
  • Set integration time. See: set_integration_time().
  • Set dynamic setting. See: set_dynamic_setting().
  • Change operating mode. See: set_mode().
  • Trigger measurement when on active force mode. See: trigger_measurement().
  • Read the device id. See: read_device_id().

Introductory blog post

The device

The VEML6075 senses UVA and UVB light and incorporates photodiode, amplifiers, and analog / digital circuits into a single chip using a CMOS process. When the UV sensor is applied, it is able to detect UVA and UVB intensity to provide a measure of the signal strength as well as allowing for UVI measurement.

The VEML6075 provides excellent temperature compensation capability for keeping the output stable under changing temperature. VEML6075's functionality is easily operated via the simple command format of I2C (SMBus compatible) interface protocol. VEML6075's operating voltage ranges from 1.7 V to 3.6 V.

Datasheet:

Application note:

Usage

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

extern crate linux_embedded_hal as hal;
extern crate veml6075;
use veml6075::{Calibration, Veml6075};

fn main() {
    let dev = hal::I2cdev::new("/dev/i2c-1").unwrap();
    let mut sensor = Veml6075::new(dev, Calibration::default());
    let m = sensor.read().unwrap();
    println!("UVA: {:2}, UVB: {:2}, UVI: {:2}", m.uva, m.uvb, m.uv_index);
}

Support

For questions, issues, feature requests, and other changes, please file an issue in the github project.

License

Licensed under either of

at your option.

Contributing

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.