pyupm_gas module

class pyupm_gas.Gas(gasPin)[source]

Bases: object

findThreshold(ctx, threshold, buffer, len)[source]

int findThreshold(thresholdContext *ctx, unsigned int threshold, uint16_t *buffer, int len)

Given the sampled buffer, this method returns TRUE/FALSE if the threshold is reached

ctx: Threshold context

threshold: Sample threshold

buffer: Buffer with samples

len: Buffer length

getSample()[source]

int getSample()

Returns one sample from the sensor

getSampledData(ctx)[source]

int getSampledData(thresholdContext *ctx)

Returns average data for the sampled window

ctx: Threshold context

getSampledWindow(freqMS, numberOfSamples, buffer)[source]

int getSampledWindow(unsigned int freqMS, int numberOfSamples, uint16_t *buffer)

Gets samples from the gas sensor according to the provided window and number of samples

freqMS: Time between each sample (in milliseconds)

numberOfSamples: Number of sample to sample for this window

buffer: Buffer with sampled data

printGraph(ctx, resolution)[source]

void printGraph(thresholdContext *ctx, uint8_t resolution)

Prints a running average of the threshold context

ctx: Threshold context

class pyupm_gas.MQ2(gasPin)[source]

Bases: pyupm_gas.Gas

API for the MQ2 Gas Sensor.

ID: mq2

Name: MQ2 Methane, Butane, Liquefied Petroleum Gas (LPG), and Smoke Sensor

Category: gaseous

Manufacturer: seeed

Connection: analog

Kit: hak

Link:http://wiki.seeed.cc/Grove-Gas_Sensor-MQ2/ The MQ2 Gas Sensor module is useful for gas leakage detection (in home and industry). It can detect LPG, i-butane, methane, alcohol, hydrogen, smoke, and other combustible gases. It’s a medium-sensitivity sensor with a detection range of 300-10,000 ppm.

C++ includes: mq2.hpp

name()[source]

std::string name()

Returns the name of the sensor

class pyupm_gas.MQ3(gasPin)[source]

Bases: pyupm_gas.Gas

API for the MQ3 Gas Sensor.

ID: mq3

Name: MQ3 Alcohol, Ethanol, Smoke Sensor

Category: gaseous

Manufacturer: seeed

Connection: analog

Link:http://wiki.seeed.cc/Grove-Gas_Sensor-MQ3/ The MQ3 Gas Sensor module is useful for gas leakage detection (in home and industry). It can detect alcohol vapors and benzine. It’s highly sensitive but has a long warm-up time of about 1 minute. It’s detection range is 0.04-4 mg/L Alcohol.

C++ includes: mq3.hpp

name()[source]

std::string name()

Returns the name of the sensor

class pyupm_gas.MQ4(gasPin)[source]

Bases: pyupm_gas.Gas

API for the MQ4 Gas Sensor.

ID: mq4

Name: MQ4 Methane and Connecticut Natural Gas (CNG) Sensor

Category: gaseous

Manufacturer: dfrobot

Connection: analog

Link:https://www.dfrobot.com/index.php?route=product/product&product_id=683 The MQ4 Gas Sensor module is useful for detecting CH4 (Methane), and natural gas concentrations in the air. It has a detection range of 100-10000 ppm.

For optimum use, it requires calibration after a pre-heat time of at least 24 hours. See the datasheet for details.

C++ includes: mq4.hpp

name()[source]

std::string name()

Returns the name of the sensor

class pyupm_gas.MQ5(gasPin)[source]

Bases: pyupm_gas.Gas

API for the MQ5 Gas Sensor.

ID: mq5

Name: MQ5 Natural Gas and Liquefied Petroleum Gas (LPG) Sensor

Category: gaseous

Manufacturer: seeed

Connection: analog

Link:http://wiki.seeed.cc/Grove-Gas_Sensor-MQ5/

Kit: eak The MQ5 Gas Sensor module is useful for gas leakage detection (in home and industry). It can detect LPG, natural gas, town gas, and so on. It is highly sensitive and has a detection range of 300-10,000 ppm.

C++ includes: mq5.hpp

name()[source]

std::string name()

Returns the name of the sensor

class pyupm_gas.MQ6(gasPin)[source]

Bases: pyupm_gas.Gas

API for the MQ6 LPG Gas Sensor.

ID: mq6

