Skip to content

Methane Sensor

The Methane sensor class provides access to a methane sensor.

Creates a new Methane object instance.

Methane(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 methane concentration data.

sample()

An object with the following property:

CH4 - A number that represents the sampled methane in parts per million (ppm).

const sensor = new device.sensor.Methane({
sensor: {
io: device.io.I2C,
address: 0x25
}
});
const sample = sensor.sample();
console.log(`Methane level: ${sample.CH4} ppm`);

Methane