Electronic nose

Introduction to machine olfaction

An electronic nose (e-nose) system mimics the sense of smell and by using advanced chemometric data analysis, an e-nose can perform diagnostics and predictions that are superior to what can be accomplished by the sense of smell. The proper term for the technical discipline of trying to imitate the complex biological apparatus of scent recognition is machine olfaction.

Imagine a single e-nose unit capable of classifying the state of a process (e.g. a beer brewing process – or more generally speaking a fermentation process) and from the same odour signature can deduce both a prediction of the alcohol content as well as an estimate of the residual sugar concentration in the broth. The diagnostic analysis can furthermore tell, if the fermentation process is running out of statistical control and the beer is in risk of turning bad, unsuitable for human consumption.

By providing such an alert, or early warning, the e-nose and the associated automated chemometric data analysis enables you to apply appropriate countermeasures and hopefully save the batch in due time. A lot of money is at stake in industrial scale fermentations and robust early warning systems are therefore in high demand.

From a process monitoring point of view the interesting aspects reveal themselves, when lots and lots of data have been acquired and analysed properly. Chemometric models then allow the process to be characterised without the need for reference samples meaning that you can completely eliminate the risk of accidentially contaminating your process with wild yeast or other microbes when drawing reference samples, because you no longer need them.

In my past professional career I have been working extensively with chemical and chemometric analysis of both liquids and solid matter; I have never looked into gas phase analysis before. Hence my dedication to and interest in this project. My ambition is to develop a series of e-noses suitable for various purposes ranging from teaching basic electronics, sensor technology, and chemometrics to complete systems intended for industrial applications. I am still in the prototyping stage. The first case studies were released during the summer 2016 and I seek to augment the cases with diverse and didactic examples. Later, more refined sampling methodologies, advanced sensor excitation techniques, improved multivariate data analysis (in reality we are dealing with hyper cube data structures, so applying entry-level chemometrics is a bit naïve), and much more will be outlined here.

My designs range from simple 1 channel devices (see the 0x02 and 0x0E designs) for investigation of sensor response, transfer functions, and kinetic behaviour, over self-contained 4 channel devices (see the 0x09 design) for distributed remote hardwired monitoring to sophisticated 16 channel and 32 channel modular e-noses (see the 0x03 and 0x0A design) with the possibility of performing auto-configuration, auto-calibration, auto-diagnostics, and real-time update of the chemometric models, whenever a new (unknown) odour signature is encountered. All hardware is open-source. The chemometric algorithms applied are everyware.

E-noses are based on arrays of gas sensors. I have chosen the classical Taguchi gas sensor (TGS), which has been around for decades. The principles behind the Taguchi gas sensor are well-known and heavily documented. The innovation lies in the sampling methodology, the way the sensors are excitated (specifically, how the heater elements are energised), and how the acquired data from the sensor elements is treated mathematically. E-noses have many interesting potential applications, if you consider, how much information is present in gases and air at the ppm level, which is the lower practical measurement range that can be achieved.

For hints to some background literature, please have a look at my Mendeley group about e-noses. The literature database is constantly growing and I encourage anyone with a keen interest in the topic to keep a close eye on it.

If you wonder just how to put sensor technology, multivariate data analysis, and representative sampling into a process monitoring and control context, please have a look at my short introduction to Process Analytical Technology.

To demonstrate the feasibility of the simplest e-nose, a design similar to the 8 ch 0x00 TGS array, I have prepared a couple of didactic case studies, which I hope that you will both enjoy and allow to inspire you. It must be emphasized that so far nothing has been done to optimise neither the odour signature capture, nor the pre-processing of the responses prior to multivariate data analysis. The results, however, indicate that my most simple e-nose design indeed is capable of solving some rather interesting classification problems.

 

For the Danish-reading audience, a short article outlining the perspectives for DIY machine olfaction was published in Dansk Kemi in December 2016.

In March 2017 I gave a status on my DIY machine olfaction project for a Danish biotech company. See this tweet. Interesting problems exist in industry that could benefit from cheap, robust, and simple e-noses.

 

To introduce the hardware, the response of a single gas sensor, when exposed to a simple problem (alcohol present in the headspace above a beer), is analysed. Individual Taguchi gas sensors can be tested with a relatively simple breakout board connected to the popular and widespread Arduino technology platform. Here the data acquisition system consists of an Arduino Uno R3 powered from the USB port of a computer. I have developed such a gas sensor shield for the Arduino Uno R3 (see the 0x0E design).

