LPG gas leak alarm
A kitchen gas sniffer that beeps and flashes the moment LPG levels climb.
Shop by category
Shop all componentsThe DYP-A11 is a sealed ultrasonic sensor with a narrow beam that reports distance as a 4-byte serial frame: 0xFF, distance high byte, low byte and a checksum. In the UART-controlled version the sensor measures only when asked, which saves power. The Nano asks for a reading every 100 ms; when a hand comes closer than 20 cm it moves a strong MG996R servo to lift the lid.
Keep fingers away from the hinge while testing; the MG996R is strong.
Tick anything you already have and the total updates.
DYP-A11 UART controlled ultrasonic sensor
Follow the colours: red is power, dark grey is ground, blue is a signal.
12 V adapter through a 5 V buck converter for the servo and Nano.
bin_lid.inoVerify & upload in Electrolark#include <SoftwareSerial.h>
#include <Servo.h>
SoftwareSerial us(10, 11);
Servo lid;
const int OPEN = 100, CLOSED = 0, NEAR_MM = 200;
unsigned long openedAt = 0;
int readMm() {
while (us.available()) us.read();
us.write(0x55); // ask for one measurement
unsigned long t0 = millis();
while (us.available() < 4 && millis() - t0 < 100);
if (us.available() < 4 || us.read() != 0xFF) return -1;
uint8_t h = us.read(), l = us.read(), sum = us.read();
if ((uint8_t)(0xFF + h + l) != sum) return -1;
return h * 256 + l;
}
void setup() {
Serial.begin(9600); us.begin(9600);
lid.attach(9); lid.write(CLOSED);
}
void loop() {
int mm = readMm();
Serial.println(mm);
if (mm > 0 && mm < NEAR_MM) { lid.write(OPEN); openedAt = millis(); }
if (openedAt && millis() - openedAt > 5000) { lid.write(CLOSED); openedAt = 0; }
delay(100);
}
TX and RX are swapped, or yours is the auto-output version which needs no trigger byte.
The sensor sees the wall or a cupboard; aim it straight up and lower NEAR_MM.
Weak supply; the MG996R needs its own 5 V with at least 2 A.
The sensor measures only when it gets a trigger on its RX pin, instead of streaming all the time.
The DYP-A11 is sealed against splashes and has a narrower beam, which suits a kitchen.
Yes, with 4 AA cells or a 2S pack, but the servo drains them fast.
7 parts: Generic Nano CH340 Development Board (Soldered), DYP-A11BNYTW-V1.0 UART Controlled Ultrasonic Sensor Module – 21–300cm Range, TowerPro MG996R Metal Gear Servo (180°), Step-Down Converter to 5V USB / 5V 3A, 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 beginner project and takes about 2 hours. The build on this page has 5 steps.
No. This page has the complete, tested code (bin_lid.ino).
About ₹1,872 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
Reading a checksummed serial distance frame; Triggered vs continuous sensor modes; Powering a servo separately.
Keep fingers away from the hinge while testing; the MG996R is strong.
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.