
Monitoring Gas Bottle Levels with ESPHome, HX711, and Home Assistant
Knowing how much gas is left in a propane or butane bottle is important. It is one of those small things that can make a big difference in everyday life. Whether you’re using gas for grilling, heating, or at a cabin, running out unexpectedly is never convenient. In this guide, we will build a reliable gas bottle monitoring solution. It will be smart using an ESP32, a load cell, and the HX711 amplifier. The solution will be fully integrated with Home Assistant.
This uses the same core principles as water tank monitoring. There are a few important adjustments tailored to gas bottles.
Why Measure Gas by Weight?
Unlike water tanks with consistent shapes, gas bottles don’t always give accurate readings based on pressure or volume sensors. However, weight is a reliable indicator:
- The empty weight (tare) is fixed
- The gas content has a known maximum (e.g. 11 kg)
- Weight decreases linearly as gas is used
This makes load cells a perfect solution.
Components Needed
Here’s what you’ll need for this project:
1. ESP32 (M5Stack Atom)
A compact and powerful microcontroller with built-in Wi-Fi. The M5Stack Atom is particularly convenient due to its small size and USB-C power.
2. HX711 Load Cell Amplifier
This module reads very small changes in resistance from the load cell. It converts these changes into digital signals that the ESP32 can process.
3. Load Cell
A strain gauge-based sensor that measures weight. Common types include:
- 5 kg (too small for gas bottles)
- 20 kg (good for small bottles)
- 50 kg (recommended for gas tanks)
Make sure your load cell can handle the total weight of the bottle.
4. Stable Platform
You’ll need a flat and stable surface where the gas bottle can sit on top of the load cell. Mechanical stability is critical for accurate readings.
Wiring Overview
Typical HX711 to ESP32 connections:
| HX711 | ESP32 |
|---|---|
| VCC | 3.3V |
| GND | GND |
| DT | GPIO32 |
| SCK | GPIO26 |
The load cell connects directly to the HX711 using its four wires.
ESPHome Configuration
Below is a robust ESPHome configuration with filtering and spike protection. This ensures stable readings even with noise or slight movement.
esphome:
name: gasstank-vekt
friendly_name: Gasstank Vekt
esp32:
board: m5stack-atom
framework:
type: arduino
logger:
api:
ota:
- platform: esphome
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
bluetooth_proxy:
sensor:
- platform: hx711
name: "Gasstank Vekt"
id: gasstank_sensor
dout_pin: GPIO32
clk_pin: GPIO26
gain: 128
update_interval: 10s
unit_of_measurement: "kg"
accuracy_decimals: 1
filters:
- median:
window_size: 5
send_every: 1
- sliding_window_moving_average:
window_size: 5
send_every: 1
- lambda: |-
if (x < -800000 || x > 100000) {
return NAN;
}
return x;
- calibrate_linear:
- -551500 -> 0.0
- -303029 -> 11.0
- lambda: |-
if (x < 0.0) return 0.0;
if (x > 12.0) return 12.0;
return x;
- platform: template
name: "Gasstank Prosent"
unit_of_measurement: "%"
accuracy_decimals: 0
update_interval: 10s
lambda: |-
if (isnan(id(gasstank_sensor).state)) {
return NAN;
}
float percent = (id(gasstank_sensor).state / 11.0) * 100.0;
if (percent < 0.0) return 0.0;
if (percent > 100.0) return 100.0;
return percent;
Calibration
Calibration is crucial for accuracy.
- Measure the raw value when the bottle is empty
- Measure again when full
- Replace the values in
calibrate_linear
Example:
- -551500 -> 0.0
- -303029 -> 11.0
This maps raw sensor values to kilograms.
Filtering and Stability
Gas bottles don’t change weight rapidly, so we can aggressively filter noise:
- Median filter removes spikes
- Moving average smooths readings
- Lambda filter removes impossible values
This ensures your graphs in Home Assistant look clean and reliable.
Home Assistant Integration
Once ESPHome is set up, the sensors appear automatically in Home Assistant:
sensor.gasstank_vektsensor.gasstank_prosent
You can display them in dashboards or use them in automations.
Useful Automation Example
One of the most practical uses is getting notified before the gas runs out.
YAML Automation
alias: Gas Low Warning
description: Notify when gas bottle is low
trigger:
- platform: numeric_state
entity_id: sensor.gasstank_prosent
below: 20
condition: []
action:
- service: notify.mobile_app_phone
data:
title: "Gas Level Low"
message: "Gas bottle is below 20%. Time to replace it."
mode: single
Node-RED Example
If you prefer Node-RED, here’s a simple flow:
- State node
- Entity:
sensor.gasstank_prosent
- Entity:
- Switch node
- Condition:
< 20
- Condition:
- Notification node
- Send push notification
This gives you a visual and flexible way to manage alerts.
Advanced Ideas
Once you have this working, you can extend it further:
1. Predict Remaining Time
Track usage over time and estimate how many days are left.
2. Combine with Temperature
Gas usage often correlates with outdoor temperature (in Celsius). You can build smarter predictions.
3. Dashboard Visualization
Use a gauge card in Home Assistant to display percentage clearly.
4. Cabin Monitoring
Perfect for remote cabins where you want to check gas levels before arriving.
Common Pitfalls
Here are a few things to watch out for:
- Unstable surface → causes fluctuating readings
- Cable noise → keep HX711 wires short
- Poor calibration → leads to wrong percentages
- Temperature drift → minor effect, but can matter outdoors
Conclusion
You can build a highly reliable gas monitoring system by combining an ESP32, HX711, and a load cell. This system integrates seamlessly with Home Assistant. With proper filtering and calibration, the system becomes stable enough for real-world use and eliminates the guesswork of remaining gas.
This is a simple project with a big quality-of-life improvement—especially for cabins, outdoor kitchens, or anyone relying on gas regularly.
Some of the links in this article are "affiliate links", a link with a special tracking code. This means if you click on an affiliate link and purchase the item, we will receive an affiliate commission. The price of the item is the same whether it is an affiliate link or not. Regardless, we only recommend products or services we believe will add value to our readers. By using the affiliate links, you are helping support our Website, and we genuinely appreciate your support.