Breakout board (Arduino Uno R3-compatible shield) for a Taguchi gas sensor

 

The blue trimpotentiometer sets the sensitivity of the Taguchi gas sensor, the sensor response (the VRL pin) is connected to the A0 input of the Arduino Uno R3, and the VH pin is hardwired to VCC, so the heater inside the Taguchi gas sensor is excitated with a DC voltage equal to the voltage across the USB port.

A simple test of the MQ-3 Taguchi gas sensor, which, according to its datasheet, is quite sensitive towards ethanol, the active entoxicating ingredient in beer, wine, spirits etc., could be a short exposure to the headspace (gas phase) of a bottled beer poured into a glass. This is illustrated in the next figure.

Headspace sampling of liquid sample

 

The gas sensor is removed from the headspace as soon as the sensor response reaches its maximum value (meaning just before the sensor goes into saturation) according to the next figure.

Sensor response for MQ-3 sensor in beer experiment

 

Without going into much detail at this point, it is evident that the sensor has picked up something in the headspace and has reacted reasonably fast; the rise time from initial exposure to near-saturation is about 15-20 s. When the sensor is then removed from the headspace it is observed that the recovery time to the initial baseline value is longer than 120 s.

An electronic nose is an augmentation of this simple breakout board (0x0E) with multiple Taguchi gas sensors of different types collected in an array. The following discusses the preparation, use, and interpretation of data from an array with eight different Taguchi gas sensors.

 

Preparing the e-nose system for first time use

Before you can use the TGS sensor array for anything, you will have to invest minimum 48 hours preparing the sensors for first time use. This is a process known as burn in and it simply means connecting the heater elements of the TGS sensors to a DC voltage. This preparation of the array has several advantages: sensitivity increases, baselines are easier to reproduce and much more stable, and the results become more reliable due to less instrumental drift.

The figure below shows a typical burn in process. In the beginning the sensor responses are adjusted to the same value for each TGS sensor by manipulating the load resistors. The instrumental drift is noticable, most obvious with around 200 mV for MQ-6 and MQ-7. After successfull burn in baselines can deviate as little as 10 mV over 1 hour. Proper initial sensor conditioning is crucial, so do not skip this step.

Origin_e-nose_0x0F_burn_in_w_insetE-nose TGS sensor array burn in. Time scale: 0-10 min, response scale: 0 – 5 VDC. The inset shows the last 2 minutes of data acquisition.

 

The following graph shows the sensor responses after 3 hours of burn in. Note the minute deviation over time.

Origin_e-nose_0x0F_stable_baseline_during_burn_in_w_insetE-nose TGS sensor array responses during burn in. Time scale: 17 selected minutes during burn in, response scale: 0 – 5 VDC. The inset shows the last 3 minutes of data acquisition.

 

Adjust the load resistors to the desired sensitivity; I usually select the same offset value for all eight TGS channels, but this is a factor that can, and should, be optimised using sound statistics.

An example of a extraordinary stable baseline with equal offsets for all eight TGS sensors is given below.

Origin_e-nose_0x0F_stable_baseline_after_burn_in_w_insetE-nose TGS sensor array responses during burn in. Time scale: 17 selected minutes during burn in, response scale: 0 – 5 VDC. The inset shows the last 4 minutes of data acquisition.

 

The triangular appearance of the curves in the inset is due to the analogue-to-digital converter shifting between two (or few) discrete steps; I consider this as proof of instrumental stability. Note, however, that some noise must be anticipated in a process environment or any other real application. The applied datalogger (Arduino Nano) is a so-called single-ended analogue-to-digital converter and it is susceptible to electromagnetic interference, which will propagate to the responses. Appropriate software filtering will remedy this. Choosing a power supply with low ripple voltage and capable of providing enough current at all times is a good start for achieving relatively clean data.

When the 48 hours have elapsed and the baseline is stable, then you can start acquiring quality data.

 

Let me know, if there is a specific feasibility that you would like to see documented here.

 

Example: discrimination between different hops varieties

When brewing profesionally, raw material control raises much concern. The brewery risks loosing lots of money, if a brew has to be discarded due to either poor hygiene or out-of-spec raw materials.

Hops help preserve beer and is therefore a vital ingredient. Hence, a fast, reliable, robust, and cheap method capable of assessing authenticity and freshness of hops would be a most welcome technical aid in many small-scale breweries not having access to sophisticated QC/QA laboratories.

This case discusses the development of such a method.

Hops come in various forms. This case concerns the pelletised form, see the following figure.

humlepelletsCollection of various pelletised hops varieties

 

