Skip to content

AHT2x/AM2301B temperature and humidity sensor~

This feature is not included in precompiled binaries

When compiling your build add the following to user_config_override.h:

#ifndef USE_AHT2x
#define USE_AHT2x       // [I2cDriver43] Enable AHT20/AM2301B instead of AHT1x humidity and temperature sensor (I2C address 0x38) (+0k8 code)
#endif

Configuration~

Wiring~

AHT ESP
VCC 3.3V
GND GND
SDA GPIOx
SCL GPIOy

AHT25 breakout boards require external pull-up resistors on the I2C bus (for example: 4.7kΩ)

Tasmota Settings~

In the Configuration -> Configure Module page assign:

  1. GPIOx to I2C SDA
  2. GPIOy to I2C SCL

After a reboot the driver should detect the sensor and display sensor readings.

Troubleshooting~

On some I2C sensors, like the AHT25, Tasmota might mistake the sensor for another one using the same address. This can be resolved by disabling the unneeded drivers.

For our example AHT25, the address might get confused with the VEML6070 UV sensor. You can tell Tasmota to use the other driver by issuing the following commands in the console:

  • I2CDriver12 0 to disable the VEML driver
  • I2CDriver43 1 to enable the AHT driver

An overview of all I2C drivers is available in the docs.

Breakout Boards~

AHT20AHT21AHT25AM2301B

AHT20 Datasheet
AHT21 Datasheet AHT25 Datasheet