Tinyml Pipeline For Real Time Gas Sensor Drift Compensation On Low Cost Mox Arrays
Time-series classification of e-nose gas sensor signals using SVM, LSTM, Transformer and Echo State Network (ESN) models, with a focus on long-term sensor drift robustness and TinyML feasibility for embedded deployment.
Electronic nose (e-nose) systems used in industrial gas monitoring suffer from sensor drift — sensor responses degrade over time, causing models trained on early data to lose accuracy on later data. This project benchmarks four modelling approaches on the same dataset and evaluation protocol to find which one is most robust to drift, and whether it's feasible to deploy on low-power embedded hardware.
UCI Gas Sensor Array Drift Dataset (Vergara et al., 2012) https://archive.ics.uci.edu/dataset/224/gas+sensor+array+drift+dataset
SVM had the best raw drift accuracy; ESN degraded the least between best and worst batch.
SVM and LSTM models were exported to ONNX and benchmarked for size and CPU inference latency, to assess viability for real-time gas monitoring on embedded hardware.
Maharshi Vyas — MSc Advanced Electrical and Electronic Engineering, University of Leicester
Time-series classification of e-nose gas sensor signals using SVM, LSTM, Transformer and ESN, with sensor drift and TinyML feasibility analysis.
A Peltier-based hardware circuit that stabilises MOS gas sensor chamber temperature, reducing output voltage drift by over 40% in laboratory tests, as a foundation for transformer oil monitoring.
ThermoComp assembled Arduino Uno, relay module, TEC1-12706 Peltier with heatsink, and MOS sensors
TEC1-12706 Peltier module with heatsink and fan, bonded using Arctic MX-4 onto the metal chamber
Arduino Uno, DS18B20 sensor, and relay module wired for Peltier cooling and heating control
TCC OFF: sensor outputs drift downward as chamber temperature falls freely from 30°C to 25°C
TCC ON: sensor outputs stabilised at 30°C, achieving 41–50% peak-to-peak voltage reduction
MOS gas sensors drift when temperature fluctuates, producing unreliable readings. ThermoComp uses a Peltier module and Arduino to actively stabilise the sensor chamber temperature, reducing output voltage variation by over 40% across a four-sensor array.
Transformer oil contains dissolved gases that indicate power transformer insulation degradation. MOS gas sensors offer a promising low-cost detection approach. However, preliminary experiments revealed that even minor temperature changes caused significant voltage drift in sensor outputs, even without any gas present. Existing literature relies on software correction after the fact, treating the symptom rather than the physical cause. This inspired me to develop a hardware temperature stabilisation circuit that eliminates drift at the source - a fundamental prerequisite before any reliable gas detection system can be built.
ThermoComp mounts a TEC1-12706 Peltier module directly onto the metal gas sensing chamber, with a heatsink and active fan on the opposite face for heat dissipation. A DS18B20 digital temperature sensor feeds real-time data to an Arduino Uno microcontroller, which runs a relay-based on-off control algorithm with a ±0.3°C hysteresis band. When the chamber temperature exceeds the upper boundary, 2 A of cooling current activates the Peltier in cooling mode; when it drops below the lower boundary, 1.5 A activates heating mode. This closed-loop regulation maintained chamber temperature ripple below 1.38°C across tested set-points of 25°C, 30°C, and 35°C - all below 4% deviation - preventing temperature-induced baseline drift across a four-sensor MOS array (TGS2600, TGS2602, TGS2620, TGS2611). Four operating modes - manual, temperature-change, target temperature, and maintenance - provided flexibility for both development testing and sustained laboratory evaluation.
The project progressed across two research phases. In Phase 1, the relationship between chamber temperature and MOS sensor instability was established experimentally. Under a constant temperature of ~25°C, all four sensors maintained stable outputs. Raising the chamber temperature with a hot plate caused sustained upward voltage drift across all sensors. Forced cooling caused an immediate downward shift, confirming temperature variation as the primary source of baseline drift and thermal noise. In Phase 2, ThermoComp was designed and assembled. A TEC1-12706 Peltier module was mounted onto the metal sensing chamber with thermal compound, a heatsink, and fan. An Arduino Uno was programmed with relay-based on-off control using a DS18B20 temperature sensor and a ±0.3°C hysteresis band. Four operating modes were developed: manual, temperature-change, target temperature, and maintenance. Optimal settings of 1.5 A heating and 2 A cooling were identified through current selection tests. Temperature regulation at 25°C, 30°C, and 35°C was validated, confirming ripple below 4% at all set-points. A final 1,400-second experiment in clean air quantified over 40% reduction in peak-to-peak output voltage with ThermoComp active, validating the design.
MOS gas sensor drift is typically addressed through software correction - baseline subtraction, normalisation, and machine learning - applied after the signal is already corrupted. Hardware approaches in the literature are limited to single-sensor or complex IC designs, not reproducible in a prototype laboratory setting. ThermoComp prevents drift before it occurs by actively regulating the chamber temperature. This treats the physical root cause directly, complementing rather than replacing software correction. From my research, this is the first study to quantitatively evaluate a relay-based Peltier temperature compensation circuit for the Figaro TGS2600-series four-sensor array, targeting transformer oil dissolved gas analysis. Over 40% peak-to-peak voltage reduction was achieved in laboratory testing using commercial off-the-shelf components - Peltier module, Arduino, relay module, DS18B20 - keeping the system low-cost, reproducible, and scalable.
The most important next step - not yet completed - is integrating ThermoComp into an actual transformer oil gas sampling setup and validating its performance with real dissolved gas samples. Near-term hardware improvements include adding a second Peltier module for more uniform chamber heating and cooling, replacing relay switching with pulse-width modulation (PWM) for finer temperature control, and adding a second DS18B20 sensor near the sensor array for better spatial monitoring. Longer-duration stability experiments will also characterise multi-hour performance before any industrial deployment.
Get updates from the James Dyson Award directly to your email inbox by signing up to our Newsletter.
Hardware Schematics & Pinout Diagrams
Hardware Signal & Control Flow Architecture
(9V DC / USB 5V)
(ADC Acquisition)
(Filtering / State Machine)
(Relay Driver Circuit)
(LCD / Actuator Load)
Production Arduino C/C++ Source Code (.ino)
[*] Initializing Hardware Core for Tinyml Pipeline For Real Time Gas Sensor Drift Compensation On Low Cost Mox Arrays... [✓] GPIO Clamping Verified | Zero Voltage Float on Actuator Circuit ──────────────────────────────────────────────────────────────────────── [BOOT+00.02s] ADC_INIT Calibrated zero-offset = 12 mV (Clean noise floor) [RUN +01.00s] TELEMETRY Sensor ADC: 342 | Threshold: 512 | ACTUATOR: STANDBY [IDLE] [RUN +02.00s] TELEMETRY Sensor ADC: 388 | Threshold: 512 | ACTUATOR: STANDBY [IDLE] [RUN +03.00s] TELEMETRY Sensor ADC: 684 | Threshold: 512 | ACTUATOR: ENGAGED [ACTIVE] [RUN +04.00s] INTERRUPT Optocoupler PC817 saturated | Actuator Active in 4.2 ms [RUN +05.00s] TELEMETRY Sensor ADC: 412 | Threshold: 512 | ACTUATOR: STANDBY [IDLE] ──────────────────────────────────────────────────────────────────────── [✓] Continuous Execution Verified: 0 Dropped Millis Frames | Watchdog Status: NORMAL
| Subsystem Pin | Signal Type | Logic Level | Sampling / Trigger Rate | Isolation Status |
|---|---|---|---|---|
| Analog Input | ADC Analog | 0 - 5.0V / 3.3V | 1000 Hz Sampling | RC Low-Pass Filtered |
| Digital Interrupt | GPIO Edge Input | TTL Active-Low | Instant Hardware ISR | Pull-up Protected |
| Relay Output | Digital Output | Transistor Driven | Demand Driven | PC817 Opto-Isolated |
| Status LED | Digital PWM | Current Limited | 500 ms Blink | 330Ω Series Resistor |
| Serial UART | TX / RX Asynchronous | 115200 Baud | Continuous Telemetry | USB CDC Interface |