MicroPython AGS02MA Driver

ags02ma

MicroPython Driver for the AGS02MA TVOC sensor

  • Author(s): ladyada, Jose D. Montoya

ags02ma

MicroPython Driver for the AGS02MA TVOC sensor

  • Author(s): ladyada, Jose D. Montoya

class micropython_ags02ma.ags02ma.AGS02MA(i2c, address: int = 0x1A)[source]

Driver for the AGS02MA Sensor connected over I2C. I2C communication speed cannot be higher than 30 kHz

Parameters:
i2c : I2C

The I2C bus the AGS02MA is connected to.

address : int

The I2C device address. Defaults to 0x69

Raises:

RuntimeError – if the sensor is not found

Quickstart: Importing and using the device

Here is an example of using the AGS02MA class. First you will need to import the libraries to use the sensor

from machine import Pin, I2C
import ags02ma

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

i2c = I2C(1, sda=Pin(2), scl=Pin(3))
ags02ma = ags02ma.AGS02MA(i2c)

Now you have access to the attributes

tvoc = ags02ma.TVOC
property TVOC : float

The calculated Total Volatile Organic Compound measurement, in ppb

property gas_resistance : float

The resistance of the MEMS gas sensor in 0.1 Kohm