# Machine olfaction

Machine olfaction is the automated simulation of the sense of smell. An emerging application in modern engineering, it involves the use of robots or other automated systems to analyze air-borne chemicals. Such an apparatus is often called an electronic nose or e-nose. The development of machine olfaction is complicated by the fact that e-nose devices to date have responded to a limited number of chemicals, whereas odors are produced by unique sets of (potentially numerous) odorant compounds. The technology, though still in the early stages of development, promises many applications, such as: quality control in food processing, detection and diagnosis in medicine, detection of drugs, explosives and other dangerous or illegal substances, disaster response, and environmental monitoring.
One type of proposed machine olfaction technology is via gas sensor array instruments capable of detecting, identifying, and measuring volatile compounds. However, a critical element in the development of these instruments is pattern analysis, and the successful design of a pattern analysis system for machine olfaction requires a careful consideration of the various issues involved in processing multivariate data: signal-preprocessing, feature extraction, feature selection, classification, regression, clustering, and validation. Another challenge in current research on machine olfaction is the need to predict or estimate the sensor response to aroma mixtures. Some pattern recognition problems in machine olfaction such as odor classification and odor localization can be solved by using time series kernel methods.

## Detection

There are three basic detection techniques using conductive-polymer odor sensors (polypyrrole), tin-oxide gas sensors, and quartz-crystal micro-balance sensors. They generally comprise (1) an array of sensors of some type, (2) the electronics to interrogate those sensors and produce digital signals, and (3) data processing and user interface software.
The entire system is a means of converting complex sensor responses into a qualitative profile of the volatile (or complex mixture of chemical volatiles) that make up a smell, in the form of an output.
Conventional electronic noses are not analytical instruments in the classical sense and very few claim to be able to quantify an odor. These instruments are first 'trained' with the target odor and then used to 'recognize' smells so that future samples can be identified as 'good' or 'bad'.
Research into alternative pattern recognition methods for chemical sensor arrays has proposed solutions to differentiate between artificial and biological olfaction related to dimensionality. This biologically-inspired approach involves creating unique algorithms for information processing.
Electronic noses are able to discriminate between odors and volatiles from a wide range of sources. The list below shows just some of the typical applications for electronic nose technology – many are backed by research studies and published technical papers.

## Odor localization

Odor localization is a combination of quantitative chemical odor analysis and path-searching algorithms, and environmental conditions play a vital role in localization quality. Different methods are being researched for various purposes and in different real-world conditions.

### Motivation

Odor localization is the technique and process of locating a volatile chemical source in an environment containing one or several odors. It is vitally important for all living beings for both finding sustenance and avoiding danger. Unlike the other basic human senses, the sense of smell is entirely chemical-based. However, in comparison with the other dimensions of perception, detection of odor faces additional problems due to the complex dynamic equations of odor and unpredictable external disturbances such as wind.

### Application

Odor localization technology shows promise in many applications, including:
* quality control in food processing (e.g. taints, bacterial spoilage)
* locating the source of dangerous substances (e.g.: explosives and chemical warfare agents)
* discovering underground resources or hazards
* detecting prohibited materials (e.g.: drug detection)
* searching for survivors of natural disasters
* environmental monitoring for pollutants
* early diagnosis of diseases (e.g. in chronic obstructive pulmonary disease)

### History and problem statement

The earliest instrument for specific odor detection was a mechanical nose developed in 1961 by Robert Wighton Moncrieff. The first electronic nose was created by W. F. Wilkens and J. D. Hartman in 1964. Larcome and Halsall discussed the use of robots for odor sensing in the nuclear industry in the early 1980s, and research on odor localization was started in the early 1990s. Odor localization is now a fast-growing field. Various sensors have been developed and a variety of algorithms have been proposed for diverse environments and conditions.
Mechanical odor localization can be executed via the following three steps, (1) search for the presence of a volatile chemical (2) search for the position of the source with an array of odor sensors and certain algorithms, and (3) identify the tracked odor source (odor recognition).

### Localization methods

Odor localization methods are often classified according to odor dispersal modes in a range of environmental conditions. These modes can generally be divided into two categories: diffusion-dominated fluid flow and turbulence-dominated fluid flow. These have different algorithms for odor localization, discussed below.

#### Diffusion-dominated fluid flow

