LPG gas leak alarm
A kitchen gas sniffer that beeps and flashes the moment LPG levels climb.
Shop by category
Shop all componentsA normal distance sensor measures one spot, which can mislead when rubbish or grain piles up unevenly. The VL53L5CX measures an 8 x 8 grid of distances, up to 4 m, in a 45 degree cone. The ESP32 reads all 64 zones with SparkFun's library, shows them as a shaded map on the OLED and works out the average fill level.
Tick anything you already have and the total updates.
SparkFun VL53L5CX 8x8 ToF imager
Follow the colours: red is power, dark grey is ground, blue is a signal.
5 V USB supply or a power bank.
bin_map.inoVerify & upload in Electrolark#include <Adafruit_SSD1306.h>
Adafruit_SSD1306 oled(128, 64, &Wire, -1);
#include <SparkFun_VL53L5CX_Library.h>
SparkFun_VL53L5CX tof;
VL53L5CX_ResultsData data;
const int EMPTY_MM = 800;
void setup() {
Wire.begin(); Wire.setClock(400000);
oled.begin(SSD1306_SWITCHCAPVCC, 0x3C); oled.setTextColor(WHITE);
tof.begin();
tof.setResolution(64);
tof.setRangingFrequency(5);
tof.startRanging();
}
void loop() {
if (!tof.isDataReady() || !tof.getRangingData(&data)) return;
oled.clearDisplay();
long sum = 0;
for (int i = 0; i < 64; i++) {
int d = constrain(data.distance_mm[i], 0, EMPTY_MM);
sum += d;
int fill = map(d, EMPTY_MM, 0, 0, 7); // 0..7 brightness steps
int x = (i % 8) * 8, y = (i / 8) * 8;
if (fill > 0) oled.fillRect(x + (8 - fill) / 2, y + (8 - fill) / 2, fill, fill, WHITE); // bigger square = fuller
}
int pct = 100 - (sum / 64) * 100 / EMPTY_MM;
oled.setTextSize(2); oled.setCursor(76, 20); oled.print(pct); oled.print("%");
oled.display();
}
Normal: the library uploads firmware to the sensor at start-up.
The cone sees the bin walls; ignore the outer ring of zones in a narrow bin.
Use 3.3 V from a good supply; the sensor draws peaks while ranging.
The library needs more memory than a Nano has.
Indoors and in a closed bin, yes; strong sunlight reduces its range.
Yes, the zones let you see direction of movement.
6 parts: SparkFun VL53L5CX Qwiic ToF Imager – 8×8 Multi-Zone Distance Sensor Module, ESP32-WROOM-32 38-Pin Development Board, 0.96" OLED Display 128x64, Official Raspberry Pi 4 USB-C Power Supply – 15.3W, 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 2 hours. The build on this page has 6 steps.
No. This page has the complete, tested code (bin_map.ino).
About ₹5,933 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
Multi-zone time-of-flight sensing; Turning distances into a fill percentage; Drawing a heat map.
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.