TinyML: Detecting Harmful Chemicals in Hostile Environments

TinyML has proven to be a powerful tool for implementing machine learning models in devices and environments with limited resources. In this article, we explore its potential in the refinery and chemical sector.

Industry at the Edge
Tags:

TinyML application in Chemical Industries

In industries such as refineries and chemistry, there is always the risk of chemical leaks or emissions of harmful gases. These incidents not only pose a threat to employees working in these facilities but also endanger the surrounding population and the environment. Without adequate monitoring and control, these leaks can cause significant damage in unexpected places and unleash long-term catastrophic consequences.

Currently, various security measures and control systems with predefined limits are implemented to detect and notify such chemical leaks. There are commercial solutions that cater to specific compounds, but they involve tedious and rigid installation processes.

However, a classification model can greatly improve these efforts by identifying concentrations of harmful gases. What's more impressive is that these models can be optimized and executed on small devices with limited resources and long battery life, making them ideal for quick, cost-effective, and flexible deployment.

Installing new monitoring devices in high-criticality environments or areas with strict certification requirements can be challenging. However, with TinyML models, we can integrate classification capabilities into existing devices that already meet the necessary safety standards, without invasive RAM or Flash memory consumption.

Another crucial aspect to consider is the difficulty of installing new wired systems alongside existing configurations in laboratories or chemical industries. Fortunately, TinyML models running on microcontrollers (MCUs) consume minimal battery power, enabling years of operation without the need for recharging.

One platform that facilitates model training for such applications is Edge Impulse. It allows training models using laboratory data. All that is required is a suitable multichannel sensor to start collecting samples of the chemicals we want to detect.

Here are a couple of popular alternatives for prototyping this project:

● MiCS-4514 gas sensor

● Seeed Studio Multichannel Gas Sensor V2

While these sensors have some differences, both are capable of detecting compounds such as:

● Carbon Monoxide (CO)

● Nitrogen Dioxide (NO2)

● Ethanol (C2H5CH)

● Nitrogen Dioxide (NO2)

● Ammonia (NH3)

● Volatile Organic Compounds (VOC)

By choosing a sensor that best fits our specific requirements, we can obtain temporal series measurements for the target chemical (under direct exposure). This data can be imported from a CSV file or transmitted through serial ports or specific integrations provided by the chosen sensor platform.

Recently, maker Roni Bandini shared his project "Detect Harmful Gases" on the Edge Impulse website. The trained model in Edge Impulse is a classification model with only two output classes: normal and harmful. Using a simple neural network classifier with int8 quantization, it was able to detect the presence of harmful chemicals in just over 1 second.

This project was made possible with an Arduino Nano 33 BLE Sense, where the model utilized 1.7K of RAM and 18.9K of Flash memory. The model's inference time was only 1 ms, making it suitable for deployment on this and similar devices.

This scenario emphasizes the following aspects:

● Having a model that can run on a device with minimal resource consumption eliminates the need for complex, rigid, and costly installations.

● Deploying a machine learning model with around 1.7K of RAM and 20K of Flash memory consumption enables the deployment of new intelligence on existing devices without going through potential certification processes (such as the ATEX directive).

● Platforms like Edge Impulse facilitate and democratize the process of ideation and model creation for laboratory staff with domain control over chemistry and its data, without excessive knowledge of technical aspects related to machine learning.

Projects like this and many others continue to demonstrate that TinyML is not just a paradigm that reduces the cost of executing machine learning; its ubiquity enables scenarios that would be highly complex without these optimizations.

Want to know more about TinyML? replay "The Cutting-EDGE of MLOps" session.

The convergence of machine learning and edge AI presents Engineers with unique challenges that require a specialized skill set beyond traditional machine learning engineering. In this webinar you will gain insights into trends and best practices in implementing Machine Learning at the Edge, from optimisation, and deployment to monitoring. Learn from OWKIN, APHERIS, MODZY, PICSELLIA, SELDON, HPE, NVIDIA and BARBARA how to:

🔒 Enhance Data Access, Security and Privacy through Federated Learning

💪 The tools, systems and structures you need to put in place for real-time AI

🚀 Improve model performance for Computer Vision

⚙️ Run successful Machine Learning Model Inference

💡 Optimize ML models for edge devices

🔒 Secure your ML models in the edge

About the Author

Jose Vicente is an R&D Software Engineer currently based in Spain, whose passion for urbanism drove his interest in technology, that's why his career has been directed to the intersection between Artificial Intelligence and IoT (AIoT).

The last few years he has been deeply involved in the Smart Cities industry, going from the elevator industry in China, to the oil and gas industry where IoT and predictive maintenance are playing an important role, to modernization and decarbonization.

Jose Vicente is very committed to the role of the AI of things as a positive disruptor in society and in people's daily lives.