RisalDash RisalDash

Project · Weight · LPG

Know exactly how much gas is left

An LPG cylinder gives no warning — it just runs out mid-dinner. But gas has weight, and weight is easy to measure: a load cell under the bottle plus an HX711 lets an ESP32 show the net kg of gas and a % remaining, then flash a red LED and buzz before you're empty. No pressure gauge, no guessing — a scale that reads in “meals left”.

ProjectHX711Load cellLPGESP32
ESP32 smart gas cylinder monitor: HX711 load cell weighs the LPG bottle, net kg and % left

The idea — total weight minus the empty bottle

The load cell reads the total weight sitting on it. A “3 kg” LPG bottle weighs about 5 kg empty (the tare) and 8 kg full — so the gas itself is total − tare, and the percentage is that over a full 3 kg charge. Three lines of maths turn a raw reading into the only number you care about: how much cooking is left.

// LPG "3 kg" bottle: ~5 kg empty (tare), 3 kg of gas full -> 8 kg total full.
const float TARE = 5.0, NET_FULL = 3.0;

total = scale.get_units();       // kg on the load cell (real: HX711)
net   = total - TARE;            // the gas alone
if (net < 0) net = 0;
pct   = net / NET_FULL * 100.0f; // % of a full charge

int s = pct < 8 ? 2 : (pct < 20 ? 1 : 0);   // empty <8 %, low <20 %
if (s && state == 0 && evlog) evlog->print("Gas low - order a refill");
state = s;
ledOk = s == 0; ledLow = s >= 1; buzz = s == 2;

Wiring — HX711 is just two data pins

The HX711 is a 24-bit ADC made for load cells: the four load-cell wires go to its E+/E−/A+/A− pads, and it talks to the ESP with a plain DT (data) and SCK (clock) pair. Power it from 3.3 V or 5 V, common ground:

HX711 load-cell amplifier wired to an ESP32: VCC, GND, DT and SCK
Two data pins (DT/SCK) plus power. Built in BoardLab.

Calibrate the tare once

Accuracy is all in two constants: the calibration factor (put a known weight on, divide the raw count by the kg) and the tare (your specific empty bottle). Do it once and store them:

// One-time tare calibration — do it with the EMPTY bottle on the scale:
#include "HX711.h"
HX711 scale;
scale.begin(DT_PIN, SCK_PIN);
scale.set_scale(CAL_FACTOR);     // from a known weight: raw / kg
scale.tare();                    // zero it — now get_units() reads kg above empty
// TARE above is then the printed empty-bottle weight; adjust NET_FULL to your bottle.

The dashboard & alerts

A big bar gauge for %, net and total kg as stats, a Good/Low/EMPTY badge, and the classic green/red LED + buzzer — under 20 % warns, under 8 % is empty. The shipped example (examples/04_Templates/GasCylinder) drains a fake bottle so you watch the gauge fall and the alert fire with nothing on a scale; swap one line for the real HX711. Push to MQTT and Home Assistant can order the refill by automation. This is a focused cousin of the generic WeightScale template.

Bill of materials

PartRole~Cost
ESP32 (or ESP8266)brain + Wi-Fi + dashboard$3–5
Load cell (5–20 kg) + HX711the weighing$3–5
Green + red LED, buzzerlocal status$1
A flat board / platethe bottle sits on it

Pick the load cell above your full-bottle weight (a 20 kg cell for a big cylinder). Mount it in a simple platform so the whole bottle rests on the cell.

Watch the bottle drain and the alert fire on a fake scale — before you buy the load cell.