Tracking and localization methods for diffusion-dominated fluid flow – which is mostly used in underground odor localization – must be designed so that olfaction machinery can operate in environments in which fluid motion is dominated by viscosity. This means that diffusion leads to the dispersal of odor flow, and the concentration of odor decreases from the source as a Gaussian distribution.
The diffusion of chemical vapor through soil without external pressure gradient is often modeled by Fick's second law:
    ${\frac {\partial C}{\partial t}}=D{\frac {\partial ^{2}C}{\partial d^{2}}}$
where D is the diffusion constant, d is distance in the diffusion direction, C is chemical concentration and t is time.
Assuming the chemical odor flow only disperses in one direction with a uniform cross-section profile, the relationship of odor concentration at a certain distance and certain time point between odor source concentrations is modeled as
    ${\frac {C}{C_{s}}}=\operatorname {erfc} {\frac {d}{\sqrt {4Dt}}}$
where $C_{s}$ is the odor source concentration. This is the simplest dynamic equation in odor detection modeling, ignoring external wind or other interruptions. Under the diffusion-dominated propagation model, different algorithms were developed by simply tracking chemical concentration gradients to locate an odor source.

##### E. coli algorithm

A simple tracking method is the E. coli algorithm. In this process, the odor sensor simply compares concentration information from different locations. The robot moves along repeated straight lines in random directions. When the current state odor information is improved compared to the previous reading, the robot will continue on the current path. However, when the current state condition is worse than the previous one, the robot will backtrack then move in another random direction. This method is simple and efficient, however, the length of the path is highly variable and missteps increase with proximity to the source.

##### Hex-path algorithm and dodecahedron algorithm

Another method based on the diffusion model is the hex-path algorithm, developed by R. Andrew Russel for underground chemical odor localization with a buried probe controlled by a robotic manipulator. The probe moves at a certain depth along the edges of a closely packed hexagonal grid. At each state junction n, there are two paths (left and right) for choosing, and the robot will take the path that leads to higher concentration of the odor based on the previous two junction states odor concentration information n−1, n−2. In the 3D version of the hex-path algorithm, the dodecahedron algorithm, the probe moves in a path that corresponds to a closely packed dodecahedra, so that at each state point there are three possible path choices.

#### Turbulence-dominated fluid flow

In turbulence-dominated fluid flow, localization methods are designed to deal with background fluid (wind or water) flow as turbulence interruption. Most of the algorithms under this category are based on plume modeling (Figure 1).
Plume dynamics are based on Gaussian models, which are based on Navier–Stokes equations. The simplified boundary condition of the Gaussian-based model is:
${\frac {\partial C}{\partial t}}=D_{x}{\frac {\partial ^{2}C}{\partial x^{2}}}+D_{y}{\frac {\partial ^{2}C}{\partial y^{2}}}+\alpha {\frac {\partial C}{\partial x}}+\beta {\frac {\partial C}{\partial y}}$
where D$_x$ and D$_y$ are diffusion constants; $\alpha$ is the linear wind velocity in the x direction, $\beta$ is the linear wind velocity in the y direction. Additionally assuming that the environment is uniform and the plume source is constant, the equation for odor detection in each robot sensor at each detection time point t−th is
$R_{i}=\gamma _{i}\sum _{k=1}^{K}{\frac {C_{k}}{\|{\rho _{k}-r_{k}}\|^{\alpha }}}+\omega _{i}$
where $R_{i}$ is the t−th sample of i−th sensor, $\gamma _{i}$ is gain factor, $C_{k}$ is k−th source intensity, $\rho _{k}$ is the location of k−th source, $\alpha$ is plume attenuation parameter, $\omega _{i}$ is background noise that satisfies $N(\mu ,\sigma ^{2})$. Under plume modeling, different algorithms can be used to localize the odor source.

##### Triangulation algorithm

A simple algorithm that can be used for location estimation is the triangulation method (Figure 2). Consider the odor detection equation above, the position of the odor source can be estimated by organizing sensor distances on one side of the equation and ignoring the noise. The source position can be estimated using the following equations:
$(x_{1}-x_{s})^{2}+(y_{1}-y_{s})^{2}=R_{1}/(\gamma _{1}C)$
$(x_{2}-x_{s})^{2}+(y_{2}-y_{s})^{2}=R_{2}/(\gamma _{2}C)$
$(x_{3}-x_{s})^{2}+(y_{3}-y_{s})^{2}=R_{3}/(\gamma _{3}C)$

