LPG gas leak alarm
A kitchen gas sniffer that beeps and flashes the moment LPG levels climb.
Shop by category
Shop all componentsThe ZMPT101B module holds a small voltage transformer that isolates the mains and gives a small AC signal centred at about 2.5 V. The Nano samples it quickly over several mains cycles and works out the RMS value. You calibrate it once against a trusted meter. Because the module is connected to mains, the build is about safety first: a closed box, a fused plug lead and no exposed screws.
This project connects to mains. If you are not trained to wire mains, ask an electrician to do that part.
Always unplug before opening the box.
Use a fused lead and a closed, non-metal box.
Tick anything you already have and the total updates.
Follow the colours: red is power, dark grey is ground, blue is a signal.
The Nano and module run from a separate 5 V USB supply. The mains only goes to the module's screw terminals.
mains_monitor.inoVerify & upload in Electrolark#include <Adafruit_SSD1306.h>
Adafruit_SSD1306 oled(128, 64, &Wire, -1);
float CAL = 0.86; // adjust once against a meter
float vMin = 999, vMax = 0;
float readRms() {
long sum = 0, sumSq = 0; const int N = 1000;
for (int i = 0; i < N; i++) { int v = analogRead(A0); sum += v; sumSq += (long)v * v; }
float mean = (float)sum / N;
float var = (float)sumSq / N - mean * mean;
return sqrt(max(var, 0.0f)) * CAL;
}
void setup() { oled.begin(SSD1306_SWITCHCAPVCC, 0x3C); oled.setTextColor(WHITE); delay(1000); }
void loop() {
float v = readRms();
if (millis() > 5000) { vMin = min(vMin, v); vMax = max(vMax, v); }
oled.clearDisplay();
oled.setTextSize(3); oled.setCursor(0, 0); oled.print((int)v); oled.print("V");
oled.setTextSize(1); oled.setCursor(0, 40); oled.print("Low "); oled.print((int)vMin);
oled.setCursor(0, 52); oled.print("High "); oled.print((int)vMax);
oled.display();
delay(500);
}
The module's trim pot is turned all the way down; turn it until the waveform is large but not clipped.
Recalibrate after the module warms up for a few minutes.
Sampling is too slow; keep 1,000 samples, which covers several mains cycles.
About 1-2% after calibration, good enough to spot low or high voltage.
The transformer isolates it, but treat the whole box as mains and keep it closed.
Use an ESP32 instead of the Nano and send the readings over Wi-Fi.
4 parts: ZMPT101B AC Voltage Sensor Module, Generic Nano CH340 Development Board (Soldered), 0.96" OLED Display 128x64 and Official Raspberry Pi 4 USB-C Power Supply – 15.3W. Tools: Digital Multimeter. 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 (mains_monitor.ino).
About ₹1,223 for the parts at the prices on this page, plus tools if you do not have them. Quantity price breaks lower the cost when you build several.
Measuring an AC voltage by RMS sampling; Calibrating against a reference; Why isolation matters.
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.