Skip to content

Commit addf33f

Browse files
committed
megre (aht20): Merge branch 'e-update_aht20' into update_aht20
original files reverted to previous state and lost the history too.
2 parents da70eb5 + e9727a7 commit addf33f

File tree

28 files changed

+169
-754
lines changed

28 files changed

+169
-754
lines changed

components/sensors/humiture/aht20/CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# ChangeLog
22

3-
## v1.1.1 (2025-05-02)
4-
* Replace the i2c interface with i2c_bus
3+
## v1.1.1 (2025-05-28)
4+
* Replace the i2c interface with i2c_bus.
55

66
## v1.0.0 (2024-08-09)
77

components/sensors/humiture/aht20/Kconfig

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,4 @@ menu "AHT20 : CONFIGURATION"
66
CRC check to be performed on results or not?.
77
default n
88

9-
10-
config AHT20_I2C_CLK_SPEED
11-
int "I2C clock speed"
12-
default 100000
13-
range 1 400000
14-
help
15-
Clock speed used for i2c communication by AHT20 device.
16-
Limited to maximum of 400KHZ.
17-
189
endmenu

components/sensors/humiture/aht20/README.md

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Component: AHT20
2-
I2C driver for Aosong AHT20 humidity and temperature sensor using esp-idf.
2+
I2C driver with Sensor Hub support for Aosong AHT20 humidity and temperature sensor using esp-idf.
33
Tested with AHT20 using ESP32 and ESP32-S3 devkits.
44

55
# Features
@@ -8,9 +8,9 @@ Tested with AHT20 using ESP32 and ESP32-S3 devkits.
88

99
Thread-safe via esp-i2c-driver
1010

11-
CRC checksum verification (optional via menuconfig)
11+
CRC checksum verification (optional, only via menuconfig)
1212

13-
Configurable I2C clock speed (pre-compilation, not runtime,via menuconfig))
13+
Configurable I2C clock speed (pre-compilation, not runtime, only via menuconfig)
1414

1515
Unit tested
1616
@@ -45,46 +45,45 @@ Tested with AHT20 using ESP32 and ESP32-S3 devkits.
4545

4646
# How To Use
4747

48-
This driver includes a demo example project.
49-
50-
Follow the example to learn how to initialize the driver and read the sensor data.
51-
5248
All public APIs are documented in aht20.h.
5349

54-
50+
## Driver
5551

5652
Following are the general guidelines.
5753
```c
5854
//create a AHT20 device object and receive a device handle for it
59-
// my_i2c_bus_handle is a preintialized i2c_bus_handle_t object
55+
// my_i2c_bus_handle here is a preintialized i2c_bus_handle_t i2c_bus object
6056
aht20_handle_t aht20_handle = aht20_create( my_i2c_bus_handle, AHT20_ADDRESS_LOW ); //addresses are in aht20.h
6157

62-
//use the previously created AHT20 device handle for initializing the associated device
58+
//use the previously created AHT20 device handle for initializing the AHT20
6359
aht20_init(aht20_handle);
6460

65-
//read both humidity and temperature at once from device, using AHT20 device handle
66-
aht20_read_humiture(aht20_handle); //Other public APIs are documented in aht20.h.
61+
float_t temperature;
6762

68-
//access the results stored in AHT20 device object, using the AHT20 device handle
69-
//other apis require user to explicitly pass variable address to hold data
70-
printf("tempertature = %.2fC humidity = %.3f \n", aht20_handle->humiture.temperature, aht20_handle->humiture.humidity);
63+
aht20_read_temperature( aht20_handle, &temperature);
7164

72-
//to get reaw values create a object of following data type
73-
aht20_raw_reading_t raw_value;
74-
aht20_read_raw( aht20_handle, &raw_value);
75-
printf("tempertature = %uC humidity = %u \n", raw_value.temperature, raw_value.humidity);
65+
printf("Temperature = %.2f°C\n", temperature);
66+
67+
vTaskDelay(pdMS_TO_TICKS(2000));
68+
69+
float_t temperature;
70+
71+
aht20_read_temperature( aht20_handle, &temperature);
72+
73+
printf("Temperature = %.2f°C\n", temperature);
7674
```
7775
7876
79-
# How to Configure CRC and I2C clock speed
77+
## How to Configure CRC
8078
Additionally, select in menuconfig under Component Config → AHT20; to use CRC(default is not used)
8179
or change the clock speed of device (default is 100KHz).
8280
8381
Note : It is recommended to use clock speeds in upper ranges of 100kHz to 200kHz.
8482
Higher clock speeds may cause occasional data inconsistencies depending on your board layout and wiring.
8583
86-
![image](https://github.com/user-attachments/assets/fc8680fb-1567-477c-92f8-52dd126e6f9d)
84+
![image](https://github.com/user-attachments/assets/58a07cc9-5d87-4afe-9675-637b3e776faa)
85+
8786
8887
or
8988
In sdkconfig under Component Config → AHT20,
90-
![image](https://github.com/user-attachments/assets/1f9612df-8d73-4ad1-bec7-75cbe6ed327a)
89+

0 commit comments

Comments
 (0)