An odour signature acquired on a sample of pelletised hops (Hallertau) is given below.

Origin_e-nose_0x0F_odour_signature_hops_Hallertau_w_insetE-nose odour signature from the hops variety Hallertau. Time scale: 0-20 min, response scale: 0 – 5 VDC. The inset shows the first 60 s of data acquisition.

 

The initial part of the signature on the left is the baseline response, which indicates the response from fresh air inside the sampling cell. As soon as the sample is added to the sampling cell the TGS array responds. The curves climb quite steep until they reach a plateau. The right-most reading (steady-state condition) is used as response.

It is apparent that the behaviour of the curves can be modelled with simple mathematical functions enabling a severe reduction in the time needed to obtain valid estimates of the responses. Most of the dynamic behaviour happens within the first few minutes of data acquisition, so there is no need to prolong the data acquisition beyond reason.

The response is measured relative to a stable baseline, which is obtained just prior to adding the sample to the sampling chamber. The following figure shows an odour signature for the hops variety Amarillo; the inset focuses on the first minute of data acquisition.

Origin_e-nose_0x0F_odour_signature_hops_Amarillo_w_insetE-nose odour signature from the hops variety Amarillo. Time scale: 0-20 min, response scale: 0 – 5 VDC. The inset shows the first 60 s of data acquisition.

 

When the acquisition of data (odour signature capture) is done and the sample has been removed from the sampling chamber, a critical step must be performed: the TGS array must be properly equilibrated with fresh, clean air prior to the next analysis. This is called baseline recovery. A typical baseline recovery is depicted below.

Origin_e-nose_0x0F_odour_signature_baseline_recovery_w_insetE-nose baseline recovery. Time scale: 0-20 min, response scale: 0 – 5 VDC. The inset shows the first 4 minutes of data acquisition.

 

It is important to underline that some chemical species adsorb irreversibly to the surface of the sensing elements effectively reducing their sensitivity over time. Do not expect that a previous baseline can be exactly reproduced, but it usually succeeds within a few tens of mV. Baseline offsets can be manipulated simply by adjusting the load resistance across each TGS sensor.

A first view on the responses indicates that is it possible to mathematically separate hops varieties based on their odour signature. The figur below shows the responses for the varieties Cluster and Northern Brewer (double determinations). Note the clear differences in sensor responses for the two varieties for all eight TGS channels.

Origin_e-nose_0x0F_Odour_responses_for_hops_varieties_Cluster_and_Northern_BrewerE-nose odour responses for hops varieties Cluster and Northern Brewer

 

A common exploratory data analysis method for finding groups/clusters in data, is the so called singular value decomposition (SVD), which shares many similarities with principal component analysis (PCA). Many high-level programming languages have data analysis packages capable of performing such analysis. The open source software GNU Octave is used in the following didactic SVD example.

First, the odour response matrix X has to be entered/loaded into the software. Columns represent the sensor response per TGS channel. From left to right we have MQ-2, MQ-3, MQ-4, MQ-5, MQ-6, MQ-7, MQ-8, and MQ-135. Rows represent observations (individual measurements/samples). Each hops sample has been analysed in duplicate and the data matrix is organised in such way that the two replicates on each sample are grouped together. All units are in mV to avoid struggling with decimal points.

 

Odour response matrix for all analysed hops samples.

 

The mean values for each column are calculated and then the means are substracted from each element in their respective column. The data matrix Xc is then said to be mean-centered. The effect is that the space spanned by the response vectors (columns) is translated in such way that the origin of the coordinate system lies right in the middle of the data swarm. This is a common first pre-processing step in many chemometric algorithms and it has no apparant negative consequences nor caveats.

gnu_octave_xc_odour_responses_hopsOdour response matrix for all analysed hops samples. Mean-centered data (column-wise).

 

The standard deviation for each column is calculated (based on the unmanipulated data in X). The mean-centered columns are divided with their respective standard deviations. The data matrix Xcs is then said to be auto-scaled. The effect is that the variance for each column is exactly 1. In other words, each column (variable) has the same influence on subsequent analysis, since numerically large values have been transformed/scaled. However, this potentially boosts negative effects of excesssive noise, so care should be advised. A filter can be applied a priori to auto-scaling in order to somewhat counteract this.

gnu_octave_xcs_odour_responses_hopsOdour response matrix for all analysed hops samples. Auto-scaled data (column-wise).

 

An SVD is performed on the auto-scaled data matrix Xcs. The loading vectors represented by the matrix V are given in the following figure.

