#temperature-humidity #humidity #embedded-hal #temperature #aht10 #usb-serial

no-std aht10-embedded

A platform agnostic driver to interface with the AHT10 temperature/humidity sensor, tested on Rasberry Pi Pico

2 releases

0.0.2 Nov 9, 2024
0.0.1 Nov 30, 2023

#582 in Embedded development

Download history 8/week @ 2024-09-23 98/week @ 2024-11-04 24/week @ 2024-11-11

122 downloads per month

MIT license

18KB
412 lines

AHT10 Rust Library

crates.io MIT GitHub

Why?

I haven't found a driver that works simply (without async 😉 ) for an embedded environment and #no_std.

Usage

First, create the AHT10 struct, with your I2C

let mut aht = AHT10::new(i2c1);

Then, initialize the sensor

match aht.initialize() {
    Ok(_) => (),
    Err(e) => {
        // AAAAaarrrgggg.... 😵
    }
}

Finally, read the data:

match aht.read_data(&mut delay) {
    Ok(data) => {
        // Yay ! It works !
        let celsius = data.temperature_celsius();
        let fahrenheit = data.temperature_fahrenheit(); // 😶
        let humidity = data.humidity();
    }
    Err(e) => {
        // AAAAaarrrgggg... 😵
    }
};

Example

There is only one example named rp_pico_aht10. It uses GPIOs 2 & 3 (SDA & SCL respectively) and print data on USB serial port.

Dependencies

~71KB