Resolving fast gas transients with Metal-Oxide sensors Damien Drix and Michael Schmuker Biocomputation group, Department of Computer Science, University of Hertfordshire, Hatfield, United Kingdom E-mail: d.drix@herts.ac.uk 1 Abstract2 Electronic olfaction can help detect and localise harmful gases and pollutants, but3 the turbulence of natural environment presents a particular challenge: odor encounters4 are intermittent, and an effective electronic nose must therefore be able to resolve5 short odor pulses. The slow responses of the widely-used Metal-Oxide (MOX) gas6 sensors complicate the task. Here we combine high-resolution data acquisition with7 a processing method based on Kalman filtering and absolute-deadband sampling to8 extract fast onset events. We find that our system can resolve the onset time of odour9 encounters with enough precision for source direction estimation with a pair of MOX10 sensors in a stereo-osmic configuration.11 Keywords12 accelerated gas sensing, metal oxide sensors, event-based sampling, kalman filter, neuromor-13 phic14 1 15 Electronic olfaction has potential in many areas such as industrial and environmental mon-16 itoring and safety, where it can help detect and localise harmful gases or pollutants.17 But in natural environments, odors are dispersed by turbulent plumes and encounters18 are intermittent1. The temporal statistics of these odor pulses (hereafter also called bouts)19 contain information about source location2. An effective electronic nose thus needs to resolve20 both short pulses and pulses in rapid succession. Metal-Oxide (MOX) gas sensors are widely21 used, but have impulse response durations in the order of tens to hundreds seconds3, and22 are therefore often thought to be of limited utility in turbulent environments.23 However, a large part of the impulse response is due to a slow sensor recovery phase, in24 the order of 100s, in which the sensor conductance slowly returns to baseline while the initial25 reaction of the volatile with the sensor electrode is reversed4. The onset of the response itself26 is near-instantaneous and can be detected after fractions of a second. Therefore, repeated27 short-duration bouts could be detectable with the help of specific physical mitigation (for28 instance sensor purging5 or pulsed heating6) or through signal processing that separates the29 initial binding from the recovery phase.30 Here we built a multi-channel MOX sensor electronic nose with high bit depth and31 sampling rate to investigate how much can be achieved through signal processing alone.32 We developed a signal processing method based on a Kalman filter and absolute deadband33 sampling to isolate successive bouts and encode their onset time. We demonstrate the34 system’s ability to resolve onset times and repeated bouts in a stereo-enose setup that infers35 the direction of a puff of odorant from stereo delays.36 2 Results37 Data acquisition38 Our gas sensor boards consist of four metal-oxide (MOX) sensors and a high-resolution39 analog-to-digital converter (ADC). We use four sensors manufactured by Figaro Inc. (Osaka,40 Japan): TGS2600, TGS2602, TGS2610 and TGS2620, to cover a wide range of target gases.41 The ADC (ADS122C04, Texas Instruments) offers 24 bits of resolution and can sample all42 four sensor channels at a frequency of up to 200 Hz. As MOX sensors are affected by ambient43 temperature and humidity, the boards can also host an optional 16-bit digital temperature44 and humidity sensor (SHT31-DIS, Sensirion).45 An I2C bus operating at 800 KHz connects the boards to a microntroller (Teensy 4.0,46 PJRC.COM) that reads out the data and transmits it to the host computer via USB (fig. 1).47 The system is set up so that the microcontroller can handle multiple sensors in parallel, for48 instance left and right electronic noses in a stereo configuration.49 3.3 V5 V RS RL RH AIN3TGS26xx ADS122C04 AIN2 AIN1 AIN0 SDA SCL SHT31 SDA SCL VREF + VREF - 16-bit °C / RH sensor 4x gas sensors 24-bit ADC I²C bus to micro- controller Figure 1: Simplified schematic of the sensor boards. The ADC on each sensor board measures the voltage across the MOX sensing elements RS. A separate 5V supply pow- ers the heating elements RH. The sensor board communicates via I2C with a Cortex-M7 microcontroller that transmits the data to the host computer. The gas sensors are connected to the ADC in the voltage divider configuration that is50 standard for this type of sensor7, with the sensing element RS in series with a load resistor51 RL (fig. 1). This configuration works well with the chosen ADC as it allows a ratiometric52 3 measurement relative to the power supply, free from common-mode noise. On the other53 hand its sensitivity degrades as RS deviates from RL, which normally requires an adjustable54 RL calibrated for a specific sensor at a given temperature and expected gas concentration.55 Here we make use of the ADC’s high resolution and variable input gain instead, which lets56 us pick a fixed load resistor RL = 68 k and still maintain a good sensitivity through a large57 range of concentrations and ambient conditions (fig. 2).58 The ADC measures a ratio x = VS VS+VL , where VS and VL are the voltages across RS and59 RL, respectively. From this we compute the relative conductance grel of each sensor relative60 to its load resistor:61 grel = gS gL = VL VS = 1 x 1 Then, we divide by the baseline values at the start of each recording to get the normalised62 sensor conductance g at time t:63 g(t) = grel(t) grel(0) The purpose of the normalisation is to use the same parameters for processing multiple64 sensors with different characteristics. It is not fundamentally required, since none of the65 algorithms assume a specific or constant baseline value for g.66 In preliminary work we had found the quantization noise from 10-bit ADCs to be not67 insignificant compared to the signals of interest, complicating downstream processing. The68 24-bit ADC solves this problem and its good noise performance lets us resolve very low-69 amplitude fluctuations (see Supporting Information fig. S-1).70 Experimental Setup71 We deliver puffs of isopropyl alcohol (IPA) to the sensors by means of a soft plastic bottle72 (NeilMed Inc, USA) squeezed by a servomotor to force vapours out of the nozzle (fig. 3).73 This creates a sharp puff that we could observe up to 50 cm from the nozzle in a quiet74 atmosphere.75 4 103 104 105 106 RS ( ) 0.0 0.2 0.4 0.6 0.8 1.0 G ai n × V S /V RE F RL 1x2x4x Figure 2: Automatic input gain selection maintains sensitivity over a large input range. ADC measurement for a varying sensor resistance RS at gain settings 1x, 2x and 4x. RS follows an approximate power law with respect to gas concentration; thus it makes sense to use a logarithmic scale, where the slope of the measurement function indicates the sensitivity to a relative change (eg. 1% in gas ppm). Thin arrows indicate the thresholds at which we increase or decrease the input gain to avoid the regions of lower sensitivity. The red line indicates the load resistance RL for reference. S0 TGS2600 S3 TGS2620 S1 TGS2602 S2 TGS2610 1.4 cmB stimulus axis top view IPA 8 cm11 cm microcontroller A side view servo motor odorant bottle left sensors right sensors puff Figure 3: An automated setup delivers puffs of odorant towards stereo sensor boards. A: Side view of the system in its left-to-right configuration. B, inset: top view of a sensor board showing the position of the four sensors in relation to the stimulus axis. 5 We record simultaneously from two identical boards placed along the direction of travel76 of the puff. This yields four pairs of stereo channels (S0 to S3), one for each MOX sensor77 type. We aim the stimuli slightly downwards onto a flat surface and position the top of the78 MOX sensors flush with that surface to reduce turbulence caused by the sensors themselves,79 which might otherwise disrupt the narrow odor plume before it reaches sensors on the far80 side. We record one dataset with the stimulus traveling in the left-to-right direction, then81 move the bottle to the other side and record another dataset for the right-to-left direction.82 Post-processing83 MOX sensors respond to puff of odorants with a fast rising phase, followed by a slower84 decay back to baseline (fig. 4 A). This slow decay can mask fast transients, for instance85 when two bouts occur close together in time (see e.g. fig. 5 A). The goal of post-processing86 is to isolate the onset of the rising phase, thus providing the ability to resolve short odor87 pulses. Various solutions have been explored in previous work, such as taking the second88 derivative or deconvolution based on an estimate of the sensor’s impulse response function2,89 blind deconvolution8, and band-pass filters9.90 Here we use a constant-acceleration Kalman filter to compute a denoised estimate of the91 second derivative of the signal. The second derivative peaks at the onset of each puff (fig. 492 A). However it also has a second, smaller positive peak when the relaxation slows down,93 since that registers as a positive acceleration (fig. 4 B). As this could cause spurious bout94 detections (it is very small compared to the onset response, but still 5 times larger than our95 bout detection threshold) we modify the filter to suppress the second peak. We do this by96 incorporating an exponential decay term into the system equations for the first derivative v,97 6 50 5 10 * TGS2610 g a 0 5 10 15 20 time (s) 0.4 0.2 0.0 0.2 * = = 3.0 s A B Figure 4: Kalman filtering recovers the onset of odorant bouts. The arrowhead (N) marks the time when the odorant bottle is squeezed. A: conductance g and its second derivative a estimated by the Kalman filter. B: Zooming in shows the effect of the filter parameter  on the late-phase response. The second peak () is effectively removed with  = 3 seconds without affecting the early response. The feature marked y is unrelated and probably caused by a transient disturbance of the sensor. 7 thus removing the expected relaxation from the residual second derivative a:98 g(t+ dt) = g(t) + v(t) dt+  a(t) v(t)   dt2 2 v(t+ dt) = v(t) +  a(t) v(t)   dt a(t+ dt) = a(t) The parameter  sets the time constant of the decay term. We estimate it empirically99 for each sensor type, selecting the highest value which still suppresses the second peak. We100 also define a variable o = R a(t) dt, which we call bout velocity. Being the integral of the101 residual second derivative a, this variable is essentially a first derivative of the signal, like v,102 but with the second peak removed.103 Event-based onset encoding104 For the purpose of bout detection it is the time of the odorant onset that matters, more105 than the precise time course of the sensor conductance during and after the bout. Therefore106 it makes sense to transform the continuous filter output into an event-based representation107 that only transmits information during periods of increasing conductance.108 We employ an event-based encoding related to delta modulation that has been variously109 called deadband sampling 10 or send-on-delta 11, and is also used in the DVS camera12.110 If the variable’s value at a time t is z(t) and the time of the last event is tprev, then a111 new event is emitted whenever the difference exceeds a certain threshold  = 0:02:112 jz(t) z(tprev)j >  This form of absolute deadband sampling yields a stream of events with an instantaneous113 rate f(t) / j d dt z(t)j, as the algorithm differentiates. The sign of the difference indicates114 whether the variable increased (ON events) or decreased (OFF events). We discard all OFF115 8 events as these do not correspond to the onset of a bout.116 This event-based encoding can be applied to the sensor conductance (z = g, for an event117 rate f proportional to v) as well as to the bout velocity variable (z = o, for an event rate118 f proportional to the filter output a). We find that when applied to the filter output, it119 produces well-separated bursts of events for two bouts separated by 5 seconds, a much shorter120 delay than the recovery phase of the sensor conductance (fig. 5 B, D). On the other hand,121 events generated from the sensor conductance are prone to merging into a single burst when122 bouts follow each other closely (fig. 5 A).123 0 5 10 co nd uc ta nc e g 0 50 ev en ts / s 0 5 10 15 20 25 time (s) 0 1 2 3 bo ut v el oc ity o TGS2602left right 0 50 ev en ts / s 0 5 10 co nd uc ta nc e g 0 100 ev en ts / s 0 5 10 15 20 25 time (s) 0 1 2 3 bo ut v el oc ity o TGS2620left right 0 100 ev en ts / s A B C D Figure 5: Events generated from the bout velocity variable isolate the onset of each bout. Responses of two sensor pairs during the same trial with two puffs of odorant (N) at a 5-second interval in the right-to-left direction. A, B: conductance g and bout velocity o estimated by the Kalman filter for the TGS2602 sensors (left & right), together with the resulting events (thin vertical lines) and event rate (time histogram). C, D: same as A & B, but with the TGS2620 sensors, which have a faster response time. 9 Direction Detection in Stereo-osmic Configuration124 S0 S1 S2 S3 Sensor Pair (L/R) 1500 1000 500 0 500 1000 1500 L R d el ay (m s) left-to-right right-to-left Figure 6: Relative delays between left and right channels encode the direction of travel. Shown here are the delays between the first event on the left channel and the first event on the right channel over 40 trial runs, colour-coded by stimulus direction (20 trials with a left-to-right puff and 20 with a right-to-left puff). Three outliers with a delay greater than 2 seconds are not shown on this graph. We apply this event-based encoding to the data obtained from our recording setup in125 stereo-osmic configuration (fig. 3). As the stimulus travels over the sensors, the left and right126 sensor boards will detect its onset at slightly different times, with the delay between left and127 right boards depending on the speed and direction of the puff. We extract the time of the128 first event on each channel, and then compute the time differences between the left and right129 sensors (fig. 6). We find that the sign of that time difference encodes the direction of the130 stimulus unambiguously, despite some variance due to turbulent flow. A slight systematic131 offset is apparent between channels. We have observed a similar effect when the axis of132 the puff deviates from the center line; thus the offset may be due to lateral flow, although133 mismatched sensor characteristics may also play a role.134 10 Discussion135 We show that off-the-shelf metal-oxide sensors can resolve relative onset delays in the sub-136 second range using a Kalman filter to extract bout onset times. This software approach could137 be combined with hardware measures5,6 to increase the temporal resolution of the data even138 further.139 The proposed method is inherently robust to baseline drift, a common issue with MOX140 sensors where their conductance at a certain odorant concentration will vary over the lifetime141 of the sensor and across the slower changes in ambient temperature and humidity.142 We find that bout onset information lends itself well to event-based encoding and process-143 ing. In the past decade, event-based sensors have garnered interest because they are efficient144 in bandwidth (transmitting only changes rather than redundant frames) and make certain145 tasks simpler. While electronic olfaction is still low-bandwidth and low-dimensional com-146 pared to vision, this may change as sensor technology improves. Inferring stereo delays from147 event timing is less computationally expensive than, for instance, from the cross-correlogram148 of the two channels.149 In our experiment, the timing of bout onset events is enough to estimate the direction150 of a puff of odorant, just like bout frequency was already known to contain information151 about the the distance to the source2. Future research should confirm how well that event-152 based approach translates to real-world conditions, and assess to which extent event timing153 is sufficient to navigate towards an odor source with more chaotic plumes and lower odorant154 concentrations.155 For instance, the ability of the system to resolve successive bouts at short intervals156 should be explored systematically. From the data in fig. 5 we estimate that we can separate157 successive bouts down to an interval of about 1 to 3 seconds, but this would have to be158 quantified in conjunction with ground truth data about the plume structure.159 Finally, while we have not quantified the effect of bit depth on the stereo detection task160 presented here (which uses relatively high concentrations), our system’s ability to resolve161 11 very low-amplitude fluctuations may also be advantageous when applied to low-concentration162 plumes.163 Conclusion164 Our work demonstrates how a relatively simple and lightweight setup using MOX sensors can165 extract onset times and separate successive bouts at intervals much shorter than the sensor’s166 recovery time. Increased temporal resolution renders metal-oxide sensors more useful in167 extracting data from turbulent plumes, in particular when the temporal structure of gas168 concentration fluctuations is of concern, rather than absolute concentration values.169 This highlights their potential for odor-guided navigation in embedded systems such as170 weight-constrained aerial vehicles13. In ground-based robots, the proposed method could171 remove the need for a separate anemometer to estimate odor source direction.172 While the present work focused on temporal resolution, future research should assess173 whether particular odorants and mixtures of odorants can be reliably identified using the174 event-based approach. This would constitute a purely event-based system for the simulta-175 neous identification and localisation of gas sources.176 Supporting Information177 Supporting Information Available: The following files are available free of charge.178 supporting.pdf. Impact of ADC resolution on the acquisition of low-amplitude signals.179 Acknowledgement180 DD and MS were funded from EU H2020 Grants 785907 and 945539 (Human Brain Project181 SGA2 and SGA3 ). MS was funded by MRC grant MR/T046759/1 (NeuroNex: From Odor182 to Action).183 12 References184 (1) Mylne, K. R.; Mason, P. J. Concentration fluctuation measurements in a dispersing185 plume at a range of up to 1000 m. Quarterly Journal of the Royal Meteorological Society186 1991, 117, 177–206, DOI: 10.1017/S0022112090001239.187 (2) Schmuker, M.; Bahr, V.; Huerta, R. Exploiting plume structure to decode gas source188 distance using metal-oxide gas sensors. Sensors and Actuators B: Chemical 2016, 235,189 636–646, DOI: 10.1016/j.snb.2016.05.098.190 (3) Pashami, S.; Lilienthal, A. J.; Trincavelli, M. Detecting changes of a distant gas191 source with an array of MOX gas sensors. Sensors 2012, 12, 16404–16419, DOI:192 10.3390/s121216404.193 (4) Korotcenkov, G. The role of morphology and crystallographic structure of metal oxides194 in response of conductometric-type gas sensors. Materials Science and Engineering: R:195 Reports 2008, 61, 1–39, DOI: 10.1016/j.mser.2008.02.001.196 (5) Gonzalez, J.; Monroy, J. G.; Garcia, F.; Blanco, J. L. The Multi-Chamber Electronic197 Nose (MCE-nose). 2011 IEEE International Conference on Mechatronics. 2011; pp 1–6,198 DOI: 10.1109/ICMECH.2011.5971193.199 (6) Vergara, A.; Benkstein, K. D.; Montgomery, C. B.; Semancik, S. Demonstration of200 Fast and Accurate Discrimination and Quantification of Chemically Similar Species201 Utilizing a Single Cross-Selective Chemiresistor. Analytical Chemistry 2014, 86, 6753–202 6757, DOI: 10.1021/ac501490k.203 (7) Arshak, K.; Lyons, G.; Cavanagh, L.; Clifford, S. Front-end signal conditioning used204 for resistance-based sensors in electronic nose systems: a review. Sensor Review 2003,205 23, 230–241, DOI: 10.1108/02602280310481850.206 13 (8) Martinez, D.; Burgués, J.; Marco, S. Fast Measurements with MOX Sensors: A207 Least-Squares Approach to Blind Deconvolution. Sensors 2019, 19, 4029, DOI:208 10.3390/s19184029.209 (9) Burgués, J.; Valdez, L. F.; Marco, S. High-bandwidth e-nose for rapid tracking of210 turbulent plumes. 2019 IEEE International Symposium on Olfaction and Electronic211 Nose (ISOEN). 2019; DOI: 10.1109/ISOEN.2019.8823158.212 (10) Vasyutynskyy, V.; Kabitzsch, K. Towards Comparison of Deadband Sampling Types.213 2007 IEEE International Symposium on Industrial Electronics. 2007; pp 2899–2904,214 DOI: 10.1109/ISIE.2007.4375074.215 (11) Miskowicz, M. Send-On-Delta Concept: An Event-Based Data Reporting Strategy.216 Sensors 2006, 6, 49–63, DOI: 10.3390/s6010049.217 (12) Lichtsteiner, P.; Posch, C.; Delbruck, T. A 128x128 120 dB 15 us Latency Asynchronous218 Temporal Contrast Vision Sensor. IEEE Journal of Solid-State Circuits 2008, 43, 566–219 576, DOI: 10.1109/JSSC.2007.914337.220 (13) Burgués, J.; Hernández, V.; Lilienthal, A.; Marco, S. Smelling Nano Aerial Ve-221 hicle for Gas Source Localization and Mapping. Sensors 2019, 19, 478, DOI:222 10.1166/sl.2014.3189.223 14 Graphical TOC Entry224 225 15