The AHT20 is a digital temperature and humidity sensor module that communicates over the I2C bus, giving a microcontroller direct digital readings without needing an analog front end or calibration lookup table. It’s commonly used in weather stations, environmental monitors, HVAC-related projects, and general climate-logging applications.
Because it reports over I2C, it can share a bus with other I2C sensors and peripherals, keeping wiring simple on projects that already use I2C for other modules such as displays or additional sensors.
Features:
1. Combined temperature and humidity sensing in one module
2. Digital I2C output — no analog front end required
3. Shares I2C bus easily with other sensors/peripherals
4. Suited to weather stations and environmental monitoring projects
5. Simple 4-wire (power, ground, SDA, SCL) wiring
Pin Connections Table 1
Board Sensor Pin Connection AHT20 VCC/GND/SDA/SCL 3.3-5V / GND / board SDA / board SCL
AHT20 temperature and humidity sensor - Arduino Uno
AHT20 temperature and humidity sensor - Arduino Nano
AHT20 temperature and humidity sensor - Arduino Mega
AHT20 temperature and humidity sensor - ESP32
AHT20 temperature and humidity sensor - ESP8266
AHT20 temperature and humidity sensor - STM32
AHT20 temperature and humidity sensor - Raspberry Pi Pico
1 //ekostra.com
2 //electronics store in egypt
3 //+201008896258
4
5 // I2C wiring for Arduino Uno: A4=SDA, A5=SCL. VCC->3. 3V or 5V per module label, GND->GND.
6 #include <Wire.h>
7 #include <Adafruit_AHTX0.h> // works for AHT10/AHT20/AHT25 - same driver family
8
9 Adafruit_AHTX0 aht;
10
11 void setup () {
12 Serial.begin (115200 );
13 Wire.begin();
14 if (!aht.begin()) {
15 Serial.println ("AHT sensor not found - check wiring!");
16 while (1 ) delay (10 );
17 }
18 }
19
20 void loop () {
21 sensors_event_t humidity, temp;
22 aht.getEvent(&humidity, &temp);
23
24 Serial.print ("Temperature: "); Serial.print (temp.temperature); Serial.print (" C ");
25 Serial.print ("Humidity: "); Serial.print (humidity.relative_humidity); Serial.println (" %");
26
27 delay (1000 );
28 }
1 //ekostra.com
2 //electronics store in egypt
3 //+201008896258
4
5 // I2C wiring for Arduino Nano: A4=SDA, A5=SCL. VCC->3. 3V or 5V per module label, GND->GND.
6 #include <Wire.h>
7 #include <Adafruit_AHTX0.h> // works for AHT10/AHT20/AHT25 - same driver family
8
9 Adafruit_AHTX0 aht;
10
11 void setup () {
12 Serial.begin (115200 );
13 Wire.begin();
14 if (!aht.begin()) {
15 Serial.println ("AHT sensor not found - check wiring!");
16 while (1 ) delay (10 );
17 }
18 }
19
20 void loop () {
21 sensors_event_t humidity, temp;
22 aht.getEvent(&humidity, &temp);
23
24 Serial.print ("Temperature: "); Serial.print (temp.temperature); Serial.print (" C ");
25 Serial.print ("Humidity: "); Serial.print (humidity.relative_humidity); Serial.println (" %");
26
27 delay (1000 );
28 }
1 //ekostra.com
2 //electronics store in egypt
3 //+201008896258
4
5 // I2C wiring for Arduino Mega: D20=SDA, D21=SCL. VCC->3. 3V or 5V per module label, GND->GND.
6 #include <Wire.h>
7 #include <Adafruit_AHTX0.h> // works for AHT10/AHT20/AHT25 - same driver family
8
9 Adafruit_AHTX0 aht;
10
11 void setup () {
12 Serial.begin (115200 );
13 Wire.begin();
14 if (!aht.begin()) {
15 Serial.println ("AHT sensor not found - check wiring!");
16 while (1 ) delay (10 );
17 }
18 }
19
20 void loop () {
21 sensors_event_t humidity, temp;
22 aht.getEvent(&humidity, &temp);
23
24 Serial.print ("Temperature: "); Serial.print (temp.temperature); Serial.print (" C ");
25 Serial.print ("Humidity: "); Serial.print (humidity.relative_humidity); Serial.println (" %");
26
27 delay (1000 );
28 }
1 //ekostra.com
2 //electronics store in egypt
3 //+201008896258
4
5 // I2C wiring for ESP32: GPIO21=SDA, GPIO22=SCL. VCC->3. 3V or 5V per module label, GND->GND.
6 #include <Wire.h>
7 #include <Adafruit_AHTX0.h> // works for AHT10/AHT20/AHT25 - same driver family
8
9 Adafruit_AHTX0 aht;
10
11 void setup () {
12 Serial.begin (115200 );
13 Wire.begin();
14 if (!aht.begin()) {
15 Serial.println ("AHT sensor not found - check wiring!");
16 while (1 ) delay (10 );
17 }
18 }
19
20 void loop () {
21 sensors_event_t humidity, temp;
22 aht.getEvent(&humidity, &temp);
23
24 Serial.print ("Temperature: "); Serial.print (temp.temperature); Serial.print (" C ");
25 Serial.print ("Humidity: "); Serial.print (humidity.relative_humidity); Serial.println (" %");
26
27 delay (1000 );
28 }
1 //ekostra.com
2 //electronics store in egypt
3 //+201008896258
4
5 // I2C wiring for ESP8266: D2(GPIO4)=SDA, D1(GPIO5)=SCL. VCC->3. 3V or 5V per module label, GND->GND.
6 #include <Wire.h>
7 #include <Adafruit_AHTX0.h> // works for AHT10/AHT20/AHT25 - same driver family
8
9 Adafruit_AHTX0 aht;
10
11 void setup () {
12 Serial.begin (115200 );
13 Wire.begin();
14 if (!aht.begin()) {
15 Serial.println ("AHT sensor not found - check wiring!");
16 while (1 ) delay (10 );
17 }
18 }
19
20 void loop () {
21 sensors_event_t humidity, temp;
22 aht.getEvent(&humidity, &temp);
23
24 Serial.print ("Temperature: "); Serial.print (temp.temperature); Serial.print (" C ");
25 Serial.print ("Humidity: "); Serial.print (humidity.relative_humidity); Serial.println (" %");
26
27 delay (1000 );
28 }
1 //ekostra.com
2 //electronics store in egypt
3 //+201008896258
4
5 // I2C wiring for STM32: PB7=SDA, PB6=SCL (Blue Pill / F103C8). VCC->3. 3V or 5V per module label, GND->GND.
6 #include <Wire.h>
7 #include <Adafruit_AHTX0.h> // works for AHT10/AHT20/AHT25 - same driver family
8
9 Adafruit_AHTX0 aht;
10
11 void setup () {
12 Serial.begin (115200 );
13 Wire.begin();
14 if (!aht.begin()) {
15 Serial.println ("AHT sensor not found - check wiring!");
16 while (1 ) delay (10 );
17 }
18 }
19
20 void loop () {
21 sensors_event_t humidity, temp;
22 aht.getEvent(&humidity, &temp);
23
24 Serial.print ("Temperature: "); Serial.print (temp.temperature); Serial.print (" C ");
25 Serial.print ("Humidity: "); Serial.print (humidity.relative_humidity); Serial.println (" %");
26
27 delay (1000 );
28 }
1 //ekostra.com
2 //electronics store in egypt
3 //+201008896258
4
5 // I2C wiring for Raspberry Pi Pico: GPIO4=SDA, GPIO5=SCL. VCC->3. 3V or 5V per module label, GND->GND.
6 #include <Wire.h>
7 #include <Adafruit_AHTX0.h> // works for AHT10/AHT20/AHT25 - same driver family
8
9 Adafruit_AHTX0 aht;
10
11 void setup () {
12 Serial.begin (115200 );
13 Wire.begin();
14 if (!aht.begin()) {
15 Serial.println ("AHT sensor not found - check wiring!");
16 while (1 ) delay (10 );
17 }
18 }
19
20 void loop () {
21 sensors_event_t humidity, temp;
22 aht.getEvent(&humidity, &temp);
23
24 Serial.print ("Temperature: "); Serial.print (temp.temperature); Serial.print (" C ");
25 Serial.print ("Humidity: "); Serial.print (humidity.relative_humidity); Serial.println (" %");
26
27 delay (1000 );
28 }
Project Notes: I2C temperature + humidity sensor, AHTx0 family driver.
نظرة عامة ومواصفات المنتج — بالعربية AHT20 temperature and humidity sensor متوفر الآن في متجر إكوسترا للإلكترونيات، ضمن قسم Sensors، بسعر 95,00 EGP. كود المنتج لدينا: EK1343. المنتج غير متوفر حالياً — تواصل معنا عبر واتساب لمعرفة موعد توفره القادم.
أهم المواصفات الفنية:
Sensor Model: AHT20Measured Parameters: Temperature / HumidityCommunication Interface: I2CWiring Pins: VCC / GND / SDA / SCLالوزن: 1 gهذا المنتج مناسب لمشاريع الأردوينو (Arduino) و ESP32 و Raspberry Pi، ومشاريع الروبوتات وإنترنت الأشياء والتعليم الهندسي. جميع القطع مفحوصة قبل الشحن.
تصفّح المزيد من Sensors في إكوسترا.