Atmospheric Threats: Hazardous Gas Detection
While a DHT11 measures generic bedroom humidity, the Hazardous Gas Leak Detector actively hunts for toxic and explosive chemicals. Utilizing the highly sensitive MQ-Sensor series, this project acts as a life-saving industrial alarm capable of sniffing out propane, methane, or carbon monoxide leaks long before the human nose can detect them.

The MQ-Sensor Tin Dioxide Heater Physics
An MQ gas sensor works fundamentally differently than a heat or light sensor. It utilizes a tiny, physical internal oven!
- The Core Engine: The MQ-2 (Combustible Gas) or MQ-7 (Carbon Monoxide) sensor contains a microscopic tube of Tin Dioxide (SnO2) ceramic.
- The Arduino sends 5V power into the internal heater coil. The sensor literally becomes extremely hot to the touch.
- The Chemical Reaction: When clean air passes through the hot ceramic tube, the electrical resistance stays incredibly high.
- However, if a hydrocarbon (like Butane from a lighter) enters the hot tube, a chemical reduction occurs. The Tin Dioxide instantly loses its electrical resistance.
Defining the Toxicity Thresholds (PPM Mapping)
The analog signal from the MQ-2 drops from 800 down to 200 when exposed to a gas leak.
- The
analogRead(A0)data is mathematically chaotic and non-linear. - You must write a complex calibration loop inside
setup()using logarithmic math and theRo/Rsratio to map the raw voltage data into a true "Parts Per Million" (PPM) standardized float! - The Actuation Interface:
if (CO_Gas_PPM > 400.0) { // 400 PPM = Instantly dangerous to human life!
TriggerKlaxonSiren();
DeployIndustrialExtractionFans();
sendSMSAlert();
}
Safety Hardware Setup
- Arduino Uno/Mega.
- MQ-2 (Combustible) or MQ-7 (Carbon Monoxide) Sensor Modules. (Note: These sensors require a 48-hour 'Burn-in' period of staying hot before they provide mathematically stable readings!)
- Opto-Isolated 5V Relay Module to control 12V exhaust fans.
- SIM900 GSM Module or ESP8266 Wi-Fi board to instantly blast SMS text messages to the homeowner or facility manager.