User Manual

111
Step 3: Run
sudo python 22_gas_sensor.py
Place a lighter close to the MQ-2 gas sensor, and press the switch to release gasses. A value
between 0 and 255 will be displayed on the screen. If harmful gases reach a certain
concentration, the buzzer will beep, and “Danger Gas!” will be printed on the screen.
You can also turn the shaft of the potentiometer on the module to raise or reduce the
concentration threshold.
The MQ-2 gas sensor needs to be heated up for a while. Wait until the value printed on
screen stays steady and the sensor gets warm, which means it can work normally and
sensitively at that time.
Note: I
t is normal that the gas sensor generates heat. Actually, the higher the temperature
is, the sensor is more sensitive.