A smart gas cylinder level monitor using a load cell and SMS alerts solves one of the most frustrating household problems in India — running out of cooking gas unexpectedly. Whether you use a 14.2 kg domestic LPG cylinder from IOCL, HPCL, or BPCL, or a commercial 19 kg cylinder, this ESP32-based project continuously weighs your cylinder and sends an SMS or WhatsApp alert when it reaches 20% remaining gas. Never be caught without gas for your morning chai or cooking again.
Table of Contents
- How the Gas Level Monitor Works
- Components Required
- Load Cell Setup and Calibration
- Wiring Diagram
- ESP32 Code with SMS Alert
- Alert System: SMS, WhatsApp and App
- Physical Installation Tips
- Frequently Asked Questions
How the Gas Level Monitor Works
The cylinder sits on a platform mounted on a load cell. A load cell converts mechanical force (weight) into a small electrical signal. The HX711 amplifier converts this signal to a digital reading for the ESP32. The gas level percentage is calculated by:
Gas Level % = ((Current Weight - Empty Cylinder Weight) / Full Gas Weight) * 100
For 14.2 kg domestic cylinder:
Empty weight: ~15 kg (cylinder tare)
Full gas weight: 14.2 kg
So full cylinder: ~29.2 kg
Empty (gas done): ~15 kg
At 20% remaining: 15 + (0.2 * 14.2) = 17.84 kg
Components Required
- ESP32 DevKit V1 (or NodeMCU ESP8266 for basic version)
- 50 kg load cell (single bar type or 4 load cell platform kit)
- HX711 load cell amplifier module
- SIM800L or SIM7600 GSM module (for SMS without WiFi dependency)
- 12V to 5V buck converter (for SIM800L power)
- Plywood or aluminium platform (to hold the cylinder)
- 5V power supply (2A minimum)
- Nano SIM card (Jio or BSNL work well — stable signal)
Total cost: Rs 800-1,500 depending on components chosen.
Load Cell Setup and Calibration
The load cell is a strain gauge device. For a gas cylinder weighing 15-30 kg, use a 50 kg capacity load cell for accurate readings with headroom.
Load Cell Types for This Project
- Single bar load cell (50 kg): Simplest option, directly under one leg of the platform. Rs 150-250.
- 4-load cell platform kit: More stable, evenly distributes weight. Rs 400-600 for all 4 + junction box. Recommended for round cylinders that can topple.
HX711 Calibration
#include <HX711.h>
// HX711 connections
#define DOUT_PIN 4
#define SCK_PIN 5
HX711 scale;
void calibrate() {
scale.begin(DOUT_PIN, SCK_PIN);
Serial.println("Remove everything from scale, press Enter");
while (Serial.available() == 0) {}
scale.tare(); // Zero with empty platform
Serial.println("Place 1 kg known weight, press Enter");
while (Serial.available() == 0) {}
long reading = scale.get_value(10); // Average of 10 readings
float calibration_factor = reading / 1000.0; // 1000g = 1kg
Serial.println("Calibration factor: " + String(calibration_factor));
// Save this value - use it in your main sketch
// Test with known weight:
scale.set_scale(calibration_factor);
Serial.println("Weight: " + String(scale.get_units(5)) + " kg");
}
Wiring Diagram
Load Cell (4-wire) to HX711:
RED -> E+ (Excitation positive)
BLACK -> E- (Excitation negative)
WHITE -> A- (Signal negative)
GREEN -> A+ (Signal positive)
HX711 to ESP32:
VCC -> 3.3V
GND -> GND
DT -> GPIO 4
SCK -> GPIO 5
SIM800L to ESP32 (for SMS):
ESP32 GPIO 16 (RX2) -> SIM800L TXD
ESP32 GPIO 17 (TX2) -> SIM800L RXD
4.2V (LiPo or regulator) -> SIM800L VCC
GND -> GND
IMPORTANT: SIM800L needs 2A peak current.
Do not power from ESP32 - use separate supply!
ESP32 Code with SMS Alert
#include <WiFi.h>
#include <HX711.h>
#include <Preferences.h>
// Configuration
const float EMPTY_CYLINDER_WEIGHT = 15.0; // kg (tare weight)
const float FULL_GAS_WEIGHT = 14.2; // kg (net gas weight)
const float ALERT_THRESHOLD = 0.20; // 20% remaining
const String PHONE_NUMBER = "+919876543210"; // Your number
HX711 scale;
Preferences prefs;
float getGasLevel() {
float weight = scale.get_units(10);
float gasWeight = weight - EMPTY_CYLINDER_WEIGHT;
if (gasWeight < 0) gasWeight = 0;
return (gasWeight / FULL_GAS_WEIGHT) * 100.0;
}
void sendSMS(String message) {
// Using SIM800L via Serial2
Serial2.println("AT+CMGF=1"); // Text mode
delay(1000);
Serial2.println("AT+CMGS="" + PHONE_NUMBER + """);
delay(1000);
Serial2.print(message);
Serial2.write(26); // CTRL+Z to send
delay(3000);
Serial.println("SMS sent: " + message);
}
void setup() {
Serial.begin(115200);
Serial2.begin(9600, SERIAL_8N1, 16, 17); // SIM800L
scale.begin(4, 5);
scale.set_scale(2280.0); // Your calibration factor
scale.tare();
WiFi.begin("YOUR_SSID", "YOUR_PASS");
}
void loop() {
float level = getGasLevel();
Serial.printf("Gas level: %.1f%%n", level);
static bool alertSent = false;
if (level 90.0) alertSent = false;
delay(300000); // Check every 5 minutes
}
Alert System: SMS, WhatsApp and App
SMS via SIM800L (Offline-Capable)
The SIM800L GSM module sends SMS without internet. This is the most reliable option for Indian homes since it works even during WiFi/internet outages — which is exactly when you might be cooking and discover the gas is out.
WhatsApp via Twilio or CallMeBot (via WiFi)
If internet is available, send WhatsApp messages using the free CallMeBot API:
void sendWhatsApp(String message) {
HTTPClient http;
String encoded = urlencode(message);
String url = "https://api.callmebot.com/whatsapp.php?phone=" +
PHONE_NUMBER + "&text=" + encoded + "&apikey=YOUR_KEY";
http.begin(url);
http.GET();
http.end();
}
Home Assistant Integration
If you use Home Assistant, publish gas level to MQTT and create automations for low gas notification via the Companion App:
mqtt.publish("gas_monitor/level", String(level));
# Home Assistant automation
alias: Gas Level Low Alert
trigger:
- platform: numeric_state
entity_id: sensor.gas_cylinder_level
below: 20
action:
- service: notify.mobile_app
data:
message: "Gas cylinder is {{ states('sensor.gas_cylinder_level') }}% full. Order now!"
Physical Installation Tips
- Build a wooden platform (20×20 cm, 18mm plywood) as the weighing surface
- Place the load cell between the platform and a solid base plate
- Use corner guides (PVC angle) around the platform to prevent the cylinder from tipping
- Route power cable away from hot gas pipes and burner area
- Place the ESP32 electronics module outside the kitchen cabinet, away from heat and moisture
- The monitor should be in a stable position — avoid moving the cylinder mid-measurement
Frequently Asked Questions
How accurate is the load cell for measuring gas level?
A calibrated 50 kg load cell with HX711 provides accuracy of +-50 grams, translating to +-0.3% in gas level for a 14.2 kg cylinder. This is more than accurate enough to trigger alerts at 20% and track usage over time. Temperature affects load cell readings slightly — keep the scale away from direct sunlight and heat sources.
Can this detect gas leaks?
The weight loss from a gas leak would be detectable if significant (more than 200 grams/hour for a visible leak). However, for reliable gas leak detection, add a dedicated MQ-5 LPG gas sensor. Combine the weight monitor (usage tracking) with the gas sensor (leak detection) for a comprehensive safety system.
Does this work for Piped Natural Gas (PNG) connections?
No. PNG is pressurised and metered separately — there is no cylinder to weigh. For PNG monitoring, track consumption via a flow sensor or monitor your monthly billing via the city gas distribution company’s API if available.
How long does an LPG cylinder last for an average Indian family?
A 14.2 kg cylinder lasts 45-60 days for a family of 4 with gas cooking (3 meals/day). With a gas monitor, you can track actual consumption patterns and calibrate your subsidy booking timing precisely via the Ujjwala/PAHAL portal.
Add comment