LPG gas leak alarm
A kitchen gas sniffer that beeps and flashes the moment LPG levels climb.
Shop by category
Shop all componentsThis sensor combines a laser particle counter, an electrochemical formaldehyde cell and a temperature and humidity sensor. It sends a 40-byte frame over serial about once a second, starting with 0x42 0x4D. The ESP32 checks the frame's checksum and reads PM2.5, formaldehyde (HCHO), temperature and humidity from fixed positions. New furniture, paint and some cleaners give off formaldehyde, so this shows when to air a room.
Tick anything you already have and the total updates.
DFRobot PM2.5, HCHO, temperature and humidity sensor
Follow the colours: red is power, dark grey is ground, blue is a signal.
5 V USB supply.
air_monitor.inoVerify & upload in Electrolark#include <Adafruit_SSD1306.h>
Adafruit_SSD1306 oled(128, 64, &Wire, -1);
uint8_t f[40];
bool readFrame() {
while (Serial2.available() >= 40) {
if (Serial2.read() != 0x42) continue;
if (Serial2.peek() != 0x4D) continue;
f[0] = 0x42; Serial2.readBytes(f + 1, 39);
uint16_t sum = 0; for (int i = 0; i < 38; i++) sum += f[i];
return sum == (f[38] << 8 | f[39]);
}
return false;
}
uint16_t word16(int i) { return f[i] << 8 | f[i + 1]; }
void setup() {
Serial2.begin(9600, SERIAL_8N1, 16, 17);
oled.begin(SSD1306_SWITCHCAPVCC, 0x3C); oled.setTextColor(WHITE);
}
void loop() {
if (!readFrame()) return;
int pm25 = word16(12); // atmospheric PM2.5, ug/m3
float hcho = word16(28) / 1000.0; // mg/m3
float t = (int16_t)word16(30) / 10.0;
float rh = word16(32) / 10.0;
oled.clearDisplay(); oled.setTextSize(1);
oled.setCursor(0, 0); oled.print("PM2.5 "); oled.print(pm25); oled.print(" ug/m3");
oled.setCursor(0, 16); oled.print("HCHO "); oled.print(hcho, 3); oled.print(" mg/m3");
oled.setCursor(0, 32); oled.print(t, 1); oled.print(" C "); oled.print(rh, 0); oled.print(" %");
oled.setCursor(0, 50); oled.print(pm25 > 60 || hcho > 0.08 ? "Air it out" : "OK");
oled.display();
}
No valid frames; TX and RX are swapped or the baud rate is wrong.
The cell needs a few minutes to warm up.
Check for incense, cooking or dust near the inlet.
India's 24-hour standard is 60 ug/m3; lower is better, and the WHO guide is much lower.
Many guidelines use 0.08-0.1 mg/m3 as an indoor limit.
Keep the inlet free of fluff; do not open the laser chamber.
6 parts: DFRobot Air Quality Monitor PM2.5 HCHO Temp Humidity Sensor – UART Output, 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 5 steps.
No. This page has the complete, tested code (air_monitor.ino).
About ₹6,553 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
Parsing a binary serial frame; Checking a checksum; What PM2.5 and HCHO levels mean.
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.