IoTBeginnerPRJ-136

IoT Smart Refrigerator Gas Leakage Detector Using ESP8266

Detects harmful gas or spoiled-food odour in your fridge and alerts your phone.

Built and tested by Drisya K S · Industrial Robotics Institute

Circuit diagram of the IoT Smart Refrigerator Gas Leakage Detector using ESP8266 NodeMCU
Circuit diagram · ESP8266 NodeMCU
LevelBeginner
Build time1–2 hours
BoardESP8266 NodeMCU
Parts7 components

What is the IoT Smart Refrigerator Gas Leakage Detector?

A gas detector for refrigerators. An MQ2/MQ135 sensor monitors the air in or around the fridge; when gas levels exceed a safe limit (from a refrigerant leak or spoiled food), the ESP8266 sounds a buzzer, lights an LED and sends an alert and the live gas value to the Blynk app.

How it works

  1. The gas sensor’s analog value is read by the ESP8266.
  2. Above 400, it counts as a leak: buzzer and LED turn on.
  3. The status ("Gas Leakage Detected!" or "Safe") goes to Blynk V1.
  4. The gas value goes to V2 for a gauge on your phone.

Parts list

ComponentQty
ESP8266 NodeMCU1
Gas Sensor (MQ2 / MQ135)1
Buzzer1
LED (optional)1
Resistor 220Ω1
Jumper Wires / BreadboardAs needed
Power Supply1

Software

  • Arduino IDE
  • Blynk IoT app

Wiring and connections

FromConnect to
Gas sensor VCC5V (VIN)
Gas sensor GNDGND
Gas sensor AOA0
Buzzer +D5
Buzzer −GND
LED + (via 220Ω)D6
LED −GND

How to build the IoT Smart Refrigerator Gas Leakage Detector

  1. Connect the gas sensor to VIN, GND and A0.
  2. Connect the buzzer to D5 and the LED through a 220Ω resistor to D6.
  3. In Blynk, create a template (ESP8266, Wi-Fi) with datastreams V1 (string) and V2 (integer).
  4. Create a device, copy its Auth Token, and add a label for V1 and a gauge for V2.
  5. Put your Template ID, Auth Token and Wi-Fi in the code and upload it.
  6. Let the sensor warm up and place it near the fridge.

IoT Smart Refrigerator Gas Leakage Detector code

Complete, tested Arduino C++ code for this project. Copy it into Arduino IDE and upload it to the ESP8266 NodeMCU.

#define BLYNK_TEMPLATE_ID "YourTemplateID"
#define BLYNK_TEMPLATE_NAME "Gas Detector"
#define BLYNK_AUTH_TOKEN "YourAuthToken"

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

char ssid[] = "YourWiFiName";
char pass[] = "YourWiFiPassword";

int gasSensor = A0;
int buzzer = D5;
int led = D6;

void setup() {
  Serial.begin(9600);
  pinMode(buzzer, OUTPUT);
  pinMode(led, OUTPUT);
  Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);
}

void loop() {
  int gasValue = analogRead(gasSensor);

  if (gasValue > 400) {
    digitalWrite(buzzer, HIGH);
    digitalWrite(led, HIGH);
    Blynk.virtualWrite(V1, "Gas Leakage Detected!");
  } else {
    digitalWrite(buzzer, LOW);
    digitalWrite(led, LOW);
    Blynk.virtualWrite(V1, "Safe");
  }

  Blynk.virtualWrite(V2, gasValue);
  Blynk.run();
  delay(1000);   // avoid flooding the Blynk server
}

Real-world uses

  • Home kitchens
  • Restaurants and cold storage
  • Food shops
  • Learning Blynk IoT

Frequently asked questions

What is a IoT Smart Refrigerator Gas Leakage Detector?

A gas detector for refrigerators. An MQ2/MQ135 sensor monitors the air in or around the fridge; when gas levels exceed a safe limit (from a refrigerant leak or spoiled food), the ESP8266 sounds a buzzer, lights an LED and sends an alert and the live gas value to the Blynk app.

What components are needed for the IoT Smart Refrigerator Gas Leakage Detector?

You need: ESP8266 NodeMCU (1), Gas Sensor (MQ2 / MQ135) (1), Buzzer (1), LED (optional) (1), Resistor 220Ω (1), Jumper Wires / Breadboard, Power Supply (1). Software: Arduino IDE, Blynk IoT app.

Is the IoT Smart Refrigerator Gas Leakage Detector project good for beginners?

Yes. It is rated beginner and takes about 1–2 hours to build, using the ESP8266 NodeMCU. The guide on this page explains every connection and step.

Where can I get the code for the IoT Smart Refrigerator Gas Leakage Detector?

The complete, tested Arduino C++ code is free on this page. Copy it into Arduino IDE and upload it to the board.

Can I buy a kit for the IoT Smart Refrigerator Gas Leakage Detector?

Yes. IRI sells a kit with the parts for this project (PRJ-136). Message IRI on WhatsApp at +91 86060 82634 for the kit price and delivery details.

Industrial Robotics Institute
Logo