LPG gas leak alarm
A kitchen gas sniffer that beeps and flashes the moment LPG levels climb.
Shop by category
Shop all componentsThe VL53L1X measures distance by timing how long a pulse of invisible infrared light takes to bounce back. It is much more precise than an ultrasonic sensor and works on soft, thin or angled surfaces where ultrasound struggles. With an ESP32 and an OLED it becomes a pocket distance meter or a base for a level sensor. Direct sunlight reduces its range, and dark or very shiny surfaces reflect less light.
Tick anything you already have and the total updates.
VL53L1X time-of-flight sensor module
Follow the colours: red is power, dark grey is ground, blue is a signal.
USB power bank.
tof_meter.inoVerify & upload in Electrolark#include <Wire.h>
#include <VL53L1X.h>
#include <Adafruit_SSD1306.h>
VL53L1X tof;
Adafruit_SSD1306 oled(128, 64, &Wire, -1);
void setup() {
Wire.begin(21, 22);
Wire.setClock(400000);
tof.setTimeout(500);
tof.init();
tof.setDistanceMode(VL53L1X::Long); // Short is more accurate in bright light
tof.setMeasurementTimingBudget(50000);
tof.startContinuous(50);
oled.begin(SSD1306_SWITCHCAPVCC, 0x3C);
oled.setTextColor(WHITE);
}
void loop() {
uint32_t sum = 0;
for (int i = 0; i < 5; i++) sum += tof.read();
float mm = sum / 5.0;
oled.clearDisplay();
oled.setTextSize(3); oled.setCursor(0, 8); oled.printf("%.1f", mm / 10.0);
oled.setTextSize(1); oled.setCursor(0, 40); oled.printf("cm (%.0f mm)", mm);
if (tof.timeoutOccurred()) { oled.setCursor(0, 54); oled.print("sensor timeout"); }
oled.display();
delay(100);
}
Check SDA and SCL and the 3.3 V supply. The VL53L1X must be initialised before reading.
Sunlight swamps the sensor. Use short mode and shade the target.
That is normal noise; the sketch averages five readings.
It is a Class 1 laser, safe for eyes in normal use.
It is more precise and works on soft surfaces, but costs more and reaches less far.
Yes, but they share an address, so use their XSHUT pins to change one address at start-up.
5 parts: ESP32-WROOM-32 38-Pin Development Board, Generic TOF400C VL53L1X Laser Ranging 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 intermediate project and takes about 1.5 hours. The build on this page has 6 steps.
No. This page has the complete, tested code (tof_meter.ino).
About ₹1,154 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
Reading a VL53L1X over I2C; Choosing short and long distance modes; Averaging readings to cut noise.
Ideas that reuse this build: ESP32 parking sensor. 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.