DIY Gas Leak Alarm Circuit Design and Step-by-Step Assembly Guide

gas leakage detector circuit diagram

Start with a MQ-5 sensor or TGS2611 for combustible vapor detection–both respond within 10–30 seconds to concentrations as low as 200 ppm. Connect the sensing element to a LM393 comparator to transform analog readings into a digital alert. A 5V relay module can trigger an external alarm or emergency shutoff when thresholds exceed 1000 ppm, reducing false positives while ensuring immediate action.

Power the assembly using a 9V battery or 12V DC adapter, but include a 7805 voltage regulator to stabilize output at 5V. Add a 10kΩ potentiometer to adjust sensitivity without recalibrating the entire setup. For redundancy, wire a second sensor (e.g., MQ-9 for carbon monoxide) in parallel–cross-checking readings eliminates single-point failure.

Mount components on a perfboard with 2.54mm pitch, keeping trace lengths under 3 cm to minimize interference. Route signal wires away from AC lines, and shield them with braided copper if the environment includes high EMI. Test the system in a controlled space using 5% butane (or 4% propane) mixtures–verify the relay engages at the target concentration and resets reliably afterward.

Label all connections with heat-shrink tubing or permanent markers, then encase the board in a vented ABS enclosure to protect against dust while allowing vapor ingress. Use M3 standoffs to secure the PCB inside, preventing vibration-induced shorts. For mobile deployments, add a LiPo battery with a TP4056 charging module–monitor voltage via an ATtiny85 to log events and trigger low-power alerts.

How to Build a Reliable Hazardous Vapor Alert System

Use a MQ-2 sensor as the primary sensing element–it reacts to methane, propane, butane, and other combustible fumes within 300–10,000 ppm, triggering at 1,000 ppm with a response time under 10 seconds. Place the sensor 10–30 cm above floor level for optimal detection of heavier-than-air vapors; lighter-than-air vapors require ceiling placement. Calibrate the sensor in clean air first: apply 5 VDC to the heater, wait 24 hours, then measure resistance across the sensing element–clean-air resistance should stabilize between 10–60 kΩ.

  • Power the heater with a 5 VDC, 300–500 mA supply; exceeding 5.5 VDC reduces sensor lifespan.
  • Connect the sensing element in series with a 10 kΩ potentiometer to fine-tune alert thresholds.
  • Use a 100 nF decoupling capacitor across the supply pins to suppress noise.
  • Avoid soldering directly to sensor leads–use connectors to prevent thermal damage.

The sensor’s analog output (0–5 VDC) feeds into a LM358 op-amp configured as a comparator. Set the reference voltage to 2.5 VDC via a 10 kΩ voltage divider–this ensures 1,000 ppm concentrations produce a >2.5 VDC output, switching the comparator high. The comparator’s output drives a 2N2222 transistor in open-collector mode, which sinks current from a 12 VDC, 30 mA piezoelectric buzzer or a 1 W, 8 Ω speaker for audible alerts.

For visual warnings, route the transistor’s output to a 5 mm red LED with a 220 Ω current-limiting resistor. If local alerts aren’t sufficient, integrate a HC-05 Bluetooth module (VCC 3.3–6 VDC, baud 9600): pair the module with a smartphone running a custom app to forward alerts via SMS or push notification when vapor levels cross 800 ppm. Alternatively, use a SIM800L GSM module (VCC 3.8–4.2 VDC) to send prepaid SMS alerts to three predefined numbers; messages include location, timestamp, and concentration level.

