1.. zephyr:code-sample:: ccs811
2   :name: CCS811 indoor air quality sensor
3   :relevant-api: sensor_interface
4
5   Get CO2 equivalent and VOC data from a CCS811 sensor.
6
7Overview
8********
9
10The CCS811 digital gas sensor detects volatile organic compounds (VOCs)
11for indoor air quality measurements. VOCs are often categorized as
12pollutants and/or sensory irritants and can come from a variety of
13sources such as construction materials (paint and carpet), machines
14(copiers and processors), and even people (breathing and smoking).  It
15estimates carbon dioxide (CO2) levels where the main source of VOCs is
16human presence.
17
18Building and Running
19********************
20
21Building and Running on thingy52/nrf52832
22=========================================
23
24.. zephyr-app-commands::
25   :zephyr-app: samples/sensor/ccs811
26   :board: thingy52/nrf52832
27   :goals: build flash
28   :compact:
29
30
31Sample Output
32=============
33
34The sample output below is from a `Nordic Thingy:52
35<https://www.nordicsemi.com/Software-and-tools/Prototyping-platforms/Nordic-Thingy-52>`_
36(thingy52/nrf52832) that includes this sensor (and others).
37After a soft reset, there is a 5-second startup period
38where readings are unstable, and then we can see steady
39reported measurements of about 400 ppm eC02 and 0 ppb eTVOC.
40
41.. code-block::console
42
43   *** Booting Zephyr OS build zephyr-v2.1.0-310-g32a3e9907bab  ***
44   device is 0x20001088, name is CCS811
45   HW 12; FW Boot 1000 App 1100 ; mode 10
46
47   [0:00:00.046]: CCS811: 65021 ppm eCO2; 65021 ppb eTVOC
48   Voltage: 0.000000V; Current: 0.000000A
49   BASELINE fff4
50   Timed fetch got 0
51
52   [0:00:01.059]: CCS811: 65021 ppm eCO2; 65021 ppb eTVOC
53   Voltage: 0.000000V; Current: 0.000000A
54   BASELINE fff4
55   Timed fetch got 0
56   Timed fetch got stale data
57   Timed fetch got stale data
58   Timed fetch got stale data
59
60   [0:00:05.084]: CCS811: 400 ppm eCO2; 0 ppb eTVOC
61   Voltage: 0.677040V; Current: 0.000014A
62   BASELINE 8384
63   Timed fetch got 0
64
65   [0:00:06.096]: CCS811: 405 ppm eCO2; 0 ppb eTVOC
66   Voltage: 0.675428V; Current: 0.000014A
67   BASELINE 8384
68   Timed fetch got 0
69
70   [0:00:07.108]: CCS811: 400 ppm eCO2; 0 ppb eTVOC
71   Voltage: 0.677040V; Current: 0.000014A
72   BASELINE 8384
73   Timed fetch got 0
74
75   [0:00:08.121]: CCS811: 400 ppm eCO2; 0 ppb eTVOC
76   Voltage: 0.677040V; Current: 0.000014A
77   BASELINE 8384
78   Timed fetch got 0
79
80   [0:00:09.133]: CCS811: 400 ppm eCO2; 0 ppb eTVOC
81   Voltage: 0.677040V; Current: 0.000014A
82   BASELINE 8384
83   Timed fetch got 0
84
85   [0:00:10.145]: CCS811: 400 ppm eCO2; 0 ppb eTVOC
86   Voltage: 0.677040V; Current: 0.000014A
87   BASELINE 8384
88   Timed fetch got 0
89