LPG gas leak alarm
A kitchen gas sniffer that beeps and flashes the moment LPG levels climb.
Shop by category
Shop all componentsThe HLK-LD2451 is a 24 GHz radar made to detect vehicles from about 10 to 100 m and report their speed, distance, angle and direction. It sends data frames over serial starting with F4 F3 F2 F1 and ending with F8 F7 F6 F5. The ESP32 finds each frame, reads every target in it, and turns on a relay for a warning lamp when an approaching vehicle is within range. Check the frame layout against the user manual for your firmware.
A warning lamp helps but does not replace care at a blind corner.
Mains lamp wiring must be done by an electrician.
Tick anything you already have and the total updates.
Hi-Link HLK-LD2451 24 GHz speed radar
Follow the colours: red is power, dark grey is ground, blue is a signal.
5 V supply at the gate post, in a weatherproof box.
approach_warning.inoVerify & upload in Electrolark#include <Adafruit_SSD1306.h>
Adafruit_SSD1306 oled(128, 64, &Wire, -1);
const int MAX_M = 40;
unsigned long lampUntil = 0;
uint8_t buf[64];
void setup() {
Serial.begin(115200);
Serial2.begin(115200, SERIAL_8N1, 16, 17);
pinMode(26, OUTPUT);
oled.begin(SSD1306_SWITCHCAPVCC, 0x3C); oled.setTextColor(WHITE);
}
void loop() {
// find header F4 F3 F2 F1
static uint32_t win = 0;
while (Serial2.available()) {
win = (win << 8) | Serial2.read();
if (win != 0xF4F3F2F1) continue;
while (Serial2.available() < 2) ;
int len = Serial2.read() | (Serial2.read() << 8);
if (len > 60) return;
Serial2.readBytes(buf, len + 4); // payload + tail
// payload: 2 status bytes, then 5 bytes per target: angle, distance, direction, speed, SNR
for (int i = 2; i + 4 < len; i += 5) {
int angle = buf[i] - 0x80, dist = buf[i + 1], approaching = buf[i + 2], speed = buf[i + 3];
Serial.printf("dist %d m speed %d km/h %s angle %d\n", dist, speed, approaching ? "coming" : "going", angle);
if (approaching && dist <= MAX_M) {
lampUntil = millis() + 5000;
oled.clearDisplay(); oled.setTextSize(2); oled.setCursor(0, 0); oled.print("VEHICLE");
oled.setCursor(0, 24); oled.print(speed); oled.print(" km/h");
oled.setTextSize(1); oled.setCursor(0, 50); oled.print(dist); oled.print(" m away"); oled.display();
}
}
}
digitalWrite(26, millis() < lampUntil);
if (millis() > lampUntil + 2000) { oled.clearDisplay(); oled.display(); }
}
Check TX/RX and 115200 baud; the radar ignores very slow movement.
Your firmware's frame layout may differ; compare raw bytes with the user manual.
Swaying branches move; aim it lower along the road.
Cars from about 10 m up to roughly 100 m in open space.
Yes, radar is not affected by darkness and copes with rain.
It is tuned for vehicles; use an LD2410 or similar for people.
7 parts: Hi-Link HLK-LD2451 24GHz Speed Radar Sensor (10m~100m) – GPIO/UART Output, ESP32-WROOM-32 38-Pin Development Board, 0.96" OLED Display 128x64, 5V Relay Module with Optocoupler, 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 advanced project and takes about 3 hours. The build on this page has 6 steps.
No. This page has the complete, tested code (approach_warning.ino).
About ₹2,577 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
How speed radar works; Parsing framed serial data; Filtering by direction.
A warning lamp helps but does not replace care at a blind corner. Mains lamp wiring must be done by an electrician.
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.