← All projects
Gas leak detection with automatic valve shut-off
BeginnerSafety and securityAbout 4 weeks

Gas leak detection with automatic valve shut-off

An MQ-5 sensor watches the air continuously; when the safe limit is exceeded, an ESP32 closes the electric valve immediately and sends an alert to the phone.

The problem

Kitchen gas leaks are a major cause of fires and suffocation. The problem is that people can't smell a slow leak, and by the time they notice, it's too late. The system works around the clock and acts before the concentration reaches ignition level.

Project image: Gas leak detection with automatic valve shut-off

How it works

  1. MeasurementThe MQ-5 sensor reads the gas concentration in the air continuously, after a warm-up period at startup.
  2. ComparisonThe ESP32 compares the reading with the safe limit set during calibration.
  3. ClosingWhen the reading exceeds the limit, the relay cuts power to the valve, closing the gas line immediately.
  4. AlarmA local buzzer alerts people in the house even if they don't have their phone.
  5. AlertsA notification reaches the phone with the time of the leak and the concentration.
  6. ReopeningThe valve doesn't reopen automatically; the user must check it's safe and open it manually.

Project features

  • An automatic decision without human input: the valve closes on its own.
  • A safety project — defense committees value projects that help save lives.
  • Cheap components that are available locally.
  • It can be demonstrated live at the defense with a gas lighter.
Model image: Gas leak detection with automatic valve shut-off Preparing the interactive model…

Part models from the libraries KiCad andEspressif (CC-BY-SA 4.0), lighting from Poly Haven. Click any part's name to zoom in on it.

Parts

All the parts you need in one place. Remove what you already have, and swap parts to fit your budget. Parts with a photo are available in our store at their current price.

Number of parts
Total

Prices are estimates and may change. Parts marked “other supplier” are ordered outside our main store.

Expected challenges

These are the main obstacles to expect during the build, laid out clearly so you know them before you start.

  • MQ sensors need several minutes of warm-up before their readings settle.
  • Calibration is hard without a reference gas, and the reading is affected by temperature and humidity.
  • The valve must be the type that closes when power is cut (Normally Closed).
  • The local alarm must work even when Wi-Fi is down.
  • Safety: tests must use a very small amount of gas in an open space.

The consultation gives you a solution for each one.

Expected committee questions

Prepare your answers in advance: these questions come up often in defenses of similar projects.

  1. Why was the MQ-5 sensor chosen specifically, and how does it differ from the MQ-2 and MQ-6?
  2. How was the safe alert threshold determined, and how was the sensor calibrated?
  3. What happens if power or Wi-Fi is cut during a leak?
  4. The sensor needs warm-up time — how are false readings at startup handled?

Practice the defense, question by question

Students' experiences

Be the first to share your experience

Add a comment on the idea: +2 points. Or share your experience with photos of your build: +10 points. Every 50 points become a JD 5 discount voucher on parts orders.

Add your experience

Log in to add your experience

Need solutions to the challenges and a complete technical path?

In the consultation we give you a solution for each challenge above, plus a practical build plan from the first step to the last: technologies, libraries, wiring diagram, timeline, and tips for the defense.

  • Consultation session
  • PDF with solutions and a plan
  • 20 د.أ فقط
Book a consultation on WhatsApp →

Share the project

Project card

Gas leak detection with automatic valve shut-off card
Message us