LPG gas leak alarm
A kitchen gas sniffer that beeps and flashes the moment LPG levels climb.
Shop by category
Shop all componentsThe LIS3DH accelerometer has a tap engine built in: it can recognise single and double taps by itself and raise a flag. The Adafruit board breaks it out on I2C. The Nano only needs to read the click register; when a double tap is reported, it toggles a relay for the lamp, or a MOSFET for a 12 V LED strip.
Tick anything you already have and the total updates.
Adafruit LIS3DH accelerometer (STEMMA QT)
Follow the colours: red is power, dark grey is ground, blue is a signal.
12 V adapter for the strip; the Nano from VIN.
tap_lamp.inoVerify & upload in Electrolark#include <Adafruit_LIS3DH.h>
Adafruit_LIS3DH lis;
const uint8_t THRESHOLD = 40; // higher = harder taps needed
bool on = false;
void setup() {
pinMode(9, OUTPUT);
lis.begin(0x18);
lis.setRange(LIS3DH_RANGE_2_G);
lis.setClick(2, THRESHOLD); // 2 = double tap
}
void loop() {
uint8_t click = lis.getClick();
if (click & 0x20) { // double-tap flag
on = !on;
digitalWrite(9, on);
delay(400);
}
delay(10);
}
The sensor is loosely mounted; taps do not reach it. Lower THRESHOLD.
Raise THRESHOLD or mount it further from the keyboard.
The delay after a tap is too short; increase it.
Yes for wood and laminate up to a few cm; glass works too.
Yes, use 1 in setClick and check bit 0x10, but they trigger more often by accident.
Use a relay module instead of the MOSFET and have the mains side wired safely.
7 parts: Adafruit LIS3DH Triple-Axis Accelerometer ±2/4/8/16g – I2C/SPI, STEMMA QT/Qwiic, Generic Nano CH340 Development Board (Soldered), MOSFET Switch Module, Relay Replacement (D4184 / LR7843), 2835 SMD LED Strip 12V, 5 m, 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 1 hour. The build on this page has 5 steps.
No. This page has the complete, tested code (tap_lamp.ino).
About ₹1,494 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
Hardware tap detection; Tuning a threshold; Toggling an output.
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.