111 lines
3.8 KiB
Groff
111 lines
3.8 KiB
Groff
.\" $NetBSD: sgp40mox.4,v 1.2 2021/10/14 21:35:45 wiz Exp $
|
|
.\"
|
|
.\" Copyright (c) 2021 Brad Spencer <brad@anduin.eldar.org>
|
|
.\"
|
|
.\" Permission to use, copy, modify, and distribute this software for any
|
|
.\" purpose with or without fee is hereby granted, provided that the above
|
|
.\" copyright notice and this permission notice appear in all copies.
|
|
.\"
|
|
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
.\"
|
|
.Dd October 7, 2021
|
|
.Dt SGP40MOX 4
|
|
.Os
|
|
.Sh NAME
|
|
.Nm sgp40mox
|
|
.Nd Driver for Sensirion SGP40 MOx gas sensor
|
|
.Sh SYNOPSIS
|
|
.Cd "sgp40mox* at iic? addr 0x59"
|
|
.Sh DESCRIPTION
|
|
The
|
|
.Nm
|
|
driver provides an air quality measurement from the SGP40
|
|
sensor via the
|
|
.Xr envsys 4
|
|
framework.
|
|
The
|
|
.Nm
|
|
.Ar addr
|
|
argument selects the address at the
|
|
.Xr iic 4
|
|
bus.
|
|
The crc validity and temperature and %RH compensation can be changed through
|
|
.Xr sysctl 8
|
|
nodes.
|
|
.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
|
|
.Rs
|
|
.%U https://github.com/Sensirion/embedded-sgp
|
|
.Re
|
|
.Sh SYSCTL VARIABLES
|
|
The following
|
|
.Xr sysctl 3
|
|
variables are provided:
|
|
.Bl -tag -width indent
|
|
.It Li hw.sgp40mox0.compensation.temperature
|
|
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.
|
|
.It Li hw.sgp40mox0.compensation.humidity
|
|
This should be set to the %RH of the environment that the sensor is in.
|
|
The valid values are from 0 to 100.
|
|
.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
|
|
.Xr sysctl 3
|
|
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.
|
|
.It Li hw.sgp40mox0.ignorecrc
|
|
If set, the crc calculation will be ignored on the calls to the chip for the purposes
|
|
of measurement.
|
|
.It Li hw.sgp40mox0.debug
|
|
If the driver is compiled with
|
|
.Dv SGP40_DEBUG ,
|
|
this node will appear and can be used to set the debugging level.
|
|
.It Li hw.sgp40mox0.readattempts
|
|
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.
|
|
.El
|
|
.Sh SEE ALSO
|
|
.Xr envsys 4 ,
|
|
.Xr iic 4 ,
|
|
.Xr envstat 8 ,
|
|
.Xr sysctl 8
|
|
.Sh HISTORY
|
|
The
|
|
.Nm
|
|
driver first appeared in
|
|
.Nx 10.0 .
|
|
.Sh AUTHORS
|
|
.An -nosplit
|
|
The
|
|
.Nm
|
|
driver was written by
|
|
.An Brad Spencer Aq Mt brad@anduin.eldar.org .
|
|
.Sh BUGS
|
|
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.
|
|
.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.
|