Name: MQ6 Liquefied Petroleum Gas (LPG) and Butane Sensor

Category: gaseous

Manufacturer: dfrobot

Connection: analog

Link:https://www.dfrobot.com/wiki/index.php/LPG_Gas_Sensor(MQ6)_(SKU:SEN0131) The MQ6 Gas Sensor module is useful for detecting LPG, iso-butane, propane, and LNG concentrations in the air. It has a detection range of 200-10000 ppm.

For optimum use, it requires calibration after a pre-heat time of at least 24 hours. See the datasheet for details.

C++ includes: mq6.hpp

name()[source]

std::string name()

Returns the name of the sensor

class pyupm_gas.MQ7(gasPin)[source]

Bases: pyupm_gas.Gas

API for the MQ7 CO Gas Sensor.

ID: mq7

Name: MQ7 Carbon Monoxide Sensor

Category: gaseous

Manufacturer: dfrobot

Connection: analog

Link:https://www.dfrobot.com/wiki/index.php/Carbon_Monoxide_Gas_Sensor(MQ7)_(SKU:SEN0132) The Grove MQ7 Gas Sensor module is useful for detecting Carbon Monoxide (CO) concentrations in the air. It has a detection range of 20-2000 ppm.

For optimum use, it requires calibration after a pre-heat time of 48 hours. See the datasheet for details.

C++ includes: mq7.hpp

name()[source]

std::string name()

Returns the name of the sensor

class pyupm_gas.MQ8(gasPin)[source]

Bases: pyupm_gas.Gas

API for the MQ8 Hydrogen (H2) Gas Sensor.

ID: mq8

Name: MQ8 Flammable (Hydrogen) Gas Sensor

Category: gaseous

Manufacturer: dfrobot

Connection: analog

Link:https://www.dfrobot.com/wiki/index.php/Hydrogen_Gas_Sensor(MQ8)_(SKU:SEN0133) The MQ8 Gas Sensor module is useful for detecting Hydrogen gas concentrations in the air. It has a detection range of 100-10000 ppm.

For optimum use, it requires calibration after a pre-heat time of at least 24 hours. See the datasheet for details.

C++ includes: mq8.hpp

name()[source]

std::string name()

Returns the name of the sensor

class pyupm_gas.MQ9(gasPin)[source]

Bases: pyupm_gas.Gas

API for the MQ9 Gas Sensor.

ID: mq9

Name: MQ9 Carbon Monoxide (CO) and Flammable Gas Sensor

Category: gaseous

Manufacturer: seeed

Connection: analog

Link:http://wiki.seeed.cc/Grove-Gas_Sensor-MQ9/ The Grove MQ9 Gas Sensor module is useful for gas leakage detection (in home and industry). It can detect carbon monoxide, coal gas, and liquefied gas. Its sensitivity is 10-1,000 ppm CO, and 100-10,000 ppm Gas.

C++ includes: mq9.hpp

name()[source]

std::string name()

Returns the name of the sensor

class pyupm_gas.TP401(gasPin)[source]

Bases: pyupm_gas.Gas

API for the TP401 Gas Sensor.

ID: tp401

Name: TP401 Gas Sensor

Other Names: Grove Air Quality Sensor

Category: gaseous

Manufacturer: seeed

Connection: analog

Link:https://www.seeedstudio.com/Grove-Air-quality-sensor-p-1065.html

Kit: hak The TP401 Gas Sensor module is useful for monitoring air purity indoors. It can detect CO and a wide range of other harmful gases, but, due to a limited detection range, it should be used only when qualitative results are needed. Example applications are air recirculation, ventilation systems, and refreshing sprayers. The sensor is linear and should be roughly sensitive to 0-20 ppm CO from 0-4 V. Note: the sensor requires 2-3 minutes to warm up initially and 48 hours of operation to stabilize completely.

C++ includes: tp401.hpp

getPPM()[source]

float getPPM()

Returns one sample in parts per million (ppm) of CO in the air based on the following sensor calibration: 0-4 V is roughly 0-20 ppm CO

New sample converted to ppm CO

name()[source]

std::string name()

Returns the name of the sensor

Name of the sensor

class pyupm_gas.thresholdContext[source]

Bases: object

averageReading
averagedOver
runningAverage
class pyupm_gas.uint16Array(nelements)[source]

Bases: object

cast()[source]
static frompointer()