Skip to content

Volatile Organic Compounds Sensor

The VolatileOrganicCompounds sensor class provides access to a sensor that detects the amount of volatile organic compounds suspended in air.

Creates a new VolatileOrganicCompounds object instance.

VolatileOrganicCompounds(options)

options

An object of properties used to construct the class.

sensor - The hardware connection definition.

interval (optional) - The sampling interval in milliseconds.

Returns a sample object containing the current VOC concentration data.

sample()

An object with the following property:

tvoc - A number that represents the sampled total volatile organic compounds in parts per billion (ppb).

const sensor = new device.sensor.VolatileOrganicCompounds({
sensor: {
io: device.io.I2C,
address: 0x58
}
});
const sample = sensor.sample();
console.log(`VOC Level: ${sample.tvoc} ppb`);

Volatile Organic Compounds