LPG gas leak alarm
A kitchen gas sniffer that beeps and flashes the moment LPG levels climb.
Shop by category
Shop all componentsA Hall-effect current sensor measures up to 50 A in either direction without breaking the circuit's ground, and a simple divider module measures battery voltage. The Arduino adds up current over time to show amp-hours in and out. A blade fuse right at the battery protects the wiring, and a buck-boost module turns 12 V into a clean 5 V for the electronics.
A shorted 12 V battery can melt wires and start a fire: fuse the positive lead first.
Do not connect or disconnect the sensor while current is flowing.
Tick anything you already have and the total updates.
Copper electrode tips for a battery spot welder, if you build your own 18650 pack
ACS758 ±50 A Hall current sensor, 40 mV per amp
Buck-boost converter: 12 V battery to a steady 5 V for the Uno
INA3221: three small channels (up to about 1.6 A each) for USB loads and sensors
Coulomb counter for a single-cell LiPo project
Solar LiPo charger for a small 3.7 V sensor node
Plug-in voltage divider for the Gravity system
Mains-to-3.3 V module for a sealed product (installed by a qualified person)
Follow the colours: red is power, dark grey is ground, blue is a signal.
Battery, panel and charge controller are sold separately. Fit the fuse within 20 cm of the battery terminal.
solar_monitor.inoVerify & upload in Electrolark#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
Adafruit_SSD1306 oled(128, 64, &Wire, -1);
const float V_SCALE = 5.0; // the 0-25 V module divides by 5
float ZERO_V = 2.50; // ACS758 output at 0 A (about VCC/2)
const float MV_PER_A = 40.0; // ACS758LCB-050B at 5 V
double ah = 0;
unsigned long last;
float avgVolts(int pin) {
long s = 0;
for (int i = 0; i < 64; i++) s += analogRead(pin);
return s / 64.0 * 5.0 / 1023.0;
}
void setup() {
Serial.begin(115200);
oled.begin(SSD1306_SWITCHCAPVCC, 0x3C);
last = millis();
}
void loop() {
float vbat = avgVolts(A0) * V_SCALE;
float vout = avgVolts(A1);
float amps = (vout - ZERO_V) * 1000.0 / MV_PER_A; // + = into the battery
unsigned long now = millis();
ah += amps * (now - last) / 3600000.0;
last = now;
Serial.print("raw "); Serial.print(vout, 3);
Serial.print(" V "); Serial.print(vbat, 2);
Serial.print(" A "); Serial.print(amps, 2);
Serial.print(" Ah "); Serial.println(ah, 3);
oled.clearDisplay(); oled.setTextColor(WHITE); oled.setTextSize(2);
oled.setCursor(0, 0); oled.print(vbat, 2); oled.print(" V");
oled.setCursor(0, 22); oled.print(amps, 1); oled.print(" A");
oled.setTextSize(1); oled.setCursor(0, 46);
oled.print(vbat * amps, 0); oled.print(" W "); oled.print(ah, 2); oled.print(" Ah");
oled.display();
delay(1000);
}
The sketch above runs here on a simulated Arduino Uno. Move the sliders for the sensors and buttons it reads, and watch the Serial monitor, display and outputs change.
Set ZERO_V from the raw value at 0 A. Keep magnets and current-carrying wires away from the sensor.
The Uno's 5 V may be lower than 5.0 V; measure it and replace 5.0 in avgVolts.
Average more samples and twist the sensor wires together.
Not exactly. It drifts over days; reset it when the battery is known to be full.
Use a higher-range ACS758 or a shunt; this one is ±50 A.
Yes for measuring; charging and protection stay with a proper BMS and charge controller.
15 parts: Double Head Spot Welding Copper Needle Electrode Tip (100 mm), Uno R3 CH340G ATmega328p Compatible Development Board, Allegro MicroSystems ACS758LCB-050B-PFF-T Hall Current Sensor Module – 50A Bidirectional, Voltage Detection Sensor Module, 0-25V DC, Automotive Blade Fuse, Generic DC-DC Boost & Buck Converter Module, ±3–30V Adjustable Output, Input 3.6–30V, 0.96" OLED Display 128x64, INA3221 Triple-Channel Current and Voltage Monitor Module, Digital Watt Meter and Power Analyser, Seeed Studio Studio Grove LTC2941 Coulomb Counter Module 3.3-5V – I2C Interface, plus 5 more. 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 to 3 hours. The build on this page has 6 steps.
No. This page has the complete, tested code (solar_monitor.ino).
Yes. The Run it panel under the code runs this exact sketch on a simulated board. Move the sliders or press the buttons for the sensors it reads, and the Serial monitor, display and outputs react as they will on the real build. It is a simulation, so real readings depend on your parts and wiring.
About ₹5,060 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
Bidirectional Hall current sensing; Integrating current to amp-hours; Why every battery lead needs a fuse.
A shorted 12 V battery can melt wires and start a fire: fuse the positive lead first. Do not connect or disconnect the sensor while current is flowing.
Ideas that reuse this build: Raspberry Pi relay HAT garden timer. They are listed under Take it further on this page.
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.
Learning project. Check every circuit and the datasheet of each part before you power it up.
raw 1.501 V 7.50 A -24.97 Ah 0.000 raw 1.501 V 7.50 A -24.98 Ah -0.007 raw 1.501 V 7.50 A -24.98 Ah -0.014
A simulation of the sketch above, so you know what to expect. Real readings vary with your parts and wiring.