









| Parameter | Value |
|---|---|
| Manufacturer | Arduino |
| Part ID | AHT20+BMP280 |
| Operating Voltage | 3.3V to 5V |
| Communication Protocol | I2C |
| Temperature Range | -40°C to 85°C (AHT20) |
| Humidity Range | 0% to 100% RH (AHT20) |
| Pressure Range | 300 hPa to 1100 hPa (BMP280) |
| Temperature Accuracy | ±0.3°C (AHT20), ±1°C (BMP280) |
| Humidity Accuracy | ±2% RH (AHT20) |
| Pressure Accuracy | ±1 hPa (BMP280) |
| Power Consumption | Low power consumption for battery use |
| Pin Name | Description | Notes |
|---|---|---|
| VCC | Power supply (3.3V to 5V) | Connect to the power source |
| GND | Ground | Connect to the circuit ground |
| SDA | I2C Data Line | Connect to Arduino SDA pin |
| SCL | I2C Clock Line | Connect to Arduino SCL pin |
Wiring the Component:
Install Required Libraries:
Adafruit_AHTX0 and Adafruit_BMP280 libraries from the Arduino Library Manager.Upload Example Code:
#include <Wire.h>
#include <Adafruit_AHTX0.h> // Library for AHT20 sensor
#include <Adafruit_BMP280.h> // Library for BMP280 sensor
// Create sensor objects
Adafruit_AHTX0 aht;
Adafruit_BMP280 bmp;
void setup() {
Serial.begin(9600);
while (!Serial); // Wait for Serial Monitor to open
// Initialize AHT20 sensor
if (!aht.begin()) {
Serial.println("Failed to initialize AHT20 sensor!");
while (1);
}
Serial.println("AHT20 sensor initialized.");
// Initialize BMP280 sensor
if (!bmp.begin(0x76)) { // Default I2C address for BMP280
Serial.println("Failed to initialize BMP280 sensor!");
while (1);
}
Serial.println("BMP280 sensor initialized.");
}
void loop() {
// Read data from AHT20
sensors_event_t humidity, temp;
aht.getEvent(&humidity, &temp);
// Read data from BMP280
float pressure = bmp.readPressure() / 100.0F; // Convert to hPa
// Print sensor data
Serial.print("Temperature (AHT20): ");
Serial.print(temp.temperature);
Serial.println(" °C");
Serial.print("Humidity (AHT20): ");
Serial.print(humidity.relative_humidity);
Serial.println(" %");
Serial.print("Pressure (BMP280): ");
Serial.print(pressure);
Serial.println(" hPa");
delay(2000); // Wait 2 seconds before next reading
}
Sensor Not Detected:
Inaccurate Readings:
Arduino Freezes or Crashes:
Can I use this module with a 3.3V microcontroller? Yes, the module supports both 3.3V and 5V logic levels.
What is the maximum cable length for I2C communication? The maximum length depends on the pull-up resistor values and operating frequency, but typically it is recommended to keep it under 1 meter for reliable communication.
Can I use this module outdoors? While the sensors can operate outdoors, they should be protected from direct exposure to water, dust, and extreme conditions.
This concludes the documentation for the My Comp module.