MQ Gas Sensors – How it works
How the sensor works
An MQ sensor is a type of gas sensor that operates on a chemiresistive principle, meaning it detects gases by measuring changes in electrical resistance.
The core component of an MQ sensor is a metal oxide semiconductor (MOS), typically made of tin dioxide (SnO₂). In clean air, this material has a high resistance, but when exposed to certain gases, a chemical reaction occurs that alters its conductivity.

Datasheets
The measuring range, preheat time, available gasses to detect and much more can be found in the datasheets:
| Sensor | Datasheet |
|---|---|
| MQ2 | Link |
| MQ3 | Link |
| MQ4 | Link |
| MQ5 | Link |
| MQ6 | Link |
| MQ7 | Link |
| MQ8 | Link |
| MQ9 | Link |
| MQ131 | Link |
| MQ135 | Link |
| MQ137 | Link |
| MQ138 | Link |
Communication (Native)
There are two pins used for communicating with the sensor: analog and digital.
The analog pin outputs the voltage from the sensor, which is then used by the dasduino board to calculate the levels of a particular gas. As stated previously, the resistance of the sensor falls as the concentration of gas increases. We can determine the gas concentration in ppm/ppb by using the ratio of the resistance measured during calibration (Ro) to the current sensor resistance (Rs).

The curve that the resistance follows for a specific gas must be approximated by the sensor. This is achieved by identifying attributes of the curves and applying a linear or exponential regression method. This process is explained in detail in the link below:
Understanding a gas sensor
Detailed guide on how to calculate the approximate curve of resistance by Jaycon
All of our sensors have a pre-configured regression method for each sensor! Check them out here
The digital pin works through the onboard potentiometer. Adjusting the potentiometer sets the voltage (gas concentration) at which the digital pin will be set to HIGH. This is commonly used as a trigger for an alarm if the concentration of a gas becomes too high.

Communication (Qwiic)
The Qwiic compatibility is made possible with the Atmel ATTINY404-SSNR. When using Qwiic, you are essentially communicating with an onboard ATTINY404-SSNR MCU via I2C communication, and the MCU detects the sensor's voltage level.

The breakout board operates with a default I2C address of 0x30; however, it can be changed using onboard switches. To change the breakout board's address, check out the Address selection. When detected, the ATTINY404-SSNR receives data from the sensor and passes it to the main MCU using the I2C data line.