Skip to content

Commit 30fbfff

Browse files
pyhyskartben
authored andcommitted
boards: shields: Add Adafruit AHT20 temp and humidity sensor shield
Product photo from https://learn.adafruit.com/assets/91687 with the licence CC BY 3.0 Tested with the command mentioned on the index.rst page. Signed-off-by: Jonas Berg <[email protected]>
1 parent 5f5638b commit 30fbfff

File tree

6 files changed

+100
-0
lines changed

6 files changed

+100
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Copyright (c) 2025 Jonas Berg
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config SHIELD_ADAFRUIT_AHT20
5+
def_bool $(shields_list_contains,adafruit_aht20)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
* Copyright (c) 2025 Jonas Berg
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/ {
8+
aliases {
9+
dht0 = &adafruit_aht20;
10+
};
11+
};
12+
13+
&zephyr_i2c {
14+
status = "okay";
15+
16+
adafruit_aht20: aht20@38 {
17+
status = "okay";
18+
compatible = "aosong,aht20";
19+
reg = <0x38>;
20+
};
21+
};
47.4 KB
Loading
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
.. _adafruit_aht20:
2+
3+
Adafruit AHT20 Shield
4+
#####################
5+
6+
Overview
7+
********
8+
9+
The `Adafruit AHT20 Temperature and Humidity Sensor Shield`_ features
10+
an `Aosong AHT20 Humidity and Temperature Sensor`_ and two STEMMA QT connectors.
11+
It measures temperature and humidity.
12+
13+
.. figure:: adafruit_aht20.webp
14+
:align: center
15+
:alt: Adafruit AHT20 Shield
16+
17+
Adafruit AHT20 Shield (Credit: Adafruit)
18+
19+
20+
Requirements
21+
************
22+
23+
This shield can be used with boards which provide an I2C connector, for
24+
example STEMMA QT or Qwiic connectors.
25+
The target board must define a ``zephyr_i2c`` node label.
26+
See :ref:`shields` for more details.
27+
28+
29+
Pin Assignments
30+
===============
31+
32+
+--------------+-------------------+
33+
| Shield Pin | Function |
34+
+==============+===================+
35+
| SDA | AHT20 I2C SDA |
36+
+--------------+-------------------+
37+
| SCL | AHT20 I2C SCL |
38+
+--------------+-------------------+
39+
40+
See :dtcompatible:`aosong,aht20` for details on possible devicetree settings.
41+
42+
43+
Programming
44+
***********
45+
46+
Set ``--shield adafruit_aht20`` when you invoke ``west build``. For example
47+
when running the :zephyr:code-sample:`dht_polling` sample:
48+
49+
.. zephyr-app-commands::
50+
:zephyr-app: samples/sensor/dht_polling
51+
:board: adafruit_qt_py_rp2040
52+
:shield: adafruit_aht20
53+
:goals: build
54+
55+
.. _Adafruit AHT20 Temperature and Humidity Sensor Shield:
56+
https://learn.adafruit.com/adafruit-aht20
57+
58+
.. _Aosong AHT20 Humidity and Temperature Sensor:
59+
https://www.aosong.com/userfiles/files/media/Data%20Sheet%20AHT20.pdf
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
#
3+
# Copyright (c) 2025, Jonas Berg
4+
5+
shield:
6+
name: adafruit_aht20
7+
full_name: Adafruit AHT20 Temperature and Humidity Sensor Shield
8+
vendor: adafruit
9+
supported_features:
10+
- sensor

samples/sensor/dht_polling/sample.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ tests:
1313
filter: dt_alias_exists("dht0")
1414
integration_platforms:
1515
- nucleo_f401re
16+
platform_allow:
17+
- adafruit_qt_py_rp2040/rp2040
18+
- nucleo_f401re
19+
extra_args:
20+
- platform:adafruit_qt_py_rp2040/rp2040:SHIELD="adafruit_aht20"
1621
harness: console
1722
harness_config:
1823
fixture: fixture_i2c_hs300x

0 commit comments

Comments
 (0)