What it shows
An MQ-2 gas sensor changes resistance when LPG, butane or smoke touches its heated element. The Arduino compares the reading to a threshold, sounds a buzzer, flashes a red LED and switches a 12 V DC fan through a relay to clear the air.
The science
The MQ-2 contains a tin dioxide layer kept warm by a small heater. In clean air its resistance is high; combustible gas molecules react on the surface and lower it. The module divides that resistance with a fixed resistor, so the analog output voltage rises with gas concentration. The Arduino reads it on A0 as a number from 0 to 1023. A threshold chosen by testing separates clean air from a leak, and a little hysteresis stops the fan from chattering on and off at the edge.
Materials
Cost: under Rs 1,500. Many items come from home or from waste; spare parts such as LEDs, motors and wire are in the store.
- An Arduino Uno clone and USB cable
- An MQ-2 gas sensor module
- A 5 V relay module
- A 12 V DC computer case fan with a 12 V adapter
- A 5 V buzzer, a red LED and a 220 Ω resistor
- A 16x2 I2C LCD (optional)
- Jumper wires and a breadboard
Safety
For this project: Test with a gas lighter held unlit near the sensor for a moment, never with a cylinder valve open. The relay switches only the 12 V fan. An adult must be present for the gas test. The sensor heater gets warm; do not touch it.
Never use mains electricity: power models with cells, batteries or a low-voltage adapter. Sharp and hot tools, flames and lab chemicals need an adult or your teacher beside you. Keep magnets, button cells and small parts away from young children, and wash your hands after making.
All the safety rulesStep by step
9 steps. Do them in order, and test each part before you go on to the next. Write what you notice in a notebook as you go.
Wire the MQ-2 module: VCC to 5 V, GND to GND, A0 to Arduino A0. Let it warm up for two minutes on first use.
Print analogRead(A0) to the serial monitor every half second and note the clean air value, usually 100 to 300.
Hold an unlit gas lighter near the sensor and press for a second; note how high the value climbs.
Choose a threshold about halfway between the clean and gas values and write it into the sketch.
Wire the buzzer to pin 6, the LED through its resistor to pin 7, and the relay IN to pin 8.
Connect the 12 V fan through the relay COM and NO contacts with its adapter.
In the loop, if the reading is above the threshold turn on the buzzer, LED and relay; turn them off only when the reading falls 50 below the threshold.
If using the LCD, show the live reading and the word SAFE or GAS.
Mount the sensor low in the model kitchen box, because LPG is heavier than air and collects near the floor.
What you should see
Within two seconds of gas reaching the sensor the buzzer sounds and the fan runs; both stop once the gas clears and the reading falls back.
Viva questions
A teacher or a judge will ask how it works. Try to answer each question before you open it, then compare.
1Why mount the sensor low?
LPG is denser than air and sinks, so a low sensor detects a leak sooner.
2What is hysteresis and why use it?
Two different switching levels for on and off; it prevents rapid chattering when the reading hovers at the threshold.
3Why does the sensor need to warm up?
The tin dioxide only responds correctly at its working temperature; a cold sensor gives drifting readings.
4Can this sensor tell LPG from smoke?
No. It responds to several gases, so it says something combustible is present but not which one.
Take it further
Replace the Uno with an ESP8266 and send a phone notification through a free IoT app when the alarm triggers.
Change one thing, measure what happens, and add a table or chart of your readings: that is what turns a model into your own investigation.
