Edge Impulse logo
Blog Post

Preventing Gas-tly Accidents in Mines

TinyML, Machine Learning, Embedded DevicesThis ML-powered system detects the presence of methane using a Silicon Labs xG24 Dev Kit and a gas sensor.

Nick Bild

March 27, 2023

    Methane is a highly flammable gas that is commonly found in coal mines, and if left undetected, it can cause explosions and other dangerous incidents. The monitoring of methane levels in mines is done using specialized equipment, such as gas detectors and sampling devices. These devices are installed throughout the mine and are regularly checked and calibrated to ensure that they are providing accurate readings. If methane levels are detected to be above safe levels, miners are evacuated and the area is immediately ventilated to disperse the gas.

    Historically, there have been many tragic incidents caused by the presence of methane in mines. One of the most well-known incidents occurred in 1907 at the Monongah Mine in West Virginia, where a methane explosion killed 362 people. This disaster led to the introduction of stricter safety regulations in the mining industry, including the requirement for regular methane monitoring.

    While safety has improved greatly since that time, incidents do still occur. According to the US Mine Safety and Health Administration, methane explosions accounted for 72% of all US coal mine fatalities between 1980 and 2015. For this reason, methane monitoring is not optional in mining operations, however, the cost of implementing such systems can be substantial.

    The finished device

    Oftentimes, established practices, like the way we monitor environmental gasses, need a second look to determine if new efficiencies and cost savings can be achieved by leveraging recent technological advancements. The team at Zalmotek gave the present situation some consideration, and realized that there may be a big opportunity to reduce the cost of methane monitors with inexpensive development platforms and machine learning on the edge.

    The idea they came up with involved utilizing a tiny yet powerful hardware platform, along with a gas sensor. To interpret the sensor data, and determine if a gas leak may have occurred, they decided to build a neural network classifier with Edge Impulse Studio that is optimized to run on resource-constrained platforms. In particular, the Silicon Labs EFR32xG24 Dev Kit was chosen for its EFR32MG24B310F1536IM48 SoC with an Arm Cortex-M33 CPU, 256 KB of RAM, and 1,536 KB of flash memory to power through machine learning model inferences. An MQ-4 gas sensor module was interfaced with the EFR32xG24 Dev Kit through its abundant GPIO pins.

    After a 3D-printed case was created to house the hardware and protect it from the harsh environment of a mine, Zalmotek got to work setting up the software. Silicon Labs’ Simplicity Studio IDE was installed as a development environment for the EFR32xG24 Dev Kit. Next, a new project was created in Edge Impulse Studio, then the development board was linked with the project via the Edge Impulse data forwarder.

    Setting up the development board in Simplicity Studio

    The data forwarder makes it easy to collect training data by capturing sensor measurements from the linked hardware device, then automatically forwarding them to an Edge Impulse Studio project. And data collection is exactly what Zalmotek needed to do at this point. These samples are what the machine learning classifier needs to learn the difference between normal, safe conditions and a dangerous methane leak.

    Sensor measurements were recorded under a variety of conditions, both with and without methane gas present. To make the model as generalized as possible, data collection was done in different places, at different times of day, and under differing weather conditions. To prove the concept, a modest dataset consisting of about seven minutes worth of sensor measurements was collected.

    Exploring the training data in Edge Impulse Studio

    The next step is the fun part — it involves turning that raw data into knowledge. This is accomplished by creating an impulse, which specifies the end-to-end data analysis and processing pipeline that, in this case, will turn sensor readings into a prediction as to whether or not a gas leak has occurred.

    By clicking a few buttons in the Edge Impulse Studio web interface, Zalmotek specified preprocessing steps to split the sensor measurements into four second windows, then perform a spectral analysis to extract frequency and power characteristics from the signal. This brings the most relevant, information-dense portions of the signal to light, which in turn reduces downstream processing requirements and improves overall accuracy. Finally, a very simple fully connected neural network with two hidden layers was added to interpret the meaning of the data.

    An impulse that leverages a neural network classifier

    After making a few minor tweaks to the default hyperparameters, the training process was initiated. A short time later, training had completed, and metrics were displayed to help assess how well the model had learned from the data samples. The average classification accuracy rate achieved during training was 91.1%. This is quite impressive considering that such a small amount of data was supplied. This result was further validated using the more stringent model testing tool, which confirmed the result with a 91.67% accuracy score.

    To keep things as simple and inexpensive as possible, the goal was to have this algorithm running directly on the EFR32xG24 Dev Kit, with no reliance on the cloud or external systems via a wireless connection. Edge Impulse fully supports this development board, so making that happen was as easy as clicking on the deployment tab and choosing “Simplicity Studio Component." This created a downloadable package that contains everything that is needed to run the full machine learning data analysis pipeline.

    An excellent result with such a small training dataset!

    While commercial solutions to the problem of methane detection do already exist, Zalmotek’s simple solution may be able to save companies a lot of money. And this prototype is just the first step. With a little more work, the device could trigger an audible and visual alert to warn those in the area, or it could communicate over one of the wireless protocols supported by the hardware (Bluetooth, Zigbee, Thread, Matter) to send a message to a central server, or to supervisors on-site.

    Methane is not the only harmful gas that needs to be monitored for safety. Do you work in an industry that has similar concerns? Adapting Zalmotek’s solution for your own use case may be as simple as cloning their project and uploading your own data. Don’t worry, it is easier than you probably think, and you can even use their project documentation to guide you along the way.

    Want to see Edge Impulse in action? Schedule a demo today. 


    Are you interested in bringing machine learning intelligence to your devices? We're happy to help.

    Subscribe to our newsletter