LPG gas leak alarm
A kitchen gas sniffer that beeps and flashes the moment LPG levels climb.
Shop by category
Shop all componentsBuild a tiered alert system where the severity of the response escalates with the temperature. A single alarm level is a blunt instrument, it either shouts or says nothing. A tiered system gives graded warning, and each tier changes three things at once: the LED, the beep pattern and the wording on screen. Keeping the tier as a number and driving all three outputs from it means a new tier can be added by extending three short lookups rather than rewriting the logic.
The ESP32 is a 3.3V board: never connect a 5V signal straight to a GPIO pin.
Every part for this build comes in the Geekobot Titan Kit box, a Geekobot exclusive, together with the parts for all 120 projects, from a first blinking LED to a smart fan and a reaction game. The wiring below is the kit's own wiring.
Tick anything you already have and the total updates.
ESP32 DevKit V1 (38-pin): the brain of every Titan Kit project, with Wi-Fi and Bluetooth
Male-to-female and female-to-female leads for the modules
LEDs from the kit's red, green, yellow and blue packs
220 ohm resistors: one in series with every LED
DHT11 temperature and humidity sensor
ESP32 expansion board from the kit: every GPIO has its own S, V, G header
Follow the colours: red is power, dark grey is ground, blue is a signal.
titan_kit_047_thermal_warning_indicator.inoVerify & upload in Electrolark#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <DHT.h>
#define DHTPIN 13
#define DHTTYPE DHT11
Adafruit_SSD1306 display(128, 64, &Wire, -1);
DHT dht(DHTPIN, DHTTYPE);
int ledPins[3] = {27, 26, 25}; // green, yellow, red
int buzzer = 33;
float warnAt = 28.0;
float alertAt = 32.0;
float dangerAt = 36.0;
String tierName[4] = {"NORMAL", "WARNING", "ALERT", "DANGER"};
int beepInterval[4] = {0, 4000, 1500, 500};
unsigned long lastBeep = 0;
int tierFor(float t)
{
if (t >= dangerAt) return 3;
if (t >= alertAt) return 2;
if (t >= warnAt) return 1;
return 0;
}
void setup()
{
for (int i = 0; i < 3; i++)
{
pinMode(ledPins[i], OUTPUT);
}
pinMode(buzzer, OUTPUT);
Serial.begin(9600);
dht.begin();
if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C))
{
Serial.println("OLED not found");
while (true) { }
}
display.setTextColor(SSD1306_WHITE);
}
void loop()
{
float t = dht.readTemperature();
if (isnan(t))
{
delay(2000);
return;
}
int tier = tierFor(t);
digitalWrite(ledPins[0], tier == 0);
digitalWrite(ledPins[1], tier == 1);
digitalWrite(ledPins[2], tier >= 2);
if (tier > 0 && millis() - lastBeep > beepInterval[tier])
{
lastBeep = millis();
tone(buzzer, 800 + tier * 400, 100 + tier * 50);
}
Serial.print(t);
Serial.print(" C tier ");
Serial.println(tierName[tier]);
display.clearDisplay();
display.setTextSize(1);
display.setCursor(0, 0);
display.print("THERMAL MONITOR");
display.setTextSize(3);
display.setCursor(0, 14);
display.print(t, 1);
display.setTextSize(1);
display.setCursor(0, 42);
display.print("Level: ");
display.print(tierName[tier]);
display.setCursor(0, 54);
if (tier == 0) display.print("All within limits");
else if (tier == 1) display.print("Above ");
else if (tier == 2) display.print("Above ");
else display.print("Evacuate the area");
if (tier == 1) { display.print(warnAt, 0); display.print("C"); }
if (tier == 2) { display.print(alertAt, 0); display.print("C - act now"); }
if (tier >= 2)
{
display.drawRect(0, 10, 128, 40, SSD1306_WHITE);
}
display.display();
delay(500);
}
Use a micro-USB data cable (some cables only charge), install the CP210x or CH340 driver if no port appears, pick Tools > Board > ESP32 Dev Module and hold the BOOT button on the board until the upload starts.
Turn it round: the long leg (anode) goes to the GPIO side through the 220 ohm resistor, the short leg to GND.
This project needs the passive buzzer (the one that plays notes), not the active one.
Check SDA on GPIO21 and SCL on GPIO22, power from 3V3, and that the sketch uses address 0x3C (some boards are 0x3D).
A single alarm level is a blunt instrument, it either shouts or says nothing. A tiered system gives graded warning, and each tier changes three things at once: the LED, the beep pattern and the wording on screen. Keeping the tier as a number and driving all three outputs from it means a new tier can be added by extending three short lookups rather than rewriting the logic.
Below 28°C: NORMAL with the green LED and no sound. 28–32°C: WARNING, yellow LED, a beep every 4 seconds. 32–36°C: ALERT, red LED, a higher beep every 1.5 seconds and a box around the reading.
Yes. It is project 47 of 120 in the Geekobot Titan Kit, in level 9 (Environmental science). Every part on the list comes in the kit box, and you can also buy the parts one by one from the list above.
No. Every Titan Kit project is wired on the ESP32 expansion board and the breadboard with jumper wires.
10 parts: ESP32-WROOM-32 38-Pin Development Board, USB Cable, Solderless Breadboard, Dupont Jumper Wires (40 pcs), 3 × Through-Hole LED Pack (Pack of 10), Carbon Film Resistor 1/4W 5% (Pack of 10), Buzzer Module 3.3–5V, 0.96" OLED Display 128x64, Generic DHT11 Digital Temperature & Humidity Sensor Module and ESP32 38-Pin Expansion Board. On this page you can tick the parts you already have and add only the rest to your cart.
It is a intermediate project and takes about 45 minutes. The build on this page has 7 steps.
No. This page has the complete, tested code (titan_kit_047_thermal_warning_indicator.ino).
About ₹949 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
Multi-tier alert systems; Escalating several outputs from one tier value; Using pitch and repetition to signal urgency; Table-driven behaviour instead of nested ifs.
The ESP32 is a 3.3V board: never connect a 5V signal straight to a GPIO pin.
A kitchen gas sniffer that beeps and flashes the moment LPG levels climb.
See the smoke level live on a crisp screen and get a loud warning when it spikes.
An infrared eye that spots an open flame and raises the alarm.
Walk into the room and it sounds the alarm: the classic first security build.
Lessons are free to read. Maker (₹499/month) and Pro add quizzes, worked problems and certificates, paid with your Geekobot account. See plans
Learning project. Check every circuit and the datasheet of each part before you power it up.