gnu_octave_vcs_odour_responses_hopsLoading vectors.

 

The singular values are contained in the matrix D and are shown below.

gnu_octave_dcs_odour_responses_hopsSingular values.

 

From the singular values it is possible to calculate, how much variance each component explains out of the total variance in the data matrix Xcs. Note that components are ordered in descending order with the direction of the first component explaining most of the variance in Xcs, the direction of the second component explains the second-most variation in Xcs and so on and so forth.

gnu_octave_sscs_odour_responses_hopsSum of squares (component-wise explained variance in the data matrix Xcs)

 

Scores can be produced in several ways. Here the data matrix Xcs is projected onto the loading matrix V resulting in the score matrix T as shown in the following figure.

gnu_octave_tcs_odour_responses_hopsScore vectors.

Score vectors (columns) can be plotted against each other in a biplot thereby reveailing inter-relationships between observations (samples).

 

When performing a classical PCA on the autoscaled responses, the following score plot can be obtained, when plotting the scores for the first two principal components against each other. Note that some samples have been left out to improve separation between classes and also the readability of the figure. Samples that group close together show similarity, hence, double determinations on the same sample ideally are close, if the analytical instrument is not drifting.

Origin_e-nose_0x0F_odour_signature_hops_scores_autoscaled_PC1_PC2Score plot for the first two principal components, based on autoscaled responses, Xcs. Reduced sample set.

 

For the sake of completeness, all samples are shown in the following figure.

Origin_e-nose_0x0F_odour_signature_all_hops_scores_autoscaled_PC1_PC2Score plot for the first two principal components, based on unscaled responses, X. Full sample set.

 

The responses are available for download: data_hops_odour_responses (.csv-file)

In conclusion, this case study demonstrated that it is indeed possible to discriminate between different hops varieties by analysing their odour signature with simple DIY hardware for a total sum of EUR 75,- and basic chemometric data analysis.

 

Example: discrimination between different common spices and herbs

As in the previous case with hops, the aim is the create a model that allows spices and herbs to be separated based on their odour signature.

 

spicesCollection of various spices and herbs

 

An odour signature (e-nose array response) acquired on a sample of freshly ground black pepper is given below.

Origin_e-nose_0x0F_odour_signature_freshly_ground_black_pepperE-nose odour signature from freshly ground black pepper. Time scale: 0-20 min, response scale: 0 – 5 VDC. The inset shows the first 60 s of data acquisition.

 

For comparison, the odour signature for curry is given below.

Origin_e-nose_0x0F_odour_signature_curry_w_insetE-nose odour signature from curry. Time scale: 0-20 min, response scale: 0 – 5 VDC. The inset shows the first 60 s of data acquisition.

 

The plot below shows the two distinct response patterns for black pepper and curry. It is apparent that these two spices are excellent candidates for a classification model. Also note the remarkably good repeatability for freshly ground black pepper.

Origin_responses_pepper_vs_curryE-nose odour responses for curry and black pepper

 

Responses for all four tested spices are shown in the next figure.

Origin_responses_spices_2E-nose odour responses for curry, black pepper, paprika, and licorice root

 

Similarly, odour signatures were acquired for four herbs (dried, ground). Results are given below.

Origin_responses_herbs_2E-nose odour responses for thyme, oregano, basil, and bay leaves

 

<in development>

Exploratory data analysis (SVD) is performed on the odour responses.

gnu_octave_x_odour_responses_hopsOdour response matrix for all analysed spice and herb samples.

Loading vectors are given in the following figure.

gnu_octave_v_odour_responses_hopsLoading vectors.

Singular values are contained in the matrix D and are reproduced below.

gnu_octave_d_odour_responses_hopsSingular values.

The component-wise explained variance (sum of squares) in the data matrix X is calculated from the singular vaules, as shown below.

gnu_octave_ss_odour_responses_hopsSum of squares (component-wise explained variance in the data matrix X).

Scores are calculated by projecting the data matrix X onto the loading matrix V resulting in the score matrix T:

gnu_octave_t_odour_responses_hopsScore vectors.

</>

 

Odour responses for herbs and spices are merged and a PCA is performed on the augmented data set. A first attempt on discriminating between the various spices and herbs is shown in the next figure. Hint for reading score plots: observations/samples that show similarity are grouped together. Hence, double-determinations on the same sample should not be too far apart from each other, if the produced odour is adequate and the analytical instrument is in statistical control.

scores_PC1PC2_unscaled_spicesScore plot for the first two principal components, based on unscaled responses

 

