O Jing's TinyML Gas Leak Sensor Uses the Bosch Sensortec Environmental Cluster for Quick Reactions

Running a specially-trained model entirely on-device, the GasSentinel sends out alerts via a Thread network.

Computer engineering undergrad O Jing has built a device, dubbed the GasSentinel, which aims to leverage the power of tinyML and sensor fusion to detect gas leaks within around a minute of exposure — using the Bosch Sensortec Environmental Cluster (BSEC) tools to do the heavy lifting entirely on-device.

Gas leaks can be dangerous but hard to detect. This project aims to use edge AI to provide low-latency, accurate detection of gas leaks. In particular, these are propane, butane and natural gas," Jing explains. "Interpreting gas sensor resistances is complex and may require specialized knowledge in electrochemical sensor behaviors. Resistance of the sensing element is non-trivially influenced by ambient conditions, and even past gas exposure events. As such, this situation provides an opportunity to utilize ML [Machine Learning] techniques to interpret the data."

The approach chosen by Jing for the project was to use a Silicon Labs MGM240PB32VNA Series 2 system-on-chip (SoC), which combines an Arm Cortex-M33 core running at up to 78MHz with 256kB of static RAM (SRAM) and 1.5MB of flash storage, with a Bosch Sensortec BME680 gas sensor. The combination was far from random: using the two provides access to Bosch Sensortec Environmental Cluster (BSEC), a library which provides signal processing and sensor fusion support on-device without having to offload raw data to a remote system.

The microcontroller is also powerful enough to run inferencing locally, using a custom model Jing trained on selected dangerous gases. "The model was trained with low concentrations of butane, propane, etc. at room temperature/pressure at (or above) their respective Lower Explosive Limit (LEL)," the student explains. "The model runs every 73.36s with a duty cycle of 25%. This project provides on-device inference, which allows for rapid reaction to events, and low data transmission overhead."

In testing, the gadget proved its worth — detecting deliberate "gas leaks" within 73.36 seconds of their occurrence, and sending out low-latency alerts via the SoC's in-built Thread networking support. "In general," Jing notes, "the model has a recovery period of minimally a few cycles, after being exposed to the positive class. Some of this behavior can be attributed to the behaviors of the MOx element."

The project's full write-up, along with PCB design files and source code as well as the training dataset, is available on Jing's GitHub repository.

Gareth Halfacree
Freelance journalist, technical author, hacker, tinkerer, erstwhile sysadmin. For hire: freelance@halfacree.co.uk.
Latest articles
Sponsored articles
Related articles
Latest articles
Read more
Related articles