
The MQ-2 gas sensor is a popular component in safety- and environment-monitoring projects, used to detect flammable gases such as LPG, propane, butane and methane, in addition to its ability to sense smoke.
Components needed
An Arduino Uno board, an MQ-2 gas sensor module (usually sold pre-mounted on a small breakout board with a potentiometer for sensitivity adjustment), and connecting wires.
Wiring it up
The module's VCC pin connects to the Arduino's 5V pin, GND connects to ground, and the analog output AO connects to analog pin A0 to read a signal strength proportional to the detected gas concentration.
How it works
The sensor contains an internal heating element that needs a few minutes of preheating before its readings stabilize and become reliable — a step that's often skipped on a first try. The code periodically reads the analog value from A0 via analogRead() and prints it to the serial monitor; the higher the gas concentration in the surrounding air, the higher the reading. To build an actual alarm system, you can add a threshold that the reading is compared against to trigger a buzzer or warning message once it's exceeded.
You can find the MQ-2 sensor module at Juthour Tech.
اترك تعليقا