Training a digital nose
A glimpse into our consulting projects and how those can help support our educational projects. This is a case study I am working on for my consulting website.
Yuri and I have been developing a system using a digital nose. Specifically this is the BME688 environmental sensor chip. As an environmental sensor, it can measure humidity, temperature, air pressure and air quality. These measurements can be used to train an AI driven (neural net) to detect specific odors in the air.
This is a little technical,, but I wanted to give a little information about a project we have been working on. If you have any technology question, feel free to DM me through Substack.
Getting Started
A friend mentioned that he had an idea to build a sensor to detect something by the gases in the air. He asked me to research the viability of this product. A few Google searches lead me to the Bosch BME688 system. I found several articles about training the system to detect foods such as coffee, meat and cheeses.
We could build a basic system using a Raspberry Pi and sensor break-out board. Bosch also provides a “development kit” which uses an ESP32 based microcontroller to record the data to be used in training the system. For a small investment, we bought all the components needed to start.
Evaluating the Basic Concept
We actually did this in 2 steps. First, I didn’t have easy access to what we ultimately wanted to detect, but I had easy access to something similar. We had some kids in the village we are working with, help us collect a few specimens and we did some quick training of the system. We collected some beetles and ants from the jungle, and were able to train the system to detect the difference between a beetles and ants.
The second step was to send the some training device to my friend to collect some samples in a lab. We used these samples to verify that we can in detect what he wants to be able to detect. He wants to detect a specific animal, so he collected air measurements from the animal’s habitat within the lab, air from a confined space with the animal, and some air within the lab. We ran this data through several different training scenarios to confirm that the system could be trained. The basic results from training indicates successfully being able to classify the data properly. Additional testing using data we partitioned from the initial samples, also resulted in being able to at least classify the air sample.
Data Collection
To truly develop a robust detection system, we need to collect more data. The BME688 has a heater that “burns” the particles in the air to create a signature of the compounds in the air. The software can be configured to heat using different heater profiles. This configuration is copied to a SD card in the device. The data is also recorded into files on the SD card.
It is all texted based so I decided to use GitHub. Each SD card was set up as a Git repository, and synced to a repository on GitHub. I had my friend sign up to GitHub, and install the GitHub UI. We had a few minor technical issues, but was able to get this configuration to work smoothly. I could push configuration updates to the GitHub repositories, and my friend could easily push new data files up. All he had to do was mount the SD card to his computer, and run the GitHub Desktop app to sync the SD card to the GitHub repository.
Simplifying the Data Submission Process
This worked well enough for us, but my friend wanted to hire some other people to collect more data. I needed to simplify the process even more. Bosch provides the source code for the development kit as part of the examples in their software library. The kit has a Bluetooth Low-Energy interface for managing monitoring the data recording or switching the device into testing mode. I could easily modify it to support reading the data files. There is a web-bluetooth API which this BLE interface works with, so I created a webapp that can connect to the development kit device using my extension to read the data files.
GitHub has also has an API which I am using to create the data files in our GitHub repository. So now the process for his co-workers is:
Turn on the device
Load the webapp in a BLE enabled browser
Press Connect (and select the device from the Bluetooth pairing list)
Press Stop to stop the data collection (the device automatically start in data collection mode)
Press Send All (or select an individual set of data to send)
After a few minutes all new data is submitted, and the webapp resets ready for the next device.
Our Prototype Device
Yuri helped me build a prototype using a Raspberry Pi model 3b we had on hand, and the BME688 break-out board. We added an LED and used a small jar glued to the top as a cover. Yuri drilled wholes in the jar to enable air flow. the jar could be unscrewed so that we could test different airflow scenarios.
Consulting to Teaching Opportunities
This project has lead to several teaching opportunities.
Giving some kids an opportunity to join in with a simple demonstration while we were verifying the basic concept. The kids found it pretty cool.
Web-Bluetooth and GitHub API integration documentation.
Yuri has been exploring Raspberry Pi Pico and MicroPython along with different sensors.
We are using these to build some educational labs for the jungle community.
Hire us for you next project
I am always happy to answer technology related questions. If you are a paid subscriber, I can coordinate some basic technical work with our team in Brazil. You get some technical work with my oversight, and at a very low hourly rate. I started in the computer industry over 30 years ago, so I have lots of technical knowledge. You can hire me for more in-depth projects, and it help low-income communities in Brazil.