Skip to content

Commit

Permalink
Add Support for AHT30 Temperature and Humidity Sensor (arendst#19922)
Browse files Browse the repository at this point in the history
* Update xsns_63_aht1x.ino

Support for AHT30 added. Fixed command for loading factory calibrated data and reset command, added needed delay after read command and increased measurement period to reduce heating of sensor.

* Update xsns_63_aht1x.ino

* Update xsns_63_aht1x.ino

The reset command is aligned with the AHT10/20/30 datasheet.

* Update ru_RU.h

Translated Dew Point to russian Точка росы for sensors

* Delete tasmota/language/ru_RU.h

Will go to separate PR

* Add files via upload

* Update ru_RU.h

Partial translation update

* Add files via upload
  • Loading branch information
legchenkov authored and hawa-lc4 committed May 7, 2024
1 parent 7ba78e7 commit bbe2d61
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions tasmota/tasmota_xsns_sensor/xsns_63_aht1x.ino
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/

#ifdef USE_I2C
#if defined(USE_AHT1x) || defined(USE_AHT2x)
#if defined(USE_AHT1x) || defined(USE_AHT2x) || defined(USE_AHT3x)

/*********************************************************************************************\
* AHT10/15/20 - Temperature and Humidity
Expand All @@ -40,7 +40,10 @@
* and allows other I2C Devices on the bus but have only one I2C Address (0x38)
* 14.09.2021 support AHT20 without enabling AHT1x
*
* 26.10.2023 support for AHT30 added.
*
* AHT20 I2C Address: 0x38
* AHT30 I2C Address: 0x38
\*********************************************************************************************/

#define XSNS_63 63
Expand All @@ -56,12 +59,15 @@
#define AHT_TEMPERATURE_OFFSET 50
#define KILOBYTE_CONST 1048576.0f

#define AHT1X_CMD_DELAY 40
#define AHT1X_RST_DELAY 30
#define AHT1X_CMD_DELAY 20
#define AHT1X_RST_DELAY 10
#define AHT1X_MEAS_DELAY 80 // over 75ms in datasheet

#ifdef USE_AHT2x
#define AHTX_CMD 0xB1 // Cmd for AHT2x
#ifdef USE_AHT3x
#define AHTX_CMD 0xBE // Cmd for AHT3x
const char ahtTypes[] PROGMEM = "AHT3X|AHT3X";
#elif defined(USE_AHT2x)
#define AHTX_CMD 0xBE // Cmd for AHT2x
const char ahtTypes[] PROGMEM = "AHT2X|AHT2X";
#else
#define AHTX_CMD 0xE1 // Cmd for AHT1x
Expand Down Expand Up @@ -92,6 +98,7 @@ bool AHT1XWrite(uint8_t aht1x_idx) {
Wire.write(AHTMeasureCmd, 3);
if (Wire.endTransmission() != 0)
return false;
delay(AHT1X_MEAS_DELAY);
return true;
}

Expand Down Expand Up @@ -198,7 +205,7 @@ bool Xsns63(uint32_t function)
}
else if (aht1x.count) {
switch (function) {
case FUNC_EVERY_100_MSECOND:
case FUNC_EVERY_SECOND:
AHT1XPoll();
break;
case FUNC_JSON_APPEND:
Expand All @@ -215,4 +222,4 @@ bool Xsns63(uint32_t function)
}

#endif // USE_AHT1X
#endif // USE_I2C
#endif // USE_I2C

0 comments on commit bbe2d61

Please sign in to comment.