##### Least square method (LSM)

The least square method (LSM) is a slightly complicated algorithm for odor localization. The LSM version of the odor tracking model is given by:
$R_{i},_{t}=\gamma _{i}{\frac {C}{\|{\rho _{k}-r_{i}}\|^{2}}}+\omega _{i}=\gamma _{i}{\frac {C}{d^{2}}}+\omega _{i}$
where $d_{i}$ is the Euclidean distance between the sensor node and the plume source, given by:
$d_{i}={\sqrt {(x_{i}-x-s)^{2}+(y_{i}+y_{s})^{2}}}$
The main difference between the LSM algorithm and the direct triangulation method is the noise. In LSM, noise is considered, and the odor source location is estimated by minimizing the squared error. The nonlinear least square problem is given by:
$J=\sum _{i=1}^{N}({{\frac {C}{\sqrt {(x_{i}-{\widehat {x_{s}}})^{2}(y_{i}-{\widehat {y_{s}}})^{2}}}}-{\overline {z_{l}}})}$
where $({\widehat {x_{s}}},{\widehat {y_{s}}})$ is the estimated source location and ${\overline {z_{l}}}$ is the average of multiple measurements at the sensors, given by:
${\overline {z_{l}}}={\frac {1}{M}}\sum _{i=1}^{M}{z_{i}}$

##### Maximum likelihood estimation (MLE)

Another method based on plume modeling is maximum likelihood estimation (MLE). In this odor localization method, several matrices are defined as follows:
$Z=[{\frac {R_{1}-\mu _{1}}{\sigma _{1}}},{\frac {R_{2}-\mu _{2}}{\sigma _{2}}},...{\frac {R_{N}-\mu _{N}}{\sigma _{N}}}]$
$G=diag[{\frac {\gamma _{1}}{\sigma _{1}}},{\frac {\gamma _{2}}{\sigma _{2}}},...{\frac {\gamma _{N}}{\sigma _{N}}}]$
$D=[{\frac {1}{d_{1}^{2}}},{\frac {1}{d_{2}^{2}}},...{\frac {1}{d_{N}^{2}}}]$
$\zeta =[\zeta _{1},\zeta _{2},...\zeta _{N}]$
$\zeta _{i}=(\omega _{i}-\mu _{i})/\sigma _{i}\sim N(0,1)$
${\frac {R_{i}-\mu _{i}}{\sigma _{i}}}\sim N({\frac {\gamma _{i}}{\sigma _{i}}}{\frac {C}{d_{i}^{2}}},1)$
With these matrices, the plume-based odor detection model can be expressed with the following equation:
$Z=GDC+\zeta$
Then the MLE can be applied to the modeling and form the probability density function
$f(Z,\theta )=2\pi ^{-(N/2)}e^{-{\frac {1}{2}}(Z-GDC)^{T}(Z-GDC)}$
where $\theta$ is the estimated odor source position, and the log likelihood function is
$L(\theta )\sim {\frac {1}{2}}\sum _{i=1}^{N}{\|Z_{i}-\gamma _{i}{\frac {c}{d_{i}^{2}}}\|}={\frac {1}{2}}\sum _{i=1}^{N}{({\frac {Ri-\mu _{i}}{\sigma _{i}}}-\gamma _{i}{\frac {c}{d_{i}^{2}}})^{2}}$
The maximum likelihood parameter estimation of $\theta$ can be calculated by minimizing
$I(\theta )=\sum _{i=1}^{N}{({\frac {Ri-\mu _{i}}{\sigma _{i}}}-\gamma _{i}{\frac {c}{d_{i}^{2}}})^{2}}$
and the accurate position of the odor source can be estimated by solving:
${\frac {\partial {I(\theta )}}{\partial (x)}}=0,{\frac {\partial {I(\theta )}}{\partial (y)}}=0$

##### Infotaxis

In 2007, a strategy called infotaxis was proposed in which a mental model is created utilizing previously collected information about where a smell's source is likely to be. The robot moves in a direction that maximizes information. Infotaxis is designed for tracking in turbulent environments. It has been implemented as a partially observable Markov decision process with a stationary target in a two-dimensional grid.