Skip to content

Using Adafruit ahtx0 for temp-humidity to calibrate sgp30 for CO2 and VOC levels

Notifications You must be signed in to change notification settings

jamesrandall007/Temperature_Humidity_CO2_VOC_monitor

Repository files navigation

Using Adafruit VOC detector:

Software and Dependencies:

class adafruit_sgp30.Adafruit_SGP30(i2c, address=88 )[source]

A driver for the SGP30 gas sensor.

Parameters

  • i2c (I2C) – The I2C bus the SGP30 is connected to.
  • address (int) – The I2C address of the device. Defaults to 0x58

Get hex address of existing I2C devices:

$sudo i2cdetect -y 1

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:                         -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- 38 -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --  

Quickstart: Importing and using the SGP30 temperature sensor

Here is one way of importing the Adafruit_SGP30 class so you can use it with the name sgp30. First you will need to import the libraries to use the sensor

import busio import board import adafruit_sgp30

Once this is done you can define your busio.I2C object and define your sensor object

i2c = busio.I2C(board.SCL, board.SDA, frequency=100000) 
sgp30 = adafruit_sgp30.Adafruit_SGP30(i2c)

Now you have access to the Carbon Dioxide Equivalent baseline using the baseline_eCO2 attribute and the Total Volatile Organic Compound baseline using the baseline_TVOC

eCO2 = sgp30.baseline_eCO2 TVOC = sgp30.baseline_TVOC

property Ethanol

Ethanol Raw Signal in ticks

property H2

H2 Raw Signal in ticks

property TVOC

Total Volatile Organic Compound in parts per billion.

property baseline_TVOC

Total Volatile Organic Compound baseline value

property baseline_eCO2

Carbon Dioxide Equivalent baseline value

property eCO2

Carbon Dioxide Equivalent in parts per million

get_iaq_baseline()[source]

Retreive the IAQ algorithm baseline for eCO2 and TVOC

iaq_init()[source]

Initialize the IAQ algorithm

iaq_measure()[source]

Measure the eCO2 and TVOC

raw_measure()[source]

Measure H2 and Ethanol (Raw Signals)

set_iaq_baseline(eCO2, TVOC )[source]

Set the previously recorded IAQ algorithm baseline for eCO2 and TVOC

set_iaq_humidity(gramsPM3 )[source]

Set the humidity in g/m3 for eCO2 and TVOC compensation algorithm

set_iaq_relative_humidity(celsius, relative_humidity )[source]

Set the humidity in g/m3 for eCo2 and TVOC compensation algorithm. The absolute humidity is calculated from the temperature (Celsius) and relative humidity (as a percentage).

Temp Humid sensor very easy:

from icecream import ic 
import adafruit_ahtx0

# Create the sensor object using I2C
sensor = adafruit_ahtx0.AHTx0(board.I2C())

temp_sensor = sensor.temperature
humidity_sensor = sensor.relative_humidity

ic(int(temp_sensor), int(humidity_sensor))

About

Using Adafruit ahtx0 for temp-humidity to calibrate sgp30 for CO2 and VOC levels

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages