Gas Sensors
Gas sensors are electronic devices used to detect the presence or concentration of gases in the surrounding environment. They are used in gas-leak detection, industrial monitoring, air-quality systems, automotive equipment, safety systems, appliances and embedded electronics.
What Is a Gas Sensor?
A gas sensor detects a particular gas or group of gases and converts the interaction between the gas and the sensing element into an electrical signal.
Depending on the sensor technology, the output may be represented by:
- A resistance change
- A voltage
- A current
- A digital signal
The electrical output can then be measured by a dedicated circuit, microcontroller or monitoring system.
How Gas Sensors Work
Different gas sensors use different physical and chemical principles.
Gas in environment
│
▼
Gas sensor
│
▼
Physical / chemical change
│
▼
Electrical signal
│
▼
Signal conditioning
│
▼
Controller / alarm
The sensor technology must be selected according to the gas that needs to be detected and the required measurement range.
Main Types of Gas Sensors
Common gas-sensing technologies include:
- Metal-oxide semiconductor sensors
- Electrochemical sensors
- Catalytic bead sensors
- Infrared gas sensors
- Photoionization detectors
- Thermal-conductivity sensors
Metal-Oxide Semiconductor Gas Sensors
Metal-oxide semiconductor gas sensors detect gases through changes in the electrical properties of a sensing material.
A change in the surrounding gas concentration can cause the resistance of the sensing element to change.
This makes the sensor suitable for circuits that measure resistance or convert the resistance into a voltage.
MQ Gas Sensors
MQ-series gas sensors are commonly encountered in hobby and embedded electronics projects.
Examples include:
- MQ-2
- MQ-3
- MQ-4
- MQ-5
- MQ-6
- MQ-7
- MQ-8
- MQ-9
- MQ-135
Different MQ sensors are designed with different sensitivities to different gases. The exact gas response and measurement characteristics must be obtained from the particular sensor's documentation.
MQ-2 Gas Sensor
The MQ-2 is commonly used for detecting gases such as smoke and combustible gases.
Typical modules contain:
- Gas-sensitive element
- Heater
- Load resistor
- Signal output
Many modules provide both analog and comparator-based digital outputs.
MQ-3 Gas Sensor
The MQ-3 is commonly associated with alcohol-vapor detection.
It is used in some educational and embedded sensing applications.
Its response depends on the sensor environment, temperature, humidity and the gases present.
MQ-4 Gas Sensor
The MQ-4 is commonly used for methane detection.
It belongs to the heated metal-oxide semiconductor sensor family.
MQ-5 Gas Sensor
The MQ-5 is commonly used for detecting combustible gases and is associated with gases such as LPG and natural gas.
The actual sensitivity depends on the sensor and operating conditions.
MQ-6 Gas Sensor
The MQ-6 is commonly associated with LPG and other combustible gas detection applications.
It is frequently used in simple gas-detection projects.
MQ-7 Gas Sensor
The MQ-7 is commonly associated with carbon-monoxide detection.
Its operation involves a controlled heater cycle, so the sensor requires appropriate heater control and measurement conditions.
MQ-135 Gas Sensor
The MQ-135 is commonly used in projects involving air-quality and pollution-related measurements.
It responds to several gases, so it should not automatically be treated as a precise single-gas concentration instrument without suitable calibration and characterization.
Gas Sensor Heater
Many metal-oxide gas sensors contain an internal heater.
Power │ ▼ Heater │ ▼ Heated sensing material │ ▼ Gas interaction │ ▼ Resistance change
The heater establishes the operating temperature required by the sensing element.
The heater may consume significantly more power than the sensing circuit.
Gas Sensor Resistance
For many semiconductor gas sensors, the sensing material changes resistance when exposed to gas.
The resistance is normally measured indirectly using a load resistor and voltage-divider circuit.
VCC │ RL │ ├──── VOUT │ Rs │ GND
Here, Rs represents the sensing element resistance.
Gas Sensor Voltage Divider
A voltage divider converts the sensor resistance into a measurable voltage.
VOUT = VCC × Rs / (RL + Rs)
The exact relationship depends on which resistor is connected to the supply and which is connected to ground.
The measured voltage can be read by an ADC.
Gas Sensor Analog Output
An analog gas sensor output varies according to the sensor's electrical response.
Gas concentration
│
▼
Sensor resistance
│
▼
Voltage divider
│
▼
Analog voltage
│
▼
ADC
│
▼
Microcontroller
The relationship between gas concentration and output is not necessarily linear.
Gas Sensor Digital Output
Many gas-sensor modules include a comparator circuit that converts the analog sensor signal into a simple digital output.
Gas Sensor
│
▼
Analog Signal
│
▼
Comparator
│
▼
Digital Output A potentiometer on the module can often be used to adjust the detection threshold.
Gas Sensor Calibration
Gas sensors generally require calibration if quantitative gas concentration measurements are required.
Calibration may involve:
- Known reference gas concentration
- Sensor resistance measurement
- Temperature compensation
- Humidity compensation
- Sensor aging considerations
A simple module output should therefore not automatically be interpreted as an accurate concentration measurement.
Gas Sensor Warm-Up
Heated semiconductor gas sensors require an appropriate warm-up period.
The sensor's output can change considerably during warm-up as the sensing element reaches its operating condition.
For reliable measurements, follow the manufacturer's recommended preheating and operating procedures.
Gas Sensor Sensitivity
Sensitivity describes how strongly the sensor output responds to changes in gas concentration.
Important factors include:
- Gas type
- Concentration
- Temperature
- Humidity
- Sensor age
- Heater temperature
- Load resistance
Gas Sensor Selectivity
Selectivity describes how strongly a sensor responds to the target gas compared with other gases.
Many low-cost semiconductor gas sensors respond to several gases. Therefore they may be suitable for gas detection but unsuitable for accurate identification or concentration measurement of a single gas without additional techniques.
Electrochemical Gas Sensors
Electrochemical gas sensors use chemical reactions at electrodes to produce an electrical signal related to the concentration of the target gas.
They are commonly used for detecting specific gases in safety and industrial monitoring systems.
Compared with many simple semiconductor sensors, electrochemical sensors can provide better selectivity for particular gases.
Catalytic Gas Sensors
Catalytic sensors can detect combustible gases by measuring the effect of gas oxidation on a heated sensing element.
They are used in combustible-gas detection systems.
Infrared Gas Sensors
Infrared gas sensors detect gases based on their absorption of specific infrared wavelengths.
They can provide good selectivity for gases with suitable infrared absorption characteristics.
Infrared gas sensing is widely used in industrial and environmental measurement systems.
Gas Sensor Comparison
| Technology | Typical Characteristic | Application |
|---|---|---|
| Metal-oxide semiconductor | Resistance change | Low-cost gas detection |
| Electrochemical | Electrochemical current | Specific gas monitoring |
| Catalytic | Combustion-related response | Combustible gas detection |
| Infrared | Optical absorption | Industrial and environmental measurement |
Gas Sensors and Microcontrollers
A microcontroller can measure an analog gas sensor and use the result for monitoring or control.
Gas Sensor │ ▼ Signal Conditioning │ ▼ ADC │ ▼ Microcontroller │ ├── Display ├── Alarm ├── Relay └── Network
Gas Sensor with ESP32
The ESP32 can interface with gas-sensor modules through its analog or digital inputs.
For example, an MQ-series module can provide an analog output that is connected to an ADC input.
However, the voltage range must be checked carefully before connecting a module to an ESP32 ADC input.
A suitable voltage divider or signal-conditioning circuit may be needed if the module output exceeds the microcontroller's permitted input range.
Gas Sensor Wiring
Before connecting a gas sensor, identify:
- Supply voltage
- Heater voltage
- Heater current
- Sensor output
- Load resistance
- Logic voltage
- Analog output range
Some gas sensors consume substantial heater power, so the power supply must be capable of providing the required current.
MQ Sensor Module Wiring
A typical MQ module may provide:
VCC GND AOUT DOUT
AOUT provides an analog signal while DOUT is generated by a comparator.
The exact pinout depends on the module.
Gas Sensor Power Consumption
Heated gas sensors can consume significantly more power than many other small sensors.
The heater must reach the required operating temperature, which can require substantial current.
When designing a battery-powered system, heater power should therefore be included in the overall power budget.
Gas Sensor Temperature Effects
Temperature can affect gas-sensor characteristics.
For semiconductor sensors, both the heater condition and ambient temperature can influence the sensor response.
Precision systems may therefore require temperature compensation.
Gas Sensor Humidity Effects
Humidity can also affect gas-sensor measurements.
This is particularly important in environmental and air-quality applications.
For accurate measurements, the sensor's specified humidity range and compensation requirements should be considered.
Gas Sensor Response Time
Response time describes how quickly the sensor output changes after the gas concentration changes.
It depends on:
- Sensor technology
- Gas concentration
- Gas flow
- Sensor construction
- Temperature
- Measurement circuit
Gas Sensor Recovery Time
Recovery time is the time required for the sensor output to return toward its normal value after the gas concentration decreases.
The recovery behavior depends on the sensing technology and gas being measured.
Gas Sensor Placement
Sensor placement can strongly affect gas detection.
Consider:
- Gas density
- Air circulation
- Ventilation
- Possible leak location
- Heat sources
- Humidity
- Dust and contamination
The correct mounting position depends on the gas and the application.
Gas Leak Detection
Gas sensors can be used as part of a gas-leak detection system.
Gas leak │ ▼ Gas sensor │ ▼ Controller │ ├── Alarm ├── Warning light ├── Ventilation └── Monitoring system
A safety-critical gas detection system should use appropriately certified sensors and equipment rather than relying solely on a hobby-grade sensor module.
Gas Sensor Alarm
A comparator or microcontroller can activate an alarm when the sensor output exceeds a predetermined threshold.
Gas concentration │ ▼ Sensor │ ▼ Threshold detection │ ▼ Alarm ```For safety applications, the threshold and sensor response must be selected according to the actual gas hazard and applicable requirements.
Gas Sensors in Air-Quality Systems
Gas sensors can be used to monitor components of indoor or outdoor air.
Depending on the sensor technology, systems may monitor gases associated with:
- Combustion
- Industrial emissions
- Indoor air contamination
- Vehicle exhaust
- Volatile compounds
Testing an MQ Gas Sensor
A basic MQ module can be tested by checking its power and observing its analog output.
- Check the module supply voltage.
- Check ground.
- Allow the sensor to warm up according to its specifications.
- Measure the analog output.
- Expose the sensor only to a controlled and appropriate test source.
- Observe the output change.
Do not use uncontrolled or dangerous gas sources for testing.
Testing a Gas Sensor with a Multimeter
A multimeter can be used to check:
- Supply voltage
- Heater voltage
- Heater resistance where appropriate
- Analog output voltage
- Continuity of wiring
A multimeter alone cannot establish whether a gas sensor provides accurate gas-concentration measurements.
Gas Sensor Faults
| Symptom | Possible Cause |
|---|---|
| No output change | Sensor fault, wiring problem or insufficient warm-up |
| Output always high | Sensor, load resistor, wiring or environmental problem |
| Output always low | Sensor, wiring or signal-conditioning problem |
| Unstable reading | Noise, temperature, humidity or unstable supply |
| Sensor does not heat | Heater supply, wiring or heater failure |
| Incorrect gas reading | Calibration, cross-sensitivity or environmental effects |
Gas Sensor Does Not Heat
For a heated sensor, first check the heater circuit.
- Measure heater supply voltage.
- Check heater current where appropriate.
- Check wiring.
- Check heater resistance according to the manufacturer's specification.
- Check for damaged sensor elements.
Gas Sensor Output Is Unstable
Possible causes include:
- Insufficient warm-up
- Unstable power supply
- Temperature changes
- Humidity changes
- Electrical noise
- Gas-flow changes
- Sensor aging
Gas Sensor Replacement
A replacement gas sensor should not be selected only by physical appearance.
Check:
- Target gas
- Sensor technology
- Measurement range
- Sensitivity
- Supply voltage
- Heater requirements
- Output characteristics
- Operating temperature
- Humidity range
- Physical package
- Calibration requirements
How to Select a Gas Sensor
- Identify the gas that must be detected.
- Determine whether detection or quantitative measurement is required.
- Determine the expected concentration range.
- Select an appropriate sensing technology.
- Check selectivity and cross-sensitivity.
- Check response time.
- Check operating temperature.
- Check humidity requirements.
- Check power consumption.
- Check the electrical interface.
- Determine calibration requirements.
- Check the required safety certifications for the application.
Choosing Between Gas Sensor Technologies
| Technology | Main Characteristic | Typical Application |
|---|---|---|
| Metal-oxide semiconductor | Resistance change | Low-cost detection and embedded projects |
| Electrochemical | Electrochemical current | Specific gas monitoring |
| Catalytic | Combustible gas response | Flammable-gas detection |
| Infrared | Gas absorption measurement | Industrial and environmental monitoring |
Gas Sensor Applications
- Gas leak detection
- Air-quality monitoring
- Industrial monitoring
- Automotive systems
- Combustion monitoring
- Environmental monitoring
- HVAC systems
- Laboratory instruments
- Safety systems
- IoT monitoring devices
- Embedded electronics
Advantages of Gas Sensors
- Allow automatic gas detection
- Can provide continuous monitoring
- Available for many different gases
- Can interface with microcontrollers
- Can activate alarms and control systems
- Available in low-cost and industrial technologies
Limitations of Gas Sensors
- Many sensors respond to multiple gases.
- Temperature can affect measurements.
- Humidity can affect measurements.
- Some sensors require warm-up.
- Some sensors consume significant heater power.
- Accurate concentration measurements require calibration.
- Sensor aging can affect performance.
Common Gas-Sensor Design Mistakes
- Using a sensor designed for the wrong gas
- Ignoring cross-sensitivity
- Ignoring warm-up requirements
- Using an inadequate power supply
- Connecting an excessive output voltage to a microcontroller ADC
- Ignoring temperature and humidity effects
- Assuming an analog voltage directly represents gas concentration
- Failing to calibrate a quantitative measurement system
- Using hobby sensors for safety-critical applications
- Ignoring the sensor's operating environment
Key Points
- Gas sensors detect gases and convert their presence or concentration into an electrical signal.
- Metal-oxide sensors commonly operate through changes in sensing-element resistance.
- Many MQ-series sensors contain an internal heater.
- Electrochemical sensors are commonly used for more selective gas detection.
- Infrared sensors detect gases through wavelength-specific optical absorption.
- Gas-sensor outputs are not necessarily linear with gas concentration.
- Temperature and humidity can affect sensor readings.
- Calibration is important for quantitative gas measurements.
- Heated gas sensors can consume substantial power.
- Microcontrollers such as the ESP32 can read gas-sensor outputs through suitable interfaces.
- Always verify voltage levels before connecting a gas-sensor module to a microcontroller.
- Safety-critical gas detection should use appropriately certified equipment.