With energy prices surging to never before seen heights, keeping track of our gas consumption is more important than ever before.
Open Gas Monitor is a free and open source platform to help you to monitor and analyze your gas consumption. The platform consist of three parts: sensors that monitor gas meters, a cloud service that stores data, and a mobile application for Android and iOS that displays data in real-time.
In this article we will guide you through the process of building such a sensor device and configuring it to start sending data.
Monitoring a meter with magnetic impulse countingFortunately, there is an easy way to monitor gas consumption. Most installed gas meter supports magnetic impulse counting. The meter emits a magnetic impulse for a specific unit of gas consumed. It is indicated on the front of the meter. (Look for "1 imp = 0.1 m³" or "1 imp = 0.01 m³".) This value is called scale, please note it.
All we need is a sensor that registers impulses by detecting changes in the magnetic field. This can be done easily with a Reed switch (see parts list), that is commonly used for doors and windows.
The Reed switch can be installed in a non-intrusive way by simply attaching it to the outside of the gas meter. Afterwards it registers impulses by detecting changes in the magnetic field, every time a dial turns around inside the gas meter.
Building the sensor deviceThe main board for the sensor device is the Wemos D1 Mini (see parts list). It is a very reliable and widely available ESP8266 microcontroller board, that can be programmed directly via USB.
The first step is to solder the two wires of the reed switch to the microcontroller board. The two wires should be soldered to GND and D3, the order (polarity) does not matter.
That's it, your device is ready to be programmed. As a final step, following the programming, place the microcontroller in the plastic casing (see parts list), leaving only the cables coming out, and close it for physical protection.
[image]
Installing the Gas Monitor app and getting your API keyAll monitors receive a unique token for authentication called an API key. In order to get your API key, you will need to install the Gas Monitor app (see parts list) on your smartphone. After installing, open the app and sign up for an account. Upon completion, sign in and go to the account section, and press the plus sign in the top right corned to create your first monitor. Enter the name, current value of the meter, and the scale value (see above) to create the monitor.
Open the monitor you just created, copy the 32 character long API key to the clipboard, and send it to yourself.
The key can be copied to the clipboard simply by clicking the icon on the right.
Programming the microcontrollerTo program the microcontroller, you will need the Arduino IDE (see parts list) installed on your computer, a proper USB-A to Micro-USB cable (see parts list), and a firmware to to run on the microcontroller.
First, install the Arduino IDE on your computer. Second, download the source code of the firmware from GitHub (see parts list) and save it to a location of your choosing.
In the Arduino IDE open the downloaded firmware by selecting the 'gasmonitor-firmware.ino' file. Set up your firmware by inserting your API key and WiFi network credentials into the 'configuration.h' file.
// Modify this section using your credentials
#define WIFI_SSID = "Insert your wifi network name here"
#define WIFI_PASSWORD = "Insert your wifi password here"
#define WEBHOOK_KEY = "Insert your api key here"
Save and press the "Upload" button in the IDE to compile and upload the firmware onto the microcontroller.
Power on the device. If you done everything correctly, it will connect to your network and begin sending data, and the indicator led will flash every second.
Installing the sensorThe sensor can be installed in a non-intrusive way by simply attaching it to the outside of the gas meter, usually at a specific place. (Use Google to find out more about your meter.) Fortunately, most reed switches come a piece of with a self adhesive tape on one side, so it will hold it in place.
To verify that the sensor works, wait for the numeric dials make a complete turn. The indicator light will turn on if the reed switch senses the magnetic impulse.
Monitoring via the Gas Monitor appAfter configuring and installing the sensor device, real-time data of gas consumption is sent to our cloud platform. As data starts streaming in, you are able to monitor your gas consumption with the Gas Monitor app.
Comments