LPG gas leak alarm
A kitchen gas sniffer that beeps and flashes the moment LPG levels climb.
Shop by category
Shop all componentsElectrochemical oxygen sensors produce a tiny current in proportion to the oxygen around them. The DFRobot Gravity I2C oxygen sensor measures 0-25% by volume and handles the conversion on board, so the ESP32 just reads a number over I2C. The sensor's cell is used up slowly over its life (about two years), so calibrate it in fresh outdoor air now and then.
This is a learning project, not a certified gas detector. Use certified alarms where gas leaks are possible.
Never enter a confined space, tank or pit on a hobby sensor reading.
Tick anything you already have and the total updates.
DFRobot Gravity I2C oxygen sensor
Follow the colours: red is power, dark grey is ground, blue is a signal.
USB.
oxygen.inoVerify & upload in Electrolark#include <Adafruit_SSD1306.h>
Adafruit_SSD1306 oled(128, 64, &Wire, -1);
#include <DFRobot_OxygenSensor.h>
DFRobot_OxygenSensor oxygen;
void setup() {
Serial.begin(115200);
pinMode(26, OUTPUT);
oled.begin(SSD1306_SWITCHCAPVCC, 0x3C); oled.setTextColor(WHITE);
while (!oxygen.begin(ADDRESS_3)) { Serial.println("O2 sensor not found"); delay(1000); }
}
void loop() {
float pct = oxygen.getOxygenData(10); // average of 10 readings
bool low = pct < 19.5;
digitalWrite(26, low && (millis() / 400) % 2);
oled.clearDisplay();
oled.setTextSize(1); oled.setCursor(0, 0); oled.print("Oxygen");
oled.setTextSize(3); oled.setCursor(0, 20); oled.print(pct, 1); oled.setTextSize(1); oled.print(" %");
oled.setCursor(0, 55); oled.print(low ? "LOW - ventilate" : "Normal");
oled.display();
delay(1000);
}
The address does not match the DIP switches; try ADDRESS_0 to ADDRESS_3.
Let it settle, then run the calibration example in fresh air.
The cell is ageing; calibrate again, and fit a new sensor when it no longer reaches 20.9%.
Fresh air is 20.9%; below 19.5% is considered oxygen-deficient.
Rarely at home, but it can in closed stores, cold rooms, or rooms with gas cylinders or many people.
Yes for oxygen, but keep it out of condensation.
6 parts: DFRobot Gravity I2C Oxygen Sensor Module – 0-25%Vol, 3.3-5.5V, ESP32-WROOM-32 38-Pin Development Board, 0.96" OLED Display 128x64, Buzzer Module 3.3–5V, Solderless Breadboard and Dupont Jumper Wires (40 pcs). 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 1 hour. The build on this page has 5 steps.
No. This page has the complete, tested code (oxygen.ino).
About ₹6,921 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
How electrochemical gas cells work; Calibrating to fresh air (20.9%); Reading an I2C sensor with a maker library.
This is a learning project, not a certified gas detector. Use certified alarms where gas leaks are possible. Never enter a confined space, tank or pit on a hobby sensor reading.
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.