LPG gas leak alarm
A kitchen gas sniffer that beeps and flashes the moment LPG levels climb.
Shop by category
Shop all componentsThe MLX90640 measures temperature at 768 points at once. Read over I2C by an ESP32, it shows where a panel, motor, window or wire joint is hotter than its surroundings. This sketch prints a coarse heat map and the minimum, maximum and centre temperatures.
Do not open live mains panels to take readings; a qualified electrician should do that.
Tick anything you already have and the total updates.
Thermal array camera, 110° view
Follow the colours: red is power, dark grey is ground, blue is a signal.
thermal.inoVerify & upload in Electrolark#include <Adafruit_MLX90640.h>
Adafruit_MLX90640 mlx;
float frame[32 * 24];
void setup() {
Serial.begin(115200);
Wire.begin(21, 22);
Wire.setClock(800000);
if (!mlx.begin(MLX90640_I2CADDR_DEFAULT, &Wire)) { Serial.println("MLX90640 not found"); while (1) delay(10); }
mlx.setMode(MLX90640_CHESS);
mlx.setResolution(MLX90640_ADC_18BIT);
mlx.setRefreshRate(MLX90640_2_HZ);
}
void loop() {
if (mlx.getFrame(frame) != 0) { Serial.println("Frame error"); return; }
float lo = 999, hi = -999;
for (float t : frame) { lo = min(lo, t); hi = max(hi, t); }
// coarse 16 x 12 map: . cool o warm O hot @ hottest
for (int y = 0; y < 24; y += 2) {
for (int x = 0; x < 32; x += 2) {
float t = frame[y * 32 + x], k = (t - lo) / max(hi - lo, 0.1f);
Serial.print(k > 0.9 ? '@' : k > 0.66 ? 'O' : k > 0.33 ? 'o' : '.');
}
Serial.println();
}
Serial.printf("min %.1f C max %.1f C centre %.1f C\n\n", lo, hi, frame[12 * 32 + 16]);
delay(500);
}
Check the I2C wires and that the module is set to I2C.
Lower Wire.setClock to 400000 and shorten the wires.
Bare metal reflects; measure on tape or paint.
No, it is a maker sensor, not a medical device.
Yes, draw the frame on a TFT or send it to a PC.
Typically -40 to 300 °C, depending on the version.
4 parts: Waveshare MLX90640 IR Array Thermal Imaging Camera, 32×24 Pixels, 110° FOV, ESP32-WROOM-32 38-Pin Development Board, 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 5 steps.
No. This page has the complete, tested code (thermal.ino).
About ₹7,225 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
How thermopile array sensors work; I2C speed and frame rates; Emissivity: why shiny metal reads wrong.
Do not open live mains panels to take readings; a qualified electrician should do that.
Ideas that reuse this build: Depth camera people counter. 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.