The AHT25 is a digital temperature and humidity sensor manufactured by ASAIR (AOSONG). It is designed to provide accurate and reliable measurements of environmental conditions, making it ideal for a wide range of applications. The sensor features a built-in I2C interface, which simplifies integration with microcontrollers and other digital systems. With its high precision, low power consumption, and compact design, the AHT25 is well-suited for use in consumer electronics, HVAC systems, weather monitoring, and industrial automation.
The AHT25 sensor offers the following key technical specifications:
Parameter | Value |
---|---|
Supply Voltage (VDD) | 2.0V to 5.5V |
Typical Operating Voltage | 3.3V |
Average Current Consumption | 0.25 mA (measuring) |
Communication Interface | I2C |
Temperature Range | -40°C to +85°C |
Temperature Accuracy | ±0.3°C |
Humidity Range | 0% to 100% RH |
Humidity Accuracy | ±2% RH (20% to 80% RH) |
Response Time | ≤8 seconds |
Dimensions | 3.6mm x 2.4mm x 0.8mm |
The AHT25 has four pins, as described in the table below:
Pin Name | Pin Number | Description |
---|---|---|
VDD | 1 | Power supply pin (2.0V to 5.5V) |
GND | 2 | Ground pin |
SDA | 3 | I2C data line |
SCL | 4 | I2C clock line |
0x38
. Ensure no address conflicts if multiple I2C devices are used.Below is an example of how to interface the AHT25 with an Arduino UNO using the I2C protocol:
#include <Wire.h>
// AHT25 I2C address
#define AHT25_ADDRESS 0x38
void setup() {
Wire.begin(); // Initialize I2C communication
Serial.begin(9600); // Initialize serial communication for debugging
// Initialize the AHT25 sensor
Wire.beginTransmission(AHT25_ADDRESS);
Wire.write(0xE1); // Send initialization command
Wire.endTransmission();
delay(20); // Wait for sensor to stabilize
}
void loop() {
// Request data from the AHT25 sensor
Wire.beginTransmission(AHT25_ADDRESS);
Wire.write(0xAC); // Trigger measurement command
Wire.write(0x33); // Data byte 1
Wire.write(0x00); // Data byte 2
Wire.endTransmission();
delay(80); // Wait for measurement to complete
// Read 6 bytes of data from the sensor
Wire.requestFrom(AHT25_ADDRESS, 6);
if (Wire.available() == 6) {
uint8_t data[6];
for (int i = 0; i < 6; i++) {
data[i] = Wire.read();
}
// Process temperature and humidity data
uint32_t humidity = ((uint32_t)data[1] << 12) | ((uint32_t)data[2] << 4) | (data[3] >> 4);
uint32_t temperature = ((uint32_t)(data[3] & 0x0F) << 16) | ((uint32_t)data[4] << 8) | data[5];
float humidityPercent = (humidity * 100.0) / 1048576.0; // Convert to percentage
float temperatureCelsius = (temperature * 200.0 / 1048576.0) - 50.0; // Convert to Celsius
// Print results to the serial monitor
Serial.print("Humidity: ");
Serial.print(humidityPercent);
Serial.println(" %");
Serial.print("Temperature: ");
Serial.print(temperatureCelsius);
Serial.println(" °C");
}
delay(2000); // Wait 2 seconds before the next reading
}
No Data from Sensor:
0x38
.Inaccurate Readings:
Initialization Failure:
Q: Can the AHT25 operate at 5V?
Q: Do I need external pull-up resistors for I2C?
Q: How often can I take measurements?
This concludes the documentation for the AHT25 sensor.