Assemble the components on a 5×7 cm perforated board, keeping traces short (

Choosing the Optimal Sensor for Environmental Hazard Monitoring

Prioritize semiconductor-based sensors like the MQ-4 for methane-rich environments or the Figaro TGS2611 for hydrocarbons in industrial settings. These components deliver <5% response time variability across 0–50°C temperature ranges while consuming under 150 mW in continuous operation. For confined spaces, catalytics (e.g., Pellistor beads) achieve ±2% FS accuracy at concentrations above 10% LEL but require oxygen to function–exclude them where inert atmospheres exist.

Key Technical Trade-offs

  • Semiconductor sensors: Detect sub-ppm thresholds but suffer drift exceeding 10% per month without recalibration; best for qualitative alarms.
  • Electrochemical cells: Target toxic vapors (CO, H₂S) with <±1 ppm resolution, yet lifespan capped at 2–3 years due to electrolyte depletion.
  • NDIR (Non-Dispersive Infrared): Immune to poisoning, accurate to ±1% of reading for diatomic molecules (CO₂, CH₄), but costs scale 4–10x above alternatives.
  • Ultrasonic: Identifies pressure drops from 0.1 m³/h flow rates independent of vapor type, though false positives rise in noisy environments.

Match sensor output to your microcontroller’s ADC specifications. Electrochemical cells typically generate 4–20 mA signals or 0–5V, while semiconductor variants (MQ-series) output raw analog resistance–require >10-bit ADC resolution for reliable detection below 50 ppm. For wireless nodes, opt for digital interfaces like I²C (CCS811) or UART (SGP30) to minimize noise coupling during transmission.

Step-by-Step Assembly of the Sensing Module Board

gas leakage detector circuit diagram

Begin by arranging all required components on an anti-static mat. Verify the following parts against the schematic: 5V voltage regulator (LM7805), 10kΩ resistors (2x), 100nF capacitors (2x), MQ-9 sensor element, buzzer, red LED, and ATtiny85 microcontroller. Label each component to avoid confusion during soldering.

Prepare the perfboard by cutting it to 7×5 cm dimensions. Use a ruler and fine-tip marker to outline the component placement. Drill 1.5mm holes for through-hole leads, ensuring alignment with the sensor’s mounting holes. Clean the board with isopropyl alcohol to remove flux residue before proceeding.

Component Placement and Initial Soldering

Component Location (X,Y in mm) Soldering Notes
LM7805 10,20 Align tab outward; secure with Kapton tape before soldering
100nF (Input) 15,35 Place closest to regulator’s input pin; avoid heat damage
100nF (Output) 15,5 Parallel to regulator’s output; verify polarity
MQ-9 Heater Center, 45 Use 22-gauge wire for connections; keep traces short

Solder the voltage regulator first, followed by input/output capacitors. Trim excess leads with flush cutters. For the sensor’s heater pins, use a temperature-controlled iron set to 350°C to prevent delamination of the sensing layer. Apply thermal paste between the sensor base and perfboard to improve heat dissipation.

Mount the microcontroller next, positioning it 3mm from the perfboard edge to allow clearance for the programming header. Use socket strips for easier replacement. Route signal traces (VCC, GND, OUT) with 26AWG wire, maintaining a 2mm separation between adjacent paths to prevent interference.

Calibration and Final Connections

Attach the buzzer and LED using 1kΩ current-limiting resistors. For the LED, calculate the resistor value: R = (Vs – Vf) / If, where Vs = 5V, Vf = 2V (typical), and If = 10mA. Secure components with epoxy if vibration resistance is required.

Before powering on, perform continuity tests with a multimeter. Probe each joint for shorts, especially around the sensor’s sensitive electrodes. Load the firmware using an ISP programmer, setting the ATtiny85 clock to 1MHz for power efficiency. Test sensor responsiveness by exposing it to a controlled sample (ethanol vapor at 500ppm) at 20°C ambient temperature.

Encase the assembled board in a vented polycarbonate enclosure. Drill 3mm diameter holes over the sensor area, spaced 5mm apart. Apply a Gore-Tex membrane to prevent dust ingress while allowing vapor diffusion. Secure the board with M2 nylon standoffs to prevent mechanical stress on soldered joints.

Calibrating the Sensor for Precise Volatile Substance Monitoring

Begin by exposing the sensing element to a certified reference concentration of the target compound–typically methane, propane, or carbon monoxide–at 25°C and 50% relative humidity. Most semiconductor-based modules require a 30–60 second stabilization period; record the output voltage at 1-second intervals during this window. Compare the mean value against the manufacturer’s baseline tolerance (usually ±5% of the nominal 1.2–1.8 V range). If the deviation exceeds 7%, adjust the onboard potentiometer in increments of 5° until readings converge within the tolerance band.

After initial adjustment, subject the module to three sequential cycles of zero-air purging and re-exposure. Use medical-grade nitrogen for purging and maintain flow rates between 100–200 mL/min to prevent residual analyte accumulation. Each cycle must last 120 seconds; the final stabilized voltage should repeat within ±2% across cycles. Failure to achieve consistency suggests sensor drift or contamination–clean the housing with isopropyl alcohol and repeat calibration under Class 2 laminar flow conditions.

For quantitative accuracy, map the sensor’s response curve by exposing it to incrementally increasing concentrations–start at 50 ppm and scale up to the upper detection limit (often 10,000 ppm). Plot the output voltage versus concentration in a log-log chart; a linear slope between 0.85 and 1.15 indicates proper sensitivity alignment. Deviations demand resistor adjustment in the op-amp feedback loop: replace the 10 kΩ resistor with a 22 kΩ trimpot to fine-tune gain.

Conclude calibration by verifying cross-sensitivity with common interferents. Introduce 1,000 ppm ethanol vapor for 1 minute–acceptable interference deviation is under 15%. If readings exceed this threshold, apply a correction factor via firmware by sampling the interferent’s characteristic waveform and subtracting its effect algorithmically. Store all reference values in EEPROM to maintain consistency post-power cycles.