LPG gas leak alarm
A kitchen gas sniffer that beeps and flashes the moment LPG levels climb.
Shop by category
Shop all componentsAir pressure falls as you go up, roughly 12 pascals for every metre near sea level. The BMP280 measures pressure precisely, and the sketch converts it to altitude. Because weather also changes pressure, the sketch records the starting pressure and shows the height difference from there, which is what you want for a stairs or floor-counting demo. Absolute altitude readings drift with the weather by several metres.
Tick anything you already have and the total updates.
Pressure and temperature sensor
Follow the colours: red is power, dark grey is ground, blue is a signal.
USB power bank for carrying it around.
altimeter.inoVerify & upload in Electrolark#include <Wire.h>
#include <Adafruit_BMP280.h>
#include <Adafruit_SSD1306.h>
Adafruit_BMP280 bmp;
Adafruit_SSD1306 oled(128, 64, &Wire, -1);
float refPa = 0;
void setup() {
Wire.begin(21, 22);
oled.begin(SSD1306_SWITCHCAPVCC, 0x3C);
if (!bmp.begin(0x76)) { // try 0x77 if this fails
oled.clearDisplay(); oled.setTextColor(WHITE); oled.setCursor(0, 0);
oled.println("BMP280 not found"); oled.display();
while (true) delay(1000);
}
delay(500);
for (int i = 0; i < 10; i++) { refPa += bmp.readPressure(); delay(100); }
refPa /= 10;
}
void loop() {
float pa = bmp.readPressure();
float height = 44330.0 * (1.0 - pow(pa / refPa, 0.1903));
oled.clearDisplay();
oled.setTextColor(WHITE);
oled.setTextSize(1);
oled.setCursor(0, 0); oled.print("Height change");
oled.setTextSize(3);
oled.setCursor(0, 20); oled.print(height, 1); oled.print("m");
oled.setTextSize(1);
oled.setCursor(0, 56); oled.print(bmp.readTemperature(), 1); oled.print(" C ");
oled.print(pa / 100.0, 1); oled.print(" hPa");
oled.display();
delay(300);
}
Many modules use address 0x76, some 0x77. Change it in bmp.begin().
Weather and air-conditioning change pressure. It is a relative tool, not a survey instrument.
Average several readings, or enable the sensor's oversampling settings.
About a metre for short climbs. Over hours the weather moves it more.
Only if you enter today's sea-level pressure from a weather report.
No. That is the BME280.
5 parts: ESP32-WROOM-32 38-Pin Development Board, BMP280-5V Temperature and Barometric Pressure Sensor Module, 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 intermediate 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 ₹682 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
How pressure relates to height; Reading a BMP280 over I2C; Showing a relative height from a start reference.
Ideas that reuse this build: ESP32 TFT sensor dashboard with BMP280. They are listed under Take it further on this page.
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.
Learning project. Check every circuit and the datasheet of each part before you power it up.