LPG gas leak alarm
A kitchen gas sniffer that beeps and flashes the moment LPG levels climb.
Shop by category
Shop all componentsThe BME280 measures temperature, humidity and air pressure on a single I2C chip, which makes it the easiest all-round weather sensor. The sketch shows all three on an OLED and compares the pressure with the reading taken ten minutes earlier to display a rising or falling arrow. Keep the sensor out of direct sun and away from the ESP32 board, which warms the air around it.
Tick anything you already have and the total updates.
Temperature, humidity and pressure sensor
Follow the colours: red is power, dark grey is ground, blue is a signal.
USB phone charger.
bme280_station.inoVerify & upload in Electrolark#include <Wire.h>
#include <Adafruit_BME280.h>
#include <Adafruit_SSD1306.h>
Adafruit_BME280 bme;
Adafruit_SSD1306 oled(128, 64, &Wire, -1);
float oldPressure = 0;
unsigned long lastCheck = 0;
char arrow = ' ';
void setup() {
Wire.begin(21, 22);
oled.begin(SSD1306_SWITCHCAPVCC, 0x3C);
bme.begin(0x76); // try 0x77 if this fails
}
void loop() {
float p = bme.readPressure() / 100.0;
if (oldPressure == 0) oldPressure = p;
if (millis() - lastCheck > 600000UL) {
arrow = (p - oldPressure > 0.5) ? '^' : (p - oldPressure < -0.5) ? 'v' : '=';
oldPressure = p;
lastCheck = millis();
}
oled.clearDisplay(); oled.setTextColor(WHITE); oled.setTextSize(1);
oled.setCursor(0, 0); oled.print("Temp "); oled.print(bme.readTemperature(), 1); oled.print(" C");
oled.setCursor(0, 18); oled.print("Humid "); oled.print(bme.readHumidity(), 0); oled.print(" %");
oled.setCursor(0, 36); oled.print("Press "); oled.print(p, 1); oled.print(" hPa ");
oled.print(arrow);
oled.display();
delay(2000);
}
Check that the BME280 was found; try address 0x77.
The ESP32 warms nearby air. Move the sensor away on a cable.
Cheap sensors drift. Compare with a trusted hygrometer.
No. The BMP280 has no humidity sensor. The BME280 does.
Yes. Combine it with the ThingSpeak or MQTT projects.
Pressure dropped over ten minutes, which can precede rain or wind.
5 parts: ESP32-WROOM-32 38-Pin Development Board, Generic ZY-BME280 Pressure Temperature Humidity Sensor Module – I2C Interface, 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 (bme280_station.ino).
About ₹984 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
Reading a BME280 over I2C; Sharing the I2C bus with an OLED; Showing a simple pressure trend.
Ideas that reuse this build: ESP32 BMP280 altimeter. 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.