Description
The MQ-2 sensor can detect multiple gases (CO, H2, CH4, LPG, propane, alcohol, smoke) and outputs analog voltage. This project can convert it to digital using ADS1015 or ADS1115 and filter out the target gases.
The sensor can be inaccurate so don't use those measurements if you need them for security purposes. Use some professional measurement device if you need to do this.
Gas detection alternatives and similar packages
Based on the "Hardware" category.
Alternatively, view Gas detection alternatives based on common mentions on social networks and blogs.
-
PyUserInput
A module for cross-platform control of the mouse and keyboard in python that is simple to install and use. -
pyTeliumManager
Python library to manipulate Ingenico mobile payment device like iCT220 or iWL220 equipped with Telium Manager. RS232/USB. -
BusyLight For Humans™
DISCONTINUED. Control USB connected presence lights from multiple vendors via the command-line or web API.
Scout Monitoring - Free Django app performance insights with Scout Monitoring
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of Gas detection or a related project?
README
Gas detection
Gas detection for Raspberry Pi using ADS1x15 and MQ-2 sensors.
Description
The MQ-2 sensor can detect multiple gases (CO, H2, CH4, LPG, propane, alcohol, smoke) and outputs analog voltage. This project can convert it to digital using ADS1015 or ADS1115 and filter out the target gases.
The sensor can be inaccurate so don't use those measurements if you need them for security purposes. Use some professional measurement device if you need to do this.
Usage
The detection class uses ADS1115 and it's I2C address 0x48
by default. It assumes the sensor is connected to P0
. You can also pass them to arguments.
The ro
value is about 1000
, but it needs to be calibrated. This is done automatically if it is not specified. The calibration must be done in good fresh air to make measurements more accurate. Alternativly, you can save the calibration value and later pass it as ro
argument.
from gas_detection import GasDetection
detection = GasDetection()
You can then read percentage of gases in parts per million (ppm). The measurements are returned as dictionary and gas be accessed by GAS_XX
constant.
ppm = detection.percentage()
print('CO: {} ppm'.format(ppm[detection.CO_GAS]))
print('H2: {} ppm'.format(ppm[detection.H2_GAS]))
print('CH4: {} ppm'.format(ppm[detection.CH4_GAS]))
print('LPG: {} ppm'.format(ppm[detection.LPG_GAS]))
print('PROPANE: {} ppm'.format(ppm[detection.PROPANE_GAS]))
print('ALCOHOL: {} ppm'.format(ppm[detection.ALCOHOL_GAS]))
print('SMOKE: {} ppm\n'.format(ppm[detection.SMOKE_GAS]))
You can also look to example file for more examples. For more details how the values are calculated you can read tutorial on Raspberry Pi Tutorials.
Versioning
This library uses SemVer for versioning. For the versions available, see the tags on this repository.
License
This library is licensed under the GPLv3+ license. See the LICENSE file for details.
A lot of code has been taken from Raspberry-Pi-Gas-Sensor-MQ. Thank you @tutRPi and others who contributed to that repository.
*Note that all licence references and agreements mentioned in the Gas detection README section above
are relevant to that project's source code only.