LPG gas leak alarm
A kitchen gas sniffer that beeps and flashes the moment LPG levels climb.
Shop by category
Shop all componentsLightning sends out a burst of radio waves at around 500 kHz. The AMS AS3935 listens for that pattern with a tuned antenna, rejects most man-made noise and estimates how far away the storm front is, from 40 km down to overhead. The DFRobot Gravity board has the antenna on board and an I2C interface; its IRQ pin tells the ESP32 when something happened.
When thunder is heard, go indoors; do not wait for the detector.
Tick anything you already have and the total updates.
DFRobot Gravity lightning distance sensor
Follow the colours: red is power, dark grey is ground, blue is a signal.
USB, or a battery for less mains noise.
lightning.inoVerify & upload in Electrolark#include <Adafruit_SSD1306.h>
Adafruit_SSD1306 oled(128, 64, &Wire, -1);
#include <DFRobot_AS3935_I2C.h>
const uint8_t IRQ_PIN = 4, ADDR = 0x03;
DFRobot_AS3935_I2C lightning((uint8_t)IRQ_PIN, ADDR);
volatile bool event = false;
void IRAM_ATTR isr() { event = true; }
void show(const char* a, int km) {
oled.clearDisplay(); oled.setTextSize(1); oled.setCursor(0, 0); oled.print(a);
if (km >= 0) { oled.setTextSize(3); oled.setCursor(0, 20); oled.print(km); oled.setTextSize(1); oled.print(" km"); }
oled.display();
}
void setup() {
Serial.begin(115200);
pinMode(26, OUTPUT);
oled.begin(SSD1306_SWITCHCAPVCC, 0x3C); oled.setTextColor(WHITE);
while (lightning.begin() != 0) { Serial.println("AS3935 not found"); delay(1000); }
lightning.defInit();
lightning.manualCal(96, 0, 1); // tuning capacitor from the board, indoor mode, disturber detection on
attachInterrupt(digitalPinToInterrupt(IRQ_PIN), isr, RISING);
show("Listening...", -1);
}
void loop() {
if (!event) return;
event = false;
delay(5);
uint8_t src = lightning.getInterruptSrc();
if (src == 1) {
int km = lightning.getLightningDistKm();
Serial.printf("Lightning about %d km away\n", km);
show("Lightning!", km);
digitalWrite(26, HIGH); delay(200); digitalWrite(26, LOW);
} else if (src == 2) {
Serial.println("Disturber (man-made noise)");
} else if (src == 3) {
Serial.println("Noise level too high; move the sensor");
}
}
Move it away from electronics and mains wiring; try battery power.
Check the address switches against ADDR and the I2C wiring.
Lightning has to be within 40 km; test during a storm, not with a spark lighter.
It estimates the distance to the storm's edge in steps; treat it as a trend.
No, it only warns; follow lightning safety and unplug sensitive electronics.
Use indoor mode inside a building; outdoor mode is more sensitive but sees more noise.
6 parts: DFRobot Gravity Lightning Distance Sensor – I2C Interface, 40km Range, ESP32-WROOM-32 38-Pin Development Board, 0.96" OLED Display 128x64, Buzzer Module 3.3–5V, 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 (lightning.ino).
About ₹2,931 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
How lightning sensors detect strikes by radio; Using an interrupt pin; Telling lightning from noise.
When thunder is heard, go indoors; do not wait for the detector.
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.