LPG gas leak alarm
A kitchen gas sniffer that beeps and flashes the moment LPG levels climb.
Shop by category
Shop all componentsLight is easy to guess and hard to judge. The BH1750 reads illuminance directly in lux over I2C, so you can check whether a desk has enough light for reading (around 300 to 500 lux), whether a classroom is bright enough, or whether a shelf gets enough light for plants. The ESP32 shows the number on a small OLED with a bar graph and a one-word hint, and it keeps the highest reading since power-up.
Tick anything you already have and the total updates.
BH1750 light sensor module
Follow the colours: red is power, dark grey is ground, blue is a signal.
USB power bank, so you can carry it around.
lux_meter.inoVerify & upload in Electrolark#include <Wire.h>
#include <BH1750.h>
#include <Adafruit_SSD1306.h>
BH1750 lux;
Adafruit_SSD1306 oled(128, 64, &Wire, -1);
float peak = 0;
void setup() {
Wire.begin(21, 22);
lux.begin(BH1750::CONTINUOUS_HIGH_RES_MODE);
oled.begin(SSD1306_SWITCHCAPVCC, 0x3C);
oled.setTextColor(WHITE);
}
const char* hint(float l) {
if (l < 20) return "dark";
if (l < 150) return "dim";
if (l < 700) return "indoor";
if (l < 5000) return "bright";
return "daylight";
}
void loop() {
float l = lux.readLightLevel();
if (l > peak) peak = l;
oled.clearDisplay();
oled.setTextSize(2); oled.setCursor(0, 0); oled.printf("%.0f lx", l);
oled.setTextSize(1); oled.setCursor(0, 22); oled.printf("%s peak %.0f", hint(l), peak);
int w = constrain(map((int)l, 0, 1000, 0, 120), 0, 120);
oled.drawRect(4, 40, 120, 14, WHITE);
oled.fillRect(4, 40, w, 14, WHITE);
oled.display();
delay(300);
}
Check SDA and SCL and that the ADDR pin is not tied high (address 0x23 by default).
Try address 0x3D or run an I2C scanner.
Some bulbs flicker. A short average of several readings helps.
Around 300 to 500 lux on the desk is usual guidance.
It reads up to about 65,000 lux, so yes, but keep direct sun off the OLED.
Yes. Add a relay and switch it below a lux threshold.
5 parts: ESP32-WROOM-32 38-Pin Development Board, Generic GY-302 BH1750 Light Intensity 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 (lux_meter.ino).
About ₹716 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
Reading a BH1750 over I2C; Mapping lux to useful ranges; Drawing a bar graph on an OLED.
Ideas that reuse this build: ESP32 OLED internet clock. 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.