 
AHT10是一款精密数字温湿度传感器,以其卓越的精度和可靠性而闻名,常用于天气监测、气象站、暖通空调系统、家庭自动化、工业自动化和物联网设备等。
AHT10的温度测量范围为-40°C至85°C,精度为±0.3°C,湿度测量范围为0%至100%,精度为±2%,其紧凑的设计和I2C接口使其能够轻松集成到各种项目中。
AHT10管脚定义
| 序号 | 标号 | 功能 | 描述 | 
| 1 | VIN | 电源 | 电源+ | 
| 2 | GND | 地 | 电源- | 
| 3 | SCL | I2C通讯 | I2C时钟信号 | 
| 4 | SDA | I2C通讯 | I2C数据信号 | 
AHT10模块电路原理图
     
AHT10与Arduino UNO连接
     
基于Arduino UNO的AHT10代码
    #include < Wire.h> // Library to establish I2C communication
 #include < AHT10.h> // Library to use the AHT10 sensor
AHT10 myAHT10(0x38); //AHT10 instance, address 0x38
void setup ()
{
      Wire.begin(); //Function that initializes the Wire library.
      Serial.begin(9600); //initializes Serial communication. 
      Serial.println("Initialising AHT10 Sensor");
      if(!myAHT10.begin()) //If communication with the sensor fails, an error message is printed 
      {
        Serial.println ("Sensor error!");
        while(1);
      }
}
void loop()
{
  float temp = myAHT10.readTemperature(); //read temperature from sensor and store it in a variable.
  float hum = myAHT10.readHumidity(); //read humidity from sensor and store it in a variable.
  
  Serial.print("Temp: "); Serial.print(temp); Serial.print("°C  "); //print the temperature value.
  Serial.print("Humidity: "); Serial.print(hum); Serial.println(" %"); //print the humidity value.
  delay(1000);
}
     


 
            
 
            
         
            
         
            
         
            
         
            
         
            
         
            
         
            
         
            
         
            
        








 
         
         
         
         
        