LPG gas leak alarm
A kitchen gas sniffer that beeps and flashes the moment LPG levels climb.
Shop by category
Shop all componentsPIR sensors switch lights off when you sit still. The HLK-LD2450 24 GHz radar reports the position of up to three people, moving or still, as x and y in millimetres. Its UART sends 30-byte frames at 256000 baud. The ESP32 decodes the targets, checks whether any is inside a rectangle you define around the desk, and keeps a relay on with a short off-delay.
Switching mains lamps needs a proper enclosure installed by an electrician; test with 12 V first.
Tick anything you already have and the total updates.
HLK-LD2450 24 GHz trajectory radar
Follow the colours: red is power, dark grey is ground, blue is a signal.
USB 5 V for the ESP32 and radar.
ld2450_zone.inoVerify & upload in ElectrolarkHardwareSerial radar(2);
const int RELAY = 26;
const int X_MIN = -600, X_MAX = 600, Y_MIN = 300, Y_MAX = 1800; // desk zone in mm
const unsigned long OFF_DELAY = 30000;
uint8_t buf[30]; int idx = 0;
unsigned long lastSeen = 0;
int16_t decode(uint16_t raw) { return (raw & 0x8000) ? (raw & 0x7FFF) : -(int16_t)raw; } // top bit 1 = positive
void handleFrame() {
bool inZone = false;
for (int i = 0; i < 3; i++) {
const uint8_t* t = buf + 4 + i * 8;
uint16_t rx = t[0] | (t[1] << 8), ry = t[2] | (t[3] << 8);
if (rx == 0 && ry == 0) continue; // empty slot
int x = decode(rx), y = decode(ry);
Serial.printf("target %d: x %d mm, y %d mm\n", i, x, y);
if (x >= X_MIN && x <= X_MAX && y >= Y_MIN && y <= Y_MAX) inZone = true;
}
if (inZone) lastSeen = millis();
}
void setup() {
Serial.begin(115200);
radar.begin(256000, SERIAL_8N1, 16, 17);
pinMode(RELAY, OUTPUT);
}
void loop() {
while (radar.available()) {
uint8_t b = radar.read();
if (idx < 4) { // header AA FF 03 00
const uint8_t H[4] = {0xAA, 0xFF, 0x03, 0x00};
if (b == H[idx]) buf[idx++] = b; else idx = (b == 0xAA) ? 1 : 0;
if (idx == 1) buf[0] = 0xAA;
} else {
buf[idx++] = b;
if (idx == 30) { if (buf[28] == 0x55 && buf[29] == 0xCC) handleFrame(); idx = 0; }
}
}
digitalWrite(RELAY, lastSeen && millis() - lastSeen < OFF_DELAY);
}
Check the radar's TX goes to GPIO 16 and the baud rate is 256000.
Fans, curtains and pets can show up; keep the zone tight and away from moving things.
The radar's left and right depend on how it is mounted; swap X_MIN and X_MAX signs.
Partly through thin partitions, so aim it away from the next room.
Yes, it reports up to three targets; count the non-empty slots.
Yes, its power is milliwatts, far below phone levels.
6 parts: ESP32-WROOM-32 38-Pin Development Board, Hi-Link HLK-LD2450 24GHz Trajectory Detection Radar Sensor Module, 5V Relay Module with Optocoupler, DC Power Adapter (5.5x2.1mm), 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 (ld2450_zone.ino).
About ₹1,524 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
How mmWave radar detects still people; Decoding the LD2450 target frame; Zones and off-delays in presence control.
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.