LPG gas leak alarm
A kitchen gas sniffer that beeps and flashes the moment LPG levels climb.
Shop by category
Shop all componentsRO filters are rated in litres, but nobody counts. The Saier HZ06W is a small Hall-effect flow sensor for low flows (0.25-2.5 L/min), the range of a purifier tap. Each turn of its rotor gives a pulse. The Nano counts pulses on an interrupt, converts them to litres with a factor you measure once, shows the total on a TM1637 display and saves it to EEPROM so a power cut does not lose it.
Tick anything you already have and the total updates.
Saier HZ06W low-flow water sensor
Follow the colours: red is power, dark grey is ground, blue is a signal.
USB 5 V adapter.
ro_counter.inoVerify & upload in Electrolark#include <TM1637Display.h>
#include <EEPROM.h>
TM1637Display seg(4, 5);
const float PULSES_PER_L = 1800; // measure yours with a 1 litre jug
volatile unsigned long pulses = 0;
unsigned long saved = 0, baseLitres = 0, pressedAt = 0;
void onPulse() { pulses++; }
void setup() {
Serial.begin(9600);
seg.setBrightness(4);
pinMode(2, INPUT); pinMode(7, INPUT_PULLUP);
EEPROM.get(0, baseLitres);
if (baseLitres == 0xFFFFFFFF) baseLitres = 0;
attachInterrupt(digitalPinToInterrupt(2), onPulse, FALLING);
}
void loop() {
noInterrupts(); unsigned long p = pulses; interrupts();
unsigned long litres = baseLitres + (unsigned long)(p / PULSES_PER_L);
seg.showNumberDec(litres % 10000);
Serial.println(p);
if (litres != saved && litres % 5 == 0) { EEPROM.put(0, litres); saved = litres; } // save every 5 L
if (digitalRead(7) == LOW) { if (!pressedAt) pressedAt = millis(); if (millis() - pressedAt > 3000) { noInterrupts(); pulses = 0; interrupts(); baseLitres = 0; EEPROM.put(0, 0UL); } }
else pressedAt = 0;
delay(500);
}
The arrow on the sensor must match the flow direction; check the pull-up.
Repeat the 1 litre calibration a few times and use the average.
Use the right tube size and clips; push-fit fittings need square-cut tube.
Use your purifier maker's litre rating; many sediment filters are rated a few thousand litres.
Use it on the purifier outlet line as sold for drinking-water dispensers; flush it before use.
At most the last 5 litres, because it saves to EEPROM every 5 L.
7 parts: Generic Nano CH340 Development Board (Soldered), Saier HZ06W Water Flow Sensor (0.25–2.5 L/min) – DC 4.5-18V, TM1637 4-Digit 7-Segment Display Module, Resistor Assortment Kit (30 Values), Tactile Push Button Switch, 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 6 steps.
No. This page has the complete, tested code (ro_counter.ino).
About ₹586 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
Hall-effect flow sensors and pulse counting; Calibrating pulses per litre; Saving counters to EEPROM.
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.