The responses are available for download: data_spices_herbs odour responses  (.csv-file)

In conclusion, this case study demonstrated that it is indeed possible to discriminate between different spices and herbs by analysing their odour signature with simple DIY hardware for a total sum of EUR 75,- and basic chemometric data analysis.

 

Example: discrimination between different olive oil products

Counterfeit olive oil products represent a serious threat to consumer safety as well as a significant economic loss for the established industry. Hence, development of analytical methods capable of confirming authenticity of these products has always been a priority within the olive oil producing exporting countries (olive OPEC).

For screening purposes, a fast, reliable, robust, and cheap method capable of verifying authenticity of olive oil products would therefore be a strong weapon in the first line of defense for detecting adulterated products; national food authorities and customs services.

This case discusses the development of such a method.

 

olive_oilsCollection of various commercial olive oil products

 

An odour signature (e-nose array response) acquired on a sample of olive oil of the brand Boromeo Organic is given below.

Origin_e-nose_0x0F_odour_signature_Boromeo_w_insetE-nose odour signature from the olive oil Boromeo Organic. Time scale: 0-20 min, response scale: 0 – 5 VDC. The inset shows the first 60 s of data acquisition.

 

For comparison, the odour signature for the olive oil Budget is shown on the next figure.

Origin_e-nose_0x0F_odour_signature_Budget_w_insetE-nose odour signature from the olive oil Budget. Time scale: 0-20 min, response scale: 0 – 5 VDC. The inset shows the first 60 s of data acquisition.

 

The following plot shows the two distincts response patterns for olive oil products Budget and Boromeo. Note the clear differences in responses indicating that these two olive oil products can be separated based on their odour signature.

Origin_e-nose_0x0F_odour_response_Budget_vs_BoromeoE-nose odour responses for olive oil products Budget and Boromeo

 

Two olive oil products, Classico and Delicato, from the same producer, Monini, are shown in the next figure. Note the similarity between the responses for these two olive oil products.

Origin_e-nose_0x0F_odour_response_Classico_vs_DelicatoE-nose odour responses for olive oil products Classico and Delicato, both from the manufacturer Monini

 

Exploratory data analysis (SVD) is performed on the odour responses, X.

 

gnu_octave_x_odour_responses_olive_oils_fullOdour response matrix for all analysed olive oil samples.

 

The odour response matrix X is mean-centered resulting in Xc:

gnu_octave_xc_odour_responses_olive_oils_fullOdour response matrix for all analysed olive oil samples. Mean-centered data (column-wise).

 

And then Xc is auto-scaled giving Xcs:

gnu_octave_xcs_odour_responses_olive_oils_fullOdour response matrix for all analysed olive oil samples. Auto-scaled data (column-wise).

 

An SVD is performed on the data matrix Xcs resulting in the following loading matrix V:

gnu_octave_vcs_odour_responses_olive_oils_fullLoading vectors

 

The data matrix Xcs is projected onto the loading matrix V resulting in the score matrix T:

gnu_octave_tcs_odour_responses_olive_oils_fullScore vectors.

 

As in the previous cases, the aim is to create a model that allows different olive oil products to be separated based on their odour signature. A PCA is performed on the odour responses. Note that the odour signature captures have been perfomed in triplicate for each sample (three dots for each olive oil product on the preceeding score plots).

Origin_e-nose_0x0F_odour_signature_all_olive_oils_scores_autoscaled_PC1_PC2Score plot for the first and the second principal components, based on autoscaled responses

 

A slightly better separation between the classes can be obtained, when plotting scores for the first versus the third principal component, as shown below.

Origin_e-nose_0x0F_odour_signature_all_olive_oils_scores_autoscaled_PC1_PC3Score plot for the first and the third principal components, based on autoscaled responses

 

The responses are available for download: data_olive_oil_odour_responses (.csv file)

 

In conclusion, this case study demonstrated that it is indeed possible to discriminate between different olive oil products by analysing their odour signature with simple DIY hardware for a total sum of EUR 75,- and basic chemometric data analysis.

 

Further work

  • Development of didactive tutorials so you can make your own e-nose system using my design files (or purchase a kit/assembled system from me)
  • I am aiming at EUR 100,- for an 8 ch version, EUR 250,- for a 16 ch version, and EUR 500,- for a 32 ch version. All systems will include Raspberry Pi Zero computer, touch screen, power supply, auto-configuration and much more
  • Publish schematics, DipTrace libraries, and experimental results somewhere. If you are interested in co-authoring a journal article, let me know

Comments are closed.