Tasmota
Tasmota copied to clipboard
Add Support for AHT30 Temperature and Humidity Sensor
Description:
Implemented sensor detection, initialization, and data reading based on both the AHT20 and the AHT30 datasheet specifications. Configured the sensor polling interval to 10 seconds to prevent sensor heating.
Checklist:
- [+] The pull request is done against the latest development branch
- [+] Only relevant files were touched
- [+] Only one feature/fix was added per PR and the code change compiles without warnings
- [+] The code change is tested and works with Tasmota core ESP8266 V.2.7.4.9
- [+] The code change is tested and works with Tasmota core ESP32 V.2.0.14
- [+] I accept the CLA.
In addition to the datasheet, did you TEST if your changes work? I see you also change AHT1x reset command. Did you test AHT1x functionality?
In addition to the datasheet, did you TEST if your changes work? I see you also change AHT1x reset command. Did you test AHT1x functionality?
I tested the code on two ESP32 boards: 1)UICPAL Type-C ESP32-C3 16Pin Development Board Mini 2)WeAct ESP32 Development Board TYPE-C CH340K WiFi+Bluetooth Dual Core ESP32-DOWD-V3 In both cases, it works without any problems. But the reset command is really different from the one in the datasheet. And if it is wrong, it means it has no noticeable effect. Initially, the AHT30 sensor didn't work because of an incorrect initialization command in the code for AHT20. After fixing the initialization command, it worked, but it was getting 3 degrees hotter due to frequent measurements. So I had to reduce their frequency. Now the measurements are accurate. Anyway, I will do some more testing.
The reset command in my code did not match the AHT10/20/30 datasheets. I have corrected it. However, the reset function is not used in the driver, so the error did not affect the driver. Apparently, the initialization function is sufficient for the sensor to work.
This PR also fixes work with AHT20+BMP280 module from aliexpress. The AHT20 part of module does not work with #define AHTX_CMD 0xB1 and works with #define AHTX_CMD 0xBE
This PR also fixes work with AHT20+BMP280 module from aliexpress. The AHT20 part of module does not work with #define AHTX_CMD 0xB1 and works with #define AHTX_CMD 0xBE
Very good! I'm just waiting for the AHT20+BMP280 to be delivered.
Added Russian translation of untranslated element "Dew point" for AHTxx sensors.
I tested the code to ESP32 boards: Sonoff Extreme mini R4. It works without any problems. Good work
@dadaweb77 how have you connected the sensor to the "Sonoff Extreme mini R4"? Thanks!
@dadaweb77 how have you connected the sensor to the "Sonoff Extreme mini R4"? Thanks!
Simple: R4mini-------AHT30 u2 (+3.3V) ------- Vin (red wire) GND ------- GND (white wire) TX ------- SCL (yellow wire) RX ------- SDA (green wire)
Use this template {"NAME":"Sonoff MINIR4","GPIO":[32,608,0,640,0,0,0,0,0,0,0,0,0,0,0,576,0,0,0,0,0,0,224,160,0,0,0,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":1}
The code changes need to be tested with an AHT25 too. Furthermore all language translation files has to be included in the PR (providing all not known languages in English) Maybe it is possible to send all the different CMD sequences to the AHTs? So no need for an compile time setting for the different types?
This PR has been automatically marked as stale because it hasn't any activity in last few weeks. It will be closed if no further activity occurs. Thank you for your contributions.
Ok to merge as-is, but I would largely prefer a future version that unifies ATH10/20/30 into a single code base, and dynamic selection
To make a universal driver that will work for all versions of this sensor seems realistic to me. But it will be possible to distinguish only AHT10, because it has a different code for sending a command. The other versions of AHT I do not know how to distinguish from each other programmatically. Anyway, I'll give it a try.
Will this feature be merged and available? I would like to use the AHT30 as well. :)
is there a test bin somewhere? i can't seem to find a workflow creation from PR
This PR has been automatically marked as stale because it hasn't any activity in last few weeks. It will be closed if no further activity occurs. Thank you for your contributions.