SGP40MOX(4)
π¦ sgp40mox(4) β Kernel Interfaces Manual, but make it bestie π
okay so this is the Kernel Interfaces Manual page for sgp40mox(4), aka the driver for the Sensirion SGP40 MOx gas sensor. We are literally measuring air quality with a tiny chip. Obsessed. β¨
π NAME π
sgp40moxβ Driver for Sensirion SGP40 MOx gas sensor
π SYNOPSIS π
sgp40mox* at iic? addr 0x59
πΈ DESCRIPTION πΈ
The sgp40mox driver gives you an air quality measurement from the SGP40 sensor via the envsys(4) framework. The sgp40mox addr argument selects the address on the iic(4) bus. The crc validity plus the temperature and %RH compensation can all be changed through sysctl(8) nodes. π«Ά
So here's the vibe: 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 https://github.com/Sensirion/embedded-sgp. π§
β¨ SYSCTL VARIABLES β¨
The following sysctl(3) variables are provided:
hw.sgp40mox0.compensation.temperatureβ set this to the temperature in Celsius of the environment the sensor is in. Valid values are from-45to130degrees Celsius. π‘οΈhw.sgp40mox0.compensation.humidityβ set this to the%RHof the environment the sensor is in. Valid values are from0to100. π§
For the best performance of the VOC algorithm, it is important that the temperature and %RH compensation values be current and set using the sysctl(3) variables mentioned above. This data will need to be pulled from another source, like another sensor in the same environment as the SGP40. π
hw.sgp40mox0.ignorecrcβ if set, thecrccalculation will be ignored on the calls to the chip for the purposes of measurement. πhw.sgp40mox0.debugβ if the driver is compiled withSGP40_DEBUG, this node will appear and can be used to set the debugging level. π₯hw.sgp40mox0.readattemptsβ reading 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 valuesreadattemptsnumber of times. The default is10, which should be more than enough for most purposes. π
π¦ SEE ALSO π¦
π HISTORY π
The sgp40mox driver first appeared in NetBSD 10.0. π
π AUTHORS π
The sgp40mox driver was written by Brad Spencer <brad@anduin.eldar.org>. π
π 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. π
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. π
mwah π β this page is from Debian, dated October 7, 2021.
π¦ where this page comes from
- nixpkgs unstable: netbsd-source 11.0
- Copyright (c) 2021 Brad Spencer <brad@anduin.eldar.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms