Projects and News
08-04-2022

Using AI-based Sensor Fusion for Smoke Detection

Introduction

A smoke detector is a useful device that can even be a lifesaver in an emergency. However, such devices can be quite error-prone and cause a false alarm once triggered by overcooked food, a buildup of dust, and even pesky insects. A software engineer and tech enthusiast, Stefan Blattmann, decided to upgrade a smoke detector by using AI sensor fusion to determine a fire alarm.

Note: The sensor system developed in this project is only an addition to a smoke detector and can’t replace it.

This project is based on the Arduino Pro Nicla Sense ME board and has the following goals:

  • Reducing false alarms
  • Detecting sensor failures
  • Calculating all processes on the Arduino board
  • Notifying about the fire alarm via Bluetooth

The project covers the following stages: dataset collection, AI model training, and inference on a device.

Hardware Overview

To reproduce the working principle of a smoke detector, the author used Sensirion SPS30. This sensor measures particulate matter in the air and reports the number and size of particles, working like photoelectric smoke detectors.

To make the experiment even more interesting and accurate, additional sensors (most of the sensors are redundant) around the SPS30 were used. Different sensors around the SPS30 which are used to measure "meta" data around the particles to classify the environment.

The redundant sensors include:

  • Humidity/Temperature: BME688 and SHT31
  • Air Pressure: BMP390 and BMP388
  • Gas (VOC): SPG30 and BME688

Since the gas sensor readings from SPG30 and BME688 are not 100% comparable due to internal measurement methods and calibration, it was decided to use the calculated VOC and check if the reading difference was greater than 10%.

There is no fallback for the SPS30 "smoke sensor", so the sensor readings must be unique. Otherwise, a sensor error should be generated.

Sensors:

Arduino Nicla Sense ME

  • Bosch BHI260AP: 6 axis IMU (3-Axis Accelerometer + 3-Axis Gyroscope) + MCU
  • Bosch BMP390: Pressure sensor
  • Bosch BMM150: Magnetometer
  • Bosch BME688: Humidity, temperature, and gas sensor (VOC)

External Sensors

  • Bosch BMP388: Pressure sensor
  • Sensirion SPS30: Particular Matter sensor (Smoke detector)
  • Sensirion SHT31: Humidity and temperature sensor
  • Sensirion SPG30: Gas sensor (VOC)
  • GPS: For Timesync of the sensor readings

 

Sensor Fusion

Sensor fusion is essential to this experiment as it combines environmental data from disparate sources to improve fire detection. Sensor fusion algorithms can be implemented in different ways:

  • (Non)-Linear functions, like x^2 + y
  • Thresholds, like: if (x > 10)
  • Linear Regression, like AI models

For this particular case, linear regression-based sensor fusion was selected as the best option.

Procedure

Data collection

The collection of a comprehensive dataset is a vital step for the project's success as many different environments and fire sources may exist. In this experiment, the following scenarios were captured:

  • Normal indoor
  • Normal outdoor
  • Indoor wood fire, firefighter training area
  • Indoor gas fire, firefighter training area
  • Outdoor wood, coal, and gas grill
  • Outdoor high humidity

 

 

The dataset consists of nearly 60.000 readings with a sample rate of 1Hz for all sensors. To keep track of the data, a UTC timestamp was also added to every sensor reading.

Training

Let's start setting up everything for model training on the Neuton platform.

In the "My Solutions" tab, create a new solution, choose a CSV file for training, and upload it. Neuton automatically analyzes data and checks if everything is fine for training. After that, you can select the target variable. For this project, it is "fire alarm". 

 

The dataset used for this experiment is not split into training and validation, so the "Holdout Validation" option is disabled.

As the next step, we need to configure the training in detail. In this case, the data type is Float 32-bit. The TinyML mode is activated here because the model will be deployed on the Arduino board. We also select Accuracy as the Target metric as the fire alarm should be predicted as precisely as possible. 

 

We also select the bit depth 32, as we model will run on 32-bit Arduino Pro Nicla Sense ME. Since this project uses a fixed sample rate of 1 Hz, there is no need for tuning Digital Signal Processing.

Now everything is ready for model training. Let the Neuton platform build a model for you.

Arduino Programming & Bluetooth Adding

The author used the Arduino example from the official repo for model inference. The detailed source code is available via the Github repo. The dataset and the data collector are also available.

As Nicla Sense ME supports sending messages via Bluetooth to any device, it was decided to add this option to make the project even more multifaceted. For programming Bluetooth with Arduino, just follow the instruction on the Cheat Sheet so that in case of a fire alarm you can be notified in a timely way.

Total Footprint

 

We have the model that needs only 101 Byte of Ram and 958 Byte of Flash memory on the Arduino Nicla Sense ME. Inference time is around 360 us. The resulting model demonstrates ultra-compact size and fast performance! 

Conclusion

Sensor fusion is indeed a good solution for complex issues like this case as it ensures using extra metadata, thus reducing false alarms. Such budget-friendly sensor systems can make life easier for firefighters and literally save lives because the system can be trained to detect fire gases that cause fainting and other dangerous health conditions.

To read the detailed step-by-step description of all project steps, check out the full project by Stefan Blattmann. 

Eager to create your own project? Try Neuton for free right now!


Stay updated, join the community
slack