1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
<table class="head">
<tr>
<td class="head-ltitle">SGP40MOX(4)</td>
<td class="head-vol">Device Drivers Manual</td>
<td class="head-rtitle">SGP40MOX(4)</td>
</tr>
</table>
<div class="manual-text">
<section class="Sh">
<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1>
<p class="Pp"><code class="Nm">sgp40mox</code> — <span class="Nd">Driver
for Sensirion SGP40 MOx gas sensor</span></p>
</section>
<section class="Sh">
<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1>
<p class="Pp"><code class="Cd">sgp40mox* at iic? addr 0x59</code></p>
</section>
<section class="Sh">
<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1>
<p class="Pp">The <code class="Nm">sgp40mox</code> driver provides an air
quality measurement from the SGP40 sensor via the
<a class="Xr">envsys(4)</a> framework. The <code class="Nm">sgp40mox</code>
<var class="Ar">addr</var> argument selects the address at the
<a class="Xr">iic(4)</a> bus. The crc validity and temperature and %RH
compensation can be changed through <a class="Xr">sysctl(8)</a> nodes.</p>
<p class="Pp">In order to calculate the VOC index, the volatile organic
compounds index, which is the measure of air quality the sensor is polled
once a second and the raw sensor value is fed into the Sensirion VOC
algorithm. This VOC algorithm used in this driver is licensed under a 3
clause BSD license and was pulled from the Sensirion Github repository at
<cite class="Rs"><a class="RsU" href="https://github.com/Sensirion/embedded-sgp">https://github.com/Sensirion/embedded-sgp</a>.</cite></p>
</section>
<section class="Sh">
<h1 class="Sh" id="SYSCTL_VARIABLES"><a class="permalink" href="#SYSCTL_VARIABLES">SYSCTL
VARIABLES</a></h1>
<p class="Pp">The following <a class="Xr">sysctl(3)</a> variables are
provided:</p>
<dl class="Bl-tag">
<dt id="hw.sgp40mox0.compensation.temperature"><a class="permalink" href="#hw.sgp40mox0.compensation.temperature"><code class="Li">hw.sgp40mox0.compensation.temperature</code></a></dt>
<dd>This should be set to the temperature in Celsius of the environment that
the sensor is in. The valid values are from -45 to 130 degrees
Celsius.</dd>
<dt id="hw.sgp40mox0.compensation.humidity"><a class="permalink" href="#hw.sgp40mox0.compensation.humidity"><code class="Li">hw.sgp40mox0.compensation.humidity</code></a></dt>
<dd>This should be set to the %RH of the environment that the sensor is in.
The valid values are from 0 to 100.
<p class="Pp">For the best performance of the VOC algorithm it is important
that the temperature and %RH compensation values be current and set
using the <a class="Xr">sysctl(3)</a> variables mentioned above. This
data will need to be pulled from another source, such as a another
sensor in the environment that the SGP40 is in.</p>
</dd>
<dt id="hw.sgp40mox0.ignorecrc"><a class="permalink" href="#hw.sgp40mox0.ignorecrc"><code class="Li">hw.sgp40mox0.ignorecrc</code></a></dt>
<dd>If set, the crc calculation will be ignored on the calls to the chip for
the purposes of measurement.</dd>
<dt id="hw.sgp40mox0.debug"><a class="permalink" href="#hw.sgp40mox0.debug"><code class="Li">hw.sgp40mox0.debug</code></a></dt>
<dd>If the driver is compiled with <code class="Dv">SGP40_DEBUG</code>, this
node will appear and can be used to set the debugging level.</dd>
<dt id="hw.sgp40mox0.readattempts"><a class="permalink" href="#hw.sgp40mox0.readattempts"><code class="Li">hw.sgp40mox0.readattempts</code></a></dt>
<dd>To read the air quality metric from the chip requires that the command be
sent, then a delay must be observed before a read can be done to get the
values back. The delays are documented in the data sheet for the chip. The
driver will attempt to read back the values readattempts number of times.
The default is 10 which should be more than enough for most purposes.</dd>
</dl>
</section>
<section class="Sh">
<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE
ALSO</a></h1>
<p class="Pp"><a class="Xr">envsys(4)</a>, <a class="Xr">iic(4)</a>,
<a class="Xr">envstat(8)</a>, <a class="Xr">sysctl(8)</a></p>
</section>
<section class="Sh">
<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1>
<p class="Pp">The <code class="Nm">sgp40mox</code> driver first appeared in
<span class="Ux">NetBSD 10.0</span>.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1>
<p class="Pp">The <code class="Nm">sgp40mox</code> driver was written by
<span class="An">Brad Spencer</span>
<<a class="Mt" href="mailto:brad@anduin.eldar.org">brad@anduin.eldar.org</a>>.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="BUGS"><a class="permalink" href="#BUGS">BUGS</a></h1>
<p class="Pp">The driver does not make complete use of the VOC algorithm. In
particular, there is no need to restart the algorithm from scratch if there
is a stoppage of polling for less than 10 minutes. The driver does not have
the ability to determine that, and therefore assumes that the sensor is
completely cold each time the driver attaches to the chip.</p>
<p class="Pp">The temperature and humidity compensation could be allowed to
contain fractional degrees Celsius and %RH. The driver only supports setting
whole numbers for either of those.</p>
</section>
</div>
<table class="foot">
<tr>
<td class="foot-date">October 7, 2021</td>
<td class="foot-os">NetBSD 10.1</td>
</tr>
</table>
|