BME688 DigitalNose: detect different smell patterns with the Bosch BME688 Sensor and AI technology

The BME688 DigitalNose App for PiCockpit enables your BME688 sensor to smell! We at pi3g e.K. offer a plug & play BME688 breakout module, which you can connect directly to the Raspberry Pi header. It connects the BME688 to your Raspberry Pi using I2C. Continue reading to learn how to use our PiCockpit webinterface to teach your sensor how to distinguish up to four smells.

This is modern day magic! Watch me demonstrate the capabilities of the BME688 in this fun “magic show” video:

Do you want to work some magic yourself?

After you have logged into your PiCockpit account and connected your RaspberryPi, select it from My Raspberry Pis. You will see a list of apps available for your Raspberry Pi. Click on the BME688 DigitalNose app to show its features.

Use Boschs AI Studio to train your smell detection algorithm. The DigitalNose App allows you to upload that algorithm, label your classes and display the output data all in one webinterface.

We have provided sample file(s) for your convenience.

BME688 DigitalNose Icon

Installation and Setup

Power your Raspberry Pi off and connect the BME688 module. Refer to your vendor’s instructions how to do this.

The pi3g BME688 breakout module connected to a Raspberry Pi 3B+: it can simply be connected to the GPIO Header. Note the special orientation, so that the SoC does not distort the BME688 heat measurement values.

Note: the BME688 also supports SPI operation. This app however only supports I2C operation.

Power your Raspberry Pi back on. By this time PiCockpit has hopefully been installed. You do not need to install any software besides PiCockpit for this app to work.

Open the BME688 DigitalNose app, and click on the Setup button:

BME688 DigitalNose setup button

This will lead you to the setup page

Enable the BME688 sensor by clicking on the enable sensor toggle.

Check whether the I2C address is correct. (For the pi3g BME688 breakout board, it is 0x77 by default – this might vary depending on your vendor).

Waiting for data. No data has been received from the sensor yet

You will be asked to agree to the Bosch BSEC license. This is necessary, since the sensors smell detection feature relies on Boschs proprietary BSEC 2.0 software.

Bosch BSEC license agreement

Note: The BME688 DigitalNose App and the BME688 Airmeter App cannot run simultaniously.

The sensor should now be enabled and PiCockpit will try to record data. If the sensor can be reached, the message below should update to Data received: … with a timestamp of the most recent data packet received.

Data received and timestamp

Note: data packet frequency depends on the settings – One measurement typically takes around 10 seconds.

Enable advanced view (show all data)

Enabling advanced view will show all parameters which the BSEC 2.0 software is capable of calculating. Those include the IAQ (Index of Air Quality), C02 equivalent and more.

Enable advanced view

These are all the additional measurements available in the BME688 DigitalNose App in PiCockpit, when using the advanced view

  • air humidity
  • air humidity (raw)
  • air pressure
  • air quality (IAQ)
  • air quality (IAQ) accuracy
  • air temperature
  • air temperature (raw)
  • breath VOC equivalent
  • breath VOC equivalent accuracy
  • CO2 equivalent
  • CO2 equivalent accuracy
  • comp gas value
  • comp gas value accuracy
  • gas percentage
  • gas percentage accuracy
  • gas resistance (raw)
  • sample number
  • static IAQ (raw)
  • static IAQ accuracy
  • timestamp

Note: for better CO2 measurement precision, we also offer a CO2 Sensor App!

Smell Detection Setup

The Smell Detection Setup is the place to upload your trained algorithm and to label your classes. We are currently usibg BSEC 2.0.6.1 so please make sure that you export your algorithm to match this version (requires at least Bosch AI Studio 1.6.0).

AI Studio exports the algorithm as a BSEC configuration file which ends with .conf. To upload the algorithm, just click the paperclip icon and select your file.

Upload your trained algorithm

The BME688 sensor can distinguish up to four different classes. Select the Gas Estimate Class that you want to name. Click on the X to remove the name.

Name your classes

Below the gas estimate classes you can add some notes.

Description and space for your notes

Reset all settings

The RESET ALL SETTINGS button is located at the bottom of the page. It allows you to reset the setup to factory default settings.

Be careful, the settings cannot be retrieved.

This concludes the setup. Press the SHOW SNIFF RESULTS button at the top to return to the data screen.

Return to data screen

Sniff Results

Under Sniff Results you can see a bar chart of the most recent data. The decimal values show the probability of each class being present.

Bar chart of Sniff Results

Description & Notes

Below the Sniff results you can find a line chart. It shows the histrorical data of a selected value. Hover over one of the dots to display the description of that data point.

Historical data line chart

With the light blue line chart handles you can zoom into a specific period of time and into a specific range of values.

Drag and Drop the white handles to the desired minimum and maximum

Line chart handles to zoom into the plot

Use the HIDE LINECHART button to hide the line chart.

Change which value is displayed in the line chart by selecting an option in the data table.

Data

The data table displays the current values of all captured data. It is advisable to enable the advanced view or else most of the values will be N/A.

Press the SHOW ME button behind the value you are interested in to display it in the line chart above.

Data table and show me button

Use the magnifying glass icon to focus on a special value

start typing the name of the value you are interested in to narrow down the selection

Note: The historical data will only be preserved while the app is open. Once you navigate away, or close the tab, the data will be lost forever.

FAQ

Is the BME680 also supported?

No, the BME680 is not supported because estimating the classes requires the sensor to run in parallel mode, which is a feature introduced with the BME688. But with our custom script you can use your BME680 to record data for training your classification algorithm (although it will take longer to record a meaningful number of samples).

How do I record data for training?

The simplest way is to use Boschs BME688 Gas Sensor Developer Kit. Another option is to use our custom script and any BME68X breakout board. Read this blog post for an in depth explanation on how to record the data.

Note: To use the script, the sensor needs to be connected to your Raspberry Pi via I2C (not SPI).

Where can I buy a compatible sensor?

We (pi3g e.K.) have developed a plug & play BME688 module for the GPIO port of the Raspberry Pi.

Other vendors, e.g. Pimoroni and Adafruit, also sell BME688 and BME680 breakout boards.

Can I use the DigitalNose App and the Airmeter App simultaniously?

No you cannot use both apps at once because they operate on the same BSEC instance and most likely on the same I2C address. In the future we might make it possible to run both apps at once, provided that you use two sensor with two different I2C addresses.

If you enable the advanced view, the DigitalNose App will display all values that BSEC is able to calculate.

Why are my Sniff Results not accurate?

There many possible reasons. These are some things you can do to improve the accuracy.

  • Use more training data
  • Use more diverse samples
  • Make sure the testing environment is not too different from the recording environment
  • Check the cofusion Matrix in AI Studio
  • Wait 5 minutes for the sensor to warm up and adjust to the environment.

Note: It takes up to one minute for the gas mixture to get inside the sensors casing.

Sample config file(s) for the BME688 DigitalNose app: