The Adafruit AHT20 is a high-accuracy temperature and humidity sensor that communicates over an I2C interface. It is designed to provide reliable and precise measurements of temperature and humidity, making it an ideal choice for environmental monitoring systems, HVAC systems, and other applications where environmental data is crucial.
Pin Number | Name | Description |
---|---|---|
1 | VDD | Power supply (2.2V to 5.5V) |
2 | GND | Ground |
3 | SDA | I2C Data Line |
4 | SCL | I2C Clock Line |
#include <Wire.h>
#include <Adafruit_AHTX0.h>
Adafruit_AHTX0 aht;
void setup() {
Serial.begin(9600);
Serial.println("AHT20 test");
if (!aht.begin()) {
Serial.println("Could not find AHT20 sensor!");
while (1) delay(10);
}
}
void loop() {
sensors_event_t humidity, temp;
aht.getEvent(&humidity, &temp); // Get new data
Serial.print("Temperature: ");
Serial.print(temp.temperature);
Serial.println(" degrees C");
Serial.print("Humidity: ");
Serial.print(humidity.relative_humidity);
Serial.println("% rH");
delay(500);
}
Serial.begin(9600)
in the code.Q: Can the AHT20 sensor be used outdoors? A: Yes, but it should be protected from direct exposure to water and sunlight.
Q: What is the default I2C address of the AHT20 sensor? A: The default I2C address is 0x38 and it is fixed.
Q: How long does the sensor need to acclimatize to the environment? A: It is recommended to allow the sensor to acclimatize for at least 30 minutes for accurate readings.
Q: Can I use multiple AHT20 sensors on the same I2C bus? A: No, since the AHT20 has a fixed I2C address, you cannot use multiple AHT20 sensors on the same I2C bus without additional hardware such as an I2C multiplexer.