LPG gas leak alarm
A kitchen gas sniffer that beeps and flashes the moment LPG levels climb.
Shop by category
Shop all componentsAir pressure drops about 12 Pa for every metre you climb. The BMP581 is Bosch's lowest-noise barometer, so it can track height changes of under 10 cm. The ESP32 reads it with the SparkFun BMP581 library, sets the starting point as zero with a button, shows relative height on an OLED and the pressure trend over three hours, which hints at coming weather.
Tick anything you already have and the total updates.
BMP581 high-precision barometric sensor module
Follow the colours: red is power, dark grey is ground, blue is a signal.
USB power bank.
altimeter.inoVerify & upload in Electrolark#include <Wire.h>
#include <Adafruit_SSD1306.h>
Adafruit_SSD1306 oled(128, 64, &Wire, -1);
void big(const String& top, const String& value, const String& unit) {
oled.clearDisplay(); oled.setTextColor(WHITE);
oled.setTextSize(1); oled.setCursor(0, 0); oled.print(top);
oled.setTextSize(3); oled.setCursor(0, 20); oled.print(value);
oled.setTextSize(1); oled.print(" "); oled.print(unit);
oled.display();
}
#include "SparkFun_BMP581_Arduino_Library.h"
BMP581 baro;
const int BTN = 14;
float zeroPa = 0, history[18]; int hn = 0;
unsigned long lastHist = 0;
void setup() {
Wire.begin(21, 22);
oled.begin(SSD1306_SWITCHCAPVCC, 0x3C);
if (baro.beginI2C(0x47) != BMP5_OK) baro.beginI2C(0x46);
pinMode(BTN, INPUT_PULLUP);
}
void loop() {
bmp5_sensor_data d = {0, 0};
if (baro.getSensorData(&d) != BMP5_OK) return;
if (zeroPa == 0 || digitalRead(BTN) == LOW) zeroPa = d.pressure;
float h = 44330.0 * (1.0 - pow(d.pressure / zeroPa, 0.1903)); // metres relative to zero
if (millis() - lastHist > 600000UL || hn == 0) { if (hn == 18) { memmove(history, history + 1, 17 * sizeof(float)); hn = 17; } history[hn++] = d.pressure; lastHist = millis(); }
float trend = (history[hn - 1] - history[0]) / 100.0; // hPa over up to 3 hours
big(String(d.pressure / 100.0, 1) + " hPa trend " + String(trend, 1), String(h, 2), "m");
delay(200);
}
Weather changes pressure too; zero it again before each measurement.
Check the I2C wires and try both addresses with an I2C scanner.
Shield it from drafts and direct sunlight; temperature changes affect it.
Relative changes of about 10 cm are visible; absolute altitude depends on the weather.
Yes, use the local sea-level pressure from a weather service instead of zeroPa.
Yes, flight controllers use barometers like this for altitude hold.
6 parts: ESP32-WROOM-32 38-Pin Development Board, DFRobot Fermion BMP581 High-Precision Barometric Pressure Sensor Module – I2C/SPI, Tactile Push Button Switch, 0.96" OLED Display 128x64, 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 beginner project and takes about 1 hour. The build on this page has 6 steps.
No. This page has the complete, tested code (altimeter.ino).
About ₹1,501 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
How barometric altitude works; Zeroing a relative height; Pressure trends and weather.
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.