Introduction: Gassistant

About: We are the IoT R&D group at AxonActive Vietnam.

The issue we want to address: In many Asia countries, LPG bottle exists in most household. There is a frustration when the bottle run out while cooking. Moreover, there is a risk of explosion (In Vietnam, where I live, there are some cases the bottle explored, claimed the life of innocent people).

We have ambition to make something that can help:

- detect if the household gas bottle is running out

- warn if the bottle is leaking gas (which can lead to explosion)

We come up with the idea: Based on the weight of the bottle, it can tell if the gas is running out. It also can help detect gas leaking threat based on the continuous reducing gas weight exceed a certain period.

Hence, we make the Gassitant: a device that sitting underneath the gas bottle.

Step 1: Gather Material

To build 1 gas scale, you will need the following items:

  1. ESP8266 - v12. NOTE: On the yellow board we use:

    GPIO_4: is 5, GPIO_5: is 4 (they are label incorrectly)

  2. 3 Straight-gauge loadcells (we use 20kgs loadcells)
  3. 3 Loadcell amplifiers
  4. Breadboard & male-female, male-male cables
  5. Bolts & nuts (to assemble the loadcell)

Additionally, we use a Arduino Uno for burning the source code
to ESP (A colleague suggests we use the USB UART CP2102 but we didn't buy to try because we have spare Uno from previous project)

Step 2: Make the Scale Base

If you want to CNC your base like we did, please find the AutoCAD file at

https://github.com/aavn/Gassistant/tree/master/design

Otherwise, you can create your own design ( We are interested in a solution that use a smaller number of loadcells than us, please leave us a comment if you have any suggestion).

Design:

The idea is 3 loadcells are positioned at 3 corners of an equilateral triangle. The weight will be distributed on 3 loadcells. We sum up the result to have the actual weight of the bottle.

Step 3: Assemble the Base

  1. Put the loadcells on the base: This require a little bit strength and skill with nuts & bolts. We were inspired by this setup: loadcell & platforms
  2. Connect each loadcell with its amplifier (please refer to the fritzing diagram)
  3. Connect amplifiers to ESP8266-v12:

Amplifier ------------ ESP8266

VCC ------------------ VCC

GND ----------------- GND

DT1 ------------------ GPIO_12

SCK1 ---------------- GPIO_14

DT2 ------------------- GPIO_13

SCK2 ----------------- GPIO_5

DT3 ------------------- GPIO_4

SCK3 ----------------- GPIO_16


DT1, SCK1: DT & SCK pins on the 1st amplifier.

DT2, SCK2: DT & SCK pins on the 2nd amplifier.

DT3, SCK3: DT & SCK pins on the 3rd amplifier

Step 4: Setup ESP8266 With Arduino IDE

The original source code for the Gassistant can be download from here.

For coding on ESP, we use the ESP8266 Addon on Arduino IDE.
With this approach, we can reuse most Arduino libraries for ESP. You can find the instruction how to setup here.

We use the Arduino Uno as the bridge to upload the source code to ESP. The setup as following:

Arduino Uno Reset - Arduino GND

ESP8266 ------------------ Arduino Uno

RX -------------------------- RX

TX -------------------------- TX

VCC ------------------------ 3.3V

CH_PD -------------------- 3.3V

GND ----------------------- GND

GPIO_15 ----------------- GND

GPIO_0 ------------------ GND

Also make sure that you choose the correct board type for the ESP (like the attached photo).

Find the ESP8266 chip ID (We use it as a unique ID for the scale):

Upload the ESP_chip_id sketch from

https://github.com/aavn/Gassistant/tree/master/design

to your ESP board, and note the chip ID printed on the Serial monitor. This ID will be used later when you add your scale to the cloud server.

Note:

If you want to re-upload to ESP board while it is still connecting to bridge, just unplug ESP's VCC and GPIO_0, then re-plug them before uploading new code.

Step 5: Download Gassistant Source Code to ESP

Get the source code for the Gassistant base from GasScale github

You can find the libraries needed inside the library folder. Copy them to your Arduino IDE folder.

Upload the source code to your ESP.

Disconnect the ESP from Uno, put the battery on.

Your scale is ready to go.

Step 6: Install the Android App

You can find the .apk file also in GitHub at

The app will be published on Google Play later, when we finish clean up.

Step 7: Add Your Scale to the Cloud

When adding your scale to the cloud, you will be prompted for:

  1. 'Given code' (which is the Chip ID we read in the previous step)
  2. Name: whatever name you want to call your scale
  3. Tank type: in Vietnam, we refer it as the net weigh of the gas inside (exclude the bottle weigh). In here, we have 6kg (not very common), 12kg & 13kg (these 2 types are common for household),
  4. Amount to remind out-of-gas: The Gassistant will trigger out-of-gas warning when the amount of gas in the bottle drop below this value)
  5. Alert gas usage time: The Gassistant will trigger an alert for leaking-gas-threat when it detects that gas reducing continuously exceed this period. If you (or your family member) is cooking then of course you can discard the message. Otherwise, you need to act.

NOTE: The Gassistant cannot stop the gas leaking for you. When you receive the alert, it's up to you to verify and take action if needed.

Step 8: Setup Wifi for Your Gassistant

Finally, the last step is to bring your Gassistant to your home wifi

  1. Your mobile must connect to the wifi network that you want to config for your Gassistant
  2. Stay close to your Gassistant (prefer <5m)
  3. On the Gassistant mobile app, choose Connection
  4. Enter the password for the wifi network. Press Save

We embedded the SmartConfig into the app for ease of use. If you are interested in deep knowledge how SmartConfig work, you can take a look here (I could not find the explanation for ESP SmartConfig, but after all, from what I searched around, they use the same concept)

Step 9: Source Code

If you want to get your hand dirty and modify the way your Gassistant work, please feel free to get the source from the link Gassistant. We are also interested to see any upgraded/modified versions from you :)

Step 10: Post-mortem

There are some issues that we did not have enough knowledge (& effort) to improve:

  1. Power: the battery only last a couple days. For long term, adapter is needed. This is not so handy and beautiful.
  2. Wooden case: we use wood since we think it strong enough (to be under the bottle), and non-conduction. But after a few months, it shrink a bit here and there. We do not have knowledge about material to make a better one yet (It will definitely be in our (already very long) study list :) )

You can find more information on this project at www.gassistant.org.