MQTT Scales for LPG gas bottle monitoring | Home Automation Tech Blog

Fun with Embedded Electronics

MQTT Scales for LPG gas bottle monitoring

Having ran out of gas a few times just when you are busy cooking can be a frustrating experience. Of course, the regulator is fitted with a gauge but as is normal, you never check this before you use it.

So, it was time to geek it up a bit and see if I could generate an alarm on reaching a low limit point and then still have time to order more gas. The point of this limit will be finally determined when I run out for the first time but the code is currently set at 5%. Monitoring this for a few days indicates we are using around 1% per day. The bottle is supplied with 12Kg of liquid compressed gas. The tare weight can be programmed into the ESP8266 module from Node-red to account for slightly different weight bottles. They come with the tare weight painted on them.

My initial idea was to replace the gauge on the regulator with a pressure sensor but because this is an explosive gas, consideration of this was necessary. Working in the oil and gas industry any sensors install in this type of setup have to be Intrinsic Safe with a Zener Barrier between the electronics and the sensor. IS sensors and barriers don’t come cheap due to the high costs of certification and testing. Now, being in a home environment it was easy to ignore this but I decided that safety was too important here.

I have decided to use a weighing system to measure and calculate the weight of the gas in the bottle. Being liquid it has a mass of 12Kg for this particular bottle of LPG. The bottle itself has weight and this is subtracted from the measured weight.

The design is based on an ESP8266 NodeMCU module and an HX711 module. This is fitted into a small enclosure with a 4 pin connector for the load cell and standard 2.1mm power connector for the 5V input.


The load cell is a beam type and rated for 50Kg. To bottle and contents weight around 28Kg when full.

20170121_181333  Scales   114990100 1_03

The base was designed with 3D CAD software and made up by a local machine shop from 8mm aluminum plate. The load cell is a low cost unit from Seeed Studio in China.

As the bottle will be fitted to the scales all the time, I needed a way to always add the tare weight to the scales on power up. During the calibration, a value is printed out to the serial terminal of the tare value read when powered up. By using this value in the code, I was able to always get a valid reading of whatever was on the scales during power up. Normally you would put nothing on them and during power you would set the TARE so that the reading would be ZERO. I have about 1-5 grams of error with this during testing which I can live with.

The ESP8266 reads the HX711 and calculates the total weight, gas weight and the percentage. It sends out an MQTT topic every 5 seconds and the Node-red server extracts the data and displays this on a Dashboard as shown below.


The data is checked to see if the 5% limit is reached and a voice alarm is announced. A later update will send a notification to both phone and the wife’s.

The code to handle the check for the limit in Node-red is very simple as show below. I also update the Emonscms website every 5 mins with the net weight, gross weight and percentage.



The ESP8266 is a great little module and makes wifi based projects like this so easy. Coding took 1 evening with 1 additional evenings code to do the calibration. Thanks to the HX711 library for the Arduino, the coding is also simplified.

Post a Comment