• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..--

boards/03-Apr-2024-2321

src/03-Apr-2024-12085

CMakeLists.txtD03-Apr-2024229 106

KconfigD03-Apr-2024971 4537

README.rstD03-Apr-20242.3 KiB6747

prj.confD03-Apr-2024121 86

sample.yamlD03-Apr-2024239 147

README.rst

1.. _sgp40_sht4x:
2
3SGP40 and SHT4X: High accuracy digital I2C humidity sensor and multipixel gas sensor
4####################################################################################
5
6Description
7***********
8
9This sample application periodically measures the ambient temperature, humidity
10and a raw gas sensor value from an SGP40 and SHT4X device.
11The result is written to the console.
12
13You can choose to use the on-chip T/RH compensation of the SGP40
14by feeding the values measured by the SHT4X into it.
15This is enabled in the Application by default, you can turn it off
16by setting ``APP_USE_COMPENSATION=n``.
17
18The SHT4X has the option to use a heater which makes sense for specific
19environments/applications (refer to the datasheet for more information).
20To make use of the heater have a look at the Kconfig options for this application.
21
22
23References
24**********
25
26 - `SHT4X sensor <https://www.sensirion.com/en/environmental-sensors/humidity-sensors/humidity-sensor-sht4x/>`_
27 - `SGP40 sensor <https://www.sensirion.com/en/environmental-sensors/gas-sensors/sgp40/>`_
28
29Wiring
30******
31
32This sample uses the SHT4X and SGP40 sensor controlled using the I2C interface.
33Connect Supply: **VDD**, **GND** and Interface: **SDA**, **SCL**.
34The supply voltage can be in the 1.7V to 3.6V range.
35Depending on the baseboard used, the **SDA** and **SCL** lines require Pull-Up
36resistors.
37
38Building and Running
39********************
40
41This project outputs sensor data to the console. It requires a SHT4X and a SGP40
42sensor. It should work with any platform featuring a I2C peripheral
43interface. This example has an example device tree overlay
44for the :ref:`blackpill_f411ce` board.
45
46
47.. zephyr-app-commands::
48   :zephyr-app: samples/sensor/sgp40_sht4x
49   :board: blackpill_f411ce
50   :goals: build flash
51
52
53Sample Output
54=============
55
56.. code-block:: console
57
58        *** Booting Zephyr OS build v2.6.0-rc1-315-g50d8d1187138  ***
59        SHT4X: 23.64 Temp. [C] ; 30.74 RH [%] -- SGP40: 30531 Gas [a.u.]
60        [00:00:00.250,000] <dbg> SGP40.sgp40_init: SGP40: Selftest succeeded!
61        SHT4X: 23.66 Temp. [C] ; 32.16 RH [%] -- SGP40: 30541 Gas [a.u.]
62        SHT4X: 23.63 Temp. [C] ; 30.83 RH [%] -- SGP40: 30522 Gas [a.u.]
63
64The datasheet states that the raw sensor signal for the SGP40 ist proportional
65to the logarithm of the sensors resistance, hence it is labeled as [a.u.]
66(arbitrary units) in the example.
67