1. Introduction
The continuous growth of the wine market necessitates the development of higher-quality wine products through standardized industrial processes and the use of IoT. Continuous supervision, control, and implementation of standardized intervention procedures during the alcoholic fermentation of must for wine production are central to the Winemaking Industry. With the advancement of the Internet of Things (IoT) and aligned with Industry 4.0 objectives to optimize winemaking processes, numerous innovative solutions for IoT Systems, data acquisition, and control are being designed and implemented. In this direction, this paper proposes using an AI-capable, low-cost wine fermentation monitoring system to develop a prototype wine fermentation tank that continuously records critical parameters. It will integrate low-cost, energy-efficient embedded sensors for real-time data collection, including key oenological metrics (e.g., fermentation curve measurements, brix levels), turbidity/clarity via color measurements, and monitoring released gases during fermentation.
In wineries, the industrial process of monitoring alcoholic fermentation typically involves manual sampling and laboratory analysis for quality control and decision-making. Generally, this can be performed no more than twice per day. For large-scale wineries, such an approach is practically infeasible for all fermentation tanks, risking stalled fermentations or quality degradation. Continuous close-to-real-time data logging via low-cost in-tank fermentation sensors could significantly improve processes by taking actions on event occurrence, enabling real-time fermentation rate control, enhancing automation levels, and optimizing workforce allocation to higher-priority production tasks. Continuous monitoring via in-tank sensors could streamline fermentation rate control, boost winery automation, and reduce labor overhead, freeing personnel for other production processes. Although embedded sensors (even rudimentary ones) are not novel, their systematic deployment remains restricted, particularly in Greece.
To this extent, the wine industry poses requirements for using dense wine parameters monitoring utilizing device solutions for small-scale wine-fermentation tasks of unsupervised control [
1]. There is an urgent need for integrated sensor systems capable of routine measurements and micro-scale fermentations in wineries. The use of basic embedded tank sensors has seen limited adoption, primarily due to cost constraints and the complexity of local monitoring technological integration [
2]. There is growing interest from wineries, sensor manufacturers, and startups in incorporating innovative, scale-up, automated enological solutions. Existing industrial fermentation control systems provided by Programmable Logic Controllers (PLCs) of time-interval periodical probing and on-demand supervisory control, as well as via local data acquisition (SCADA) interfaces, have achieved initial production automation [
3]. However, Industry 4.0 introduced scalability, portability, and autonomous cloud operation principles of telemetry devices, Ubiquitous IoT connectivity, distributed storage, and intelligence [
4], which are still ahead. In order to show progress in this direction, dense, close-to-real-time multi-attribute monitoring is needed using cloud-based services and data collection on preferable schemaless NoSQL databases. This way, the end-user integration provided by notification channels and intelligent, automated suggestions using Artificial Intelligence will offer Industry 4.0 sensory automated processes [
5,
6].
Wine fermentation processes supported by systems of low-cost deployment using IoT, extensibility, and cross-platform visualization (via tablets/smartphones) are pivotal. Real-time statistical analysis and AI-driven decision support—including oenological intervention recommendations and final product quality predictions—will further advance Wine Industry 4.0 resilience and sustainability. Implementations of periodic and real-time Industrial IoT (IIoT) monitoring systems for measurement supervision, detection-prediction, and decision-making (Decision Support Systems - DSS) is crucial for the primary sector, particularly in biological system supervision [
7,
8,
9,
10,
11,
12]. Nevertheless, despite the importance of such technological tools as applied in other European wine-producing countries (e.g., Spain, Italy, France), Greece lacks comprehensive systems for monitoring wine fermentation, relying instead on static and sporadic measurements using existing instruments developed and tested by European nations.
Towards Industry 4.0 automation, Li et al. propose a new chemical analysis system during wine fermentation consisting of temperature, pressure, pH, and a refractometer [
13]. Also, authors at [
14] evaluate the use of the MQTT protocol for use in the Wine industry real-time data transmissions. Other propositions include monitoring wine fermentation using biosensors mainly on basic parameters like temperature [
15,
16], sugar concentration [
15,
17], acidity [
18], bioreactors content, CO
2 emisions [
19], phenolic compounds [
20], and odor characterization [
21,
22], minimizing microbiological risks [
23,
24]. State of the art IoT trends include Electronic noses (E-noses) that focus on tank gas monitoring [
19,
25,
26,
27,
28,
29,
30], Electronic eyes (E-eyes) that utilize RGB and IR monitoring) [
1,
30,
31,
32,
33,
34] and Electronic tonques (E-tongues) for in tank basic paramters monitoring [
15,
19,
29,
30].
Mathematical and statistical methods are the necessary tools to mine and extract valuable information from large datasets. These methods, in turn, enable predictive modeling and continuous improvement, thus enhancing production flexibility. Process optimization requirements cannot be standardized for dynamic systems. Such procedural behavior can be monitored and measured with modern techniques and facilitated with precise operations. Machine and Deep learning applications in natural sciences facilitate the development of intelligent decision-support systems. Daily time-series data from processing units serve as input for machine support models. Mathematical algorithms including Neural Networks (ANN), SVM, Random Forest, Logistic Regression, XGBoost, CNN classification models such as UNets, ResNets and VGGNets, Multilayer Neural Networks (e.g., Stranded-NN [
12,
35]) and predictive Recurrent Neural Networks (Stranded-LSTM [
36]), as well as Fuzzy Logic models[
12,
37,
38] operating as autoencoders in cases of limited data availability. Such models have been investigated for prediction and classification tasks for wine fermentation tasks, offering predictions and criticality alerts [
7].
From this perspective, the authors propose a new low-cost architecture supported by probing electronic nose, tongue, and eye devices, which are incorporated into autonomous devices using a holistic system approach called SmartBarrel. These devices offer an electronic sense of the corresponding sense (nose, tongue, eye) and are named probing nose, tongue, and eye (probing, E-nose, E-tongue, E-eye). The SmartBarrel prototype utilizes low-power wireless IoT application protocols for data transmission, following HTTP JSON POSTS over Wi-Fi [
39], implements streamlined close to real-time cloud-based transmission of measurements via the portable, easy-to-install probing devices, reducing the application costs utilizing existing tank-stationary sensory solutions. Additionally, it integrates deep learning for measurement validation, predictive analytics, and intervention alerting mechanisms.
In short, the SmartBarrel prototype system incorporates 1) Measurements acquisition via the ThingsBoard AS [
40], 2) deployment of intelligent fermentation process and models, 3) automated prediction of subsequent fermentation phase, 3) alerts and notifications for undesirable fermentation cases, and 4) ubiquitous monitoring via its cloud-based AS ability to illustrate real-time measurements, alerts and predictions with the use of a mobile phone application, enabling ubiquitous monitoring of oenological processes.
These cloud-driven SmartBarrel capabilities offer the building blocks for the next generation of innovative winemaking tools. In this respect, the present work includes the following sections.
Section 2 presents a systematic review of the available literature on emerging technologies used for wine fermentation conditions monitoring and detecting critical events.
Section 3 presents the authors’ proposed SmartBarrel high-level system implementation, prototype end IoT devices implementation, deep-learning cloud computing predictions of the fermentation process based on a new RNN model called V-LSTM, and ThingsBoard application-level protocols and interfaces.
Section 4 presents the experimental scenarios of the system’s and V-LSTM model evaluation, and
Section 5 concludes the paper.
2. Related Work
Several implementations have been presented in the literature over the last few years regarding small-scale fermentations in tanks assisted by monitoring systems and IoT devices. Most of them target capturing the sense of smell, touch, and vision more precisely than the human senses. Analyzing gases released during alcoholic fermentation uses Fourier Transform Infrared (FTIR) systems or scattering spectrophotometers. These high-cost instruments (exceeding
$20,000 per unit) require manual operation and complex maintenance, limiting their use to periodic sampling rather than continuous or close-to-realtime monitoring. At the research level, electronic nose (E-nose) systems have been investigated for gas/volatile compound detection [
41].
Most E-nose implementations rely on conventional sensor configurations, including conductive polymer sensors (CPS), metal oxide semiconductor (MOS) sensors, as well as acoustic and optical sensors [
25]. Four principal sensor types prevail: 1) The MOS sensors that detect resistance variations from electron transfer during gas adsorption [
28], 2) the catalytic ga sensors (CAT) measure capacitance changes [
42], 3) the electrochemical sensors (ECH) that utilize charge transfer measurements in electrolytic cells [
30] and 4) other types such as infrared sensors [
43].
Electronic nose systems have shown particular promise for volatile aroma compound analysis, demonstrating the capability to differentiate wines based on aromatic profiles [
27,
44,
45], or detecting Volatile Organic Compounds (VOCs) [
46]. Furthermore, research-grade E-nose systems have been deployed directly in fermentation tanks, enabling online parameter monitoring [
47]. Most implementations include low-cost MOS sensor arrays for alcohol, CO
2, H
2S, and SO
2 detection [
26,
27,
28,
48]. These MOS-type sensors have been successfully employed for monitoring alcohol and CO
2 gas concentrations during fermentation of Debina, Zitsa, Greece, and white grape variety [
30].
Nevertheless, Electronic nose sensors face several challenges, including reduced chemical selectivity, limited sensitivity, and susceptibility to temperature and relative humidity (RH) variations. However, their low cost and reasonable effectiveness in array configurations [
28] make them attractive for integration in the SmartBarrel system’s E-nose module, particularly when combined with machine and deep learning models for aroma characterization [
27,
44,
45].
Electronic tongue systems constitute artificial analytical instruments designed to replicate human gustatory perception. These devices typically incorporate sensor arrays for acidity, sugar content, alcohol levels, and organic compounds such as polyphenols, which, when combined with chemometric processing, enable comprehensive characterization of complex liquid samples [
29,
46,
47]. The classification and determination, including quantitative analysis, of grape varieties from must and wine blends represent significant interest for winemakers, as it facilitates precise quality control and product differentiation throughout the production process.
The alcoholic fermentation process and its characteristic curve, including essential measurement parameters such as sugar content (Brix-specific gravity), temperature, pH levels, and alcohol concentration, are considered critical determinants of vinifiable product quality, necessitating continuous monitoring throughout winemaking [
29]. Additionally,
spontaneous releases during fermentation are important monitoring process parameters that address this requirement [
49].
Finally, Electronic eye systems capabilities integrate voltammetric electrodes [
50,
51], enabling rapid organoleptic assessment of wine samples outside the fermentation tank. Visible-near infrared (Vis-NIR) spectroscopy has been employed for polyphenol analysis in winemaking [
34,
52]. However, current implementations rely on offline sampling methodologies rather than the continuous in-tank monitoring proposed by this system. Integrating these complementary analytical approaches within a unified monitoring platform significantly advances conventional discontinuous quality control practices in the wine industry [
32]. Furthermore, an air CO
2 bubble gas capture sensor implementation that utilizes images and Deep learning CNN detection is presented in [
53].
The evaluation and regulation of winemaking parameters towards wine quality, using E-eye technologies, will achieve significant results through tannin quantification (detection at 1600nm wavelength) influencing the phenolic profile, along with must aromatic compound analysis (spectral detection at 1100-1300nm range) [
31]. Monitoring polyphenol evolution during different wine production stages proves critical for premium quality wine output. To this extent, E-eye sensory subsystems operating in selected visible (VIS 460-680nm) and near-infrared spectral bands (NIR band-a 1100-1300nm, NIR band-b 1580-1620nm) can enable real-time Total Polyphenol Index (TPI) estimation [
25,
33]. These optical monitoring capabilities provide unprecedented potential for continuous phenolic maturity assessment during vinification, allowing winemakers to make data-driven interventions at optimal tannin extraction and aromatic preservation time points. The combined spectral analysis of visible color characteristics and near-infrared molecular signatures represents a technological advancement over current discontinuous laboratory sampling methods, particularly for phenolic compound management in red wine production, where extraction kinetics significantly influence final product quality. The following
Section 3 presents the authors’ SmartBarrel system implementation incorporating Electronic nose and tongue capabilities, as well as limited Electronic eye capabilities.
3. Materials and Methods
The authors present a new fermentation monitoring system called SmartBarrel. They present the high-level system architecture, followed by the sensory parts and capabilities of the end devices. The proposed system has been evaluated for its data delivery processes. The authors also propose a fuzzy control monitoring process for fermentation alcohol predictions and a fuzzy autoencoder for fermentation data acquisition needed by their proposed deep learning V-LSTM model, which offers future fermentation measurement predictions based on previously SmartBarrel-measured parameters.
3.1. SmartBarrel System Architecture
The proposed SmartBarrel system has been designed to provide the necessary flexibility for sensor integration, enabling holistic, intelligent control of vinification processes with low-cost electronic sensor monitoring. Beyond basic parameters measurement during alcoholic fermentation, the SmartBarrel system includes intelligent processes and real-time measuring and monitoring capabilities accessible from any location within the winery facility. It implements analytics and interactive monitoring functionality via appropriate device-level user interfaces. The high-level system architecture of SmartBarrel is illustrated in
Figure 1.
Figure 1.(1) illustrates the fermentation case implementation where the SmartBarrel IoT end node probes reside (E-nose, E-tongue) collecting fermentation measurements. Those measurements are collected to an appropriate MPU controller (see
Figure 1.(2)). The MPU controller connects over Wi-Fi to the cloud ThingsBoard Application Server (AS,
Figure 1.(3)), sending telemetry data periodically using either HTTP or MQTT posts. Then, the ThingsBoard AS and the ThingsBoard mobile phone application are responsible for visualizing fermentation measurements per device tank-id using appropriate dashboards (
Figure 1.(4)). The collected data can be accessed using server-side RPC MQTT requests to collect specific time interval, device and attribute measurements. This selectivity of measurements is used as input to provide inferences by the deep learning V-LSTM model predictions, posted back to the ThingsBoard as JSON predictive data measurements, and illustrated via appropriate device-assigned dashboards.
Figure 1.(5) illustrates the ThingsBoard mobile device where they can access and visualize the measurement data remotely. This high-level architecture is a simplified approach to the thingsAI platform presented in [
11,
12].
SmartBarrel end node equipment includes an E-nose and E-tongue IoT device on the floating lid of small stainless steel fermentation tanks. The current SmartBarrel system implementation is only the E-tongue sensor subsystem for real-time measurement of fundamental oenological parameters of pH, sugar concentration, and temperature, and an E-nose sensors ring that is comprised of monitoring gas emissions of ethanol, CO, and CO2. An RGB color sensor with incorporated LED has been added to the E-tongue device to introduce the E-eye capability to this preliminary system. This color sensor is used to monitor wine clearness and color transitions. Finally, a glass brix meter device is used for sugar concentration measurements floating inside the wine tank, with an analog capacitive touch sensor attached. Since new NIR sensors and transducers must be added to have a proper E-eye device, its final implementation, validation, and experimentation are set as future work.
Concluding, the proposed system includes the following components, sensors, and actuators:
E-tonque end node IoT device: This is the end node device that includes a pH meter, a brix meter, a pressure, and a temperature sensor
E-nose end node IoT device: This includes the MQ-3 (Alchohol) and MQ-7(CO) sensor, MG811 carbon dioxide sensors, as well as temperature sensors
The proposed SmartBarrel system’s integration of such multisensory data with fermentation parameters provides unprecedented capabilities for real-time oenological decision-making. During fermentation, measurements are collected in a cloud-based open-source ThingsBoard Data Acquisition System [
40], enabling real-time visualization and statistical processing/analysis. Specifically, the system incorporates four key interfacing capabilities: 1) Visualization and statistical processing of collected measurements, 2) correlation functions implementation using selectable parameters and visualization of the results over time intervals, 3) execution of external inference processes provided by Deep Learning models on selected collected measurements and display of classification/prediction results, 4) based on the predicted results, threshold-based algorithms that connect to predefined text alerts and notifications of recommended oenological interventions. With the ThingsBoard mobile phone application, these visualizations can be available, even outside the industrial winery environment.
The ability of the SmartBarrel to collect data to the cloud makes it easy to implement, cloud-based machine, and mostly deep learning algorithms capable of periodic classification/calibration of wine quality parameters (visual, olfactory, and taste characteristics). Predictive assessment of fermentation stages through deep learning, generating alerts for undesirable fermentation deviations and providing interactive intervention suggestions on outlier values. Finally, automated parameter correction is performed when values exceed predefined thresholds, ensuring optimal fermentation conditions throughout the process. The SmartBarrel system integrates these functionalities through a unified IoT architecture, combining cloud computing for real-time response with cloud-based analytics for long-term process optimization and quality enhancement. An analytical description of the SmartBarrel end-node devices follows.
3.2. SmartBarrel End-Node Devices
The SmartBarrel end node device consisted of two different probing equipment as designed. A probing nose inherits the Electronic nose functionality, and a probing tongue inherits the Electronic tongue functionality. Partially, Electronic eye functionality has been implemented into the Electronic tongue. Therefore, the two IoT end-node devices (nose, tongue) acquire the following sensing capabilities:
E-nose: Monitoring of CO gas emissions inside the fermentation tank
E-nose: Monitoring of CO2 gas emissions inside the fermentation tank
E-nose: Monitoring of alcohol gas concentrations inside the fermentation tank
E-nose: Monitoring lid air temperature inside the fermentation tank
E-nose: Monitoring yeast temperature using a stainless steel temperature probe
E-tonque: Monitoring temperature and pressure values in the air gap inside the tank
E-tonque: Monitoring fermenting wine specific gravity by performing electronic hydrometer measurements that indirectly correspond to sugar concentrations through density. That is, for liquids heavier than water, Equations
1 apply:
E-tonque: PH meter and temperature sensor for yeast PH and temperature-pressure measurements
E-tonque: RGB sensor with LED for capturing the color of red wines that anthocyanins are responsible for the red and purple color of wines, while tannins contribute to color stabilization and astringency perception [
54] (white wines have low tannin concentrations and absence of anthocyanins [
55]). On the other hand, to capture the oxidation of phenolic compounds, leading to yellow, gold, or brown hues over time, and cinnamic acids and other hydroxycinnamates (e.g., caftaric acid), which can undergo enzymatic oxidation and contribute to wine browning [
56,
57,
58].
3.3. SmartBarrel E-Nose Device
The SmartBarrel E-nose device is illustrated in
Figure 2, attached to the stainless steel lid of the fermentation tank of typical sizes from 50-500lt.
Figure 2.(11) shows the E-nose placement to a 75lt 36” lid.
Figure 2.(1) is the plastic case screwed to the lid’s ventilation hole via a plastic rod. (
Figure 2.(2)).
Figure 2.(3) is the DS18B20 temperature sensor measuring lid temperature, end
Figure 2.(5) is the devices DS18B20 temperature sensor probe that is inserted inside the fermenting wine measuring liquid temperature.
Figure 2.(4) is the MG811 CO
2 sensor typically measuring ppm in the range of 300-10,000. It is an electrochemical sensing analog device, and it is attached to the microprocessing unit’s (MPU) 10Bit analog-to-digital converter (see
Figure 2.(8)). Similarly,
Figure 2.(7),(6) are the MQ-3 alcohol and MQ-7 CO sensors accordingly. These two analog MOS sensors measure resistance changes due to chemical reactions between gas molecules and the MOS surface. Typically, MQ-3 measures up to 0-20mg/L alcohol in the air while MQ-7 up to 2000ppm of CO in the air and is connected to the MPU unit via its analog-to-digital (A2D) converter.
The sensors are connected to an Arduino Wi-Fi rev.2 MPU, a Microchip ATmega4809 8-bit microcontroller with a 16MHz clock, 48KB of program memory, and 6KB of SRAM. It also includes a u-blox NINA-W102 Wi-Fi transponder and an LSM6DS3TR Inertial Measurement Unit (IMU) (see
Figure 3.10). The device is powered using a DC-12V transformer and transmits periodically every 5-minutes measurements of temperature (internal and lid-external), CO, CO
2, gas alcohol concentrations inside the fermenting tank, using either HTTP/POSTs or MQTT, of JSON encoded telemetry data. Another MPU device of the same microcontroller is used by the SmartBarrel E-tongue device to transmit telemetry data, as described in the following section.
3.4. SmartBarrel E-Tongue Device
The SmartBarrel E-nose device is illustrated in
Figure 3, attached to the stainless steel lid of the fermentation tank.
Figure 3.10 illustrates the plastic enclosure of the Arduino Uno Wi-Fi MPU, attached to the tank’s ventilation hole
On the inner surface of the lid, the pH probe (
Figure 3.(6)) has been attached (screwed) to the ventilation’s hole plastic winding via a flexible sink hose (see
Figure 3.(3)), with a plastic curved tube inserted in the hose opening (see
Figure 3.(4)) for the fermentation CO
2 to escape the tank via its ventilation hole. The pH sensor is an analog sensor capable of measuring from 0 to 14. It is connected to the MPU’s 10-bit analog-to-digital converter via a BNC connector board with an op-amp amplifier and a voltage regulator.
Figure 3.(7) is the analog Baume sensor that includes a capacitive liquid level sensor meter attached to a sealed glass tube hydrometer capable of measuring Baume degrees that correspond to Brix units and, therefore to sugar concentrations on g/L (see Equations
1).
An I2C MS5803 pressure-temperature sensor is attached to the curved tube (see
Figure 3.(4)) capable of providing temperature and pressure measurements inside the tank for the tongue probe. Finally, the adafruit I2C TCS34725 RGB sensor (see
Figure 3.(2)) enclosed in a plastic transparent case is used to get RGB color measurements from the fermenting wine. In order to obtain color measurements inside the tank, the sensor’s attached RGB LED opens and stays on for 30 seconds before acquiring a color measurement. The analog and I2C digital sensors are connected to the Arduino Wi-Fi rev2 board that, in turn, transmits them every 5 minutes to the ThingsBoard AS using either HTTP POST or MQTT publish messages of JSON encoded measurements. Before presenting the authors’ experimental scenarios and their proposed fuzzy inference, data encoder, and V-LSTM model, the metrics used to evaluate them are outlined in
Section 3.5.
3.5. Evaluation Metrics
Prior to presenting the SmartBarrel fuzzy controlled fermentation inference process and GRU deep learning prediction process, the evaluation metrics used are the following:
Root Mean Square Error (RMSE). It is calculated based on the formula
2.
where
denotes the actual value,
is the predicted value, and
n is the total number of observations. RMSE calculates the average magnitude of the prediction errors and penalizes large deviations more than smaller ones due to the squaring operation. The minimum value of RMSE is 0, which indicates perfect prediction. Higher RMSE values indicate larger deviations between predictions and actual values. Outliers in RMSE typically arise from large individual prediction errors and disproportionately affect the score due to squaring. Thus, RMSE is highly sensitive to extreme values.
Coefficient of Determination (
) shows how well the model explains the variance in the predicted variable based on the inputs. It measures the proportion of the total variation in the data captured by the inference results. It is calculated according to Equation
3
where,
is the actual value,
is the predicted value,
expresses the mean of the actual values, and
n is the number of samples. The maximum
value is 1, indicating perfect prediction. If close to 0, it suggests poor model inferences. Negative values can also occur when the model performs worse than a simple mean-based prediction. Extreme negative values usually signal serious model misfits.
3.6. Proposed Fuzzy Alcohol Controller
The authors implemented a fuzzy controller logic that can even be implemented at the device level (edge computing) [
59] to provide a fuzzy inference mechanism of alcohol concentration in the tank. The controller inputs our E-tongue and E-nose measurements and infers alcohol concentration measurements. In order to achieve this, appropriate fermentation datasets (25 white wine fermentation curves) have been used to train the fuzzy controller. Upon training and hyperparameter calibration, the fuzzy controller can provide alcohol predictions on measurements similar to those trained. This inference process is then passed to a Gaussian filter for smooth time-series responses. By using the fuzzy controller, the alcohol concentration values can be inferred.
Looking at the fuzzy controller implementation, the Gaussian membership function is used in the fuzzy sets, ranging between 0 and 1. The parameter mean is the center of the Gaussian curve, where the membership is maximal and equal to 1. The parameter is the standard deviation, which controls the width of the bell-shaped curve. A smaller results in a narrower curve, while a larger produces a wider, flatter curve. To take into account distribution skewness (to the left or the right), the median value is taken into account. The difference between mean and median is the right or left skew factor of the Gaussian curve, while the is used to: 1) provide a normalized offset distance value of the gaussian median (expressed as: ) which in turn is used to offset the gaussian curve centers, and 2) as a representative width of the gaussian bell curve used for each random variable.
In order to implement a fuzzy controller that takes as input wine fermentation parameters acquired by the SmartBarrel implementation and infer a real-time alcohol value, an appropriate fuzzy controller has been implemented using as inputs measurements of the following wine attributes:
Sugar concentration in (g/L)
pH measurements
-
CO
2 concentration expressed in g/L. Let
be the concentration of carbon dioxide produced during fermentation intervals dt, and let
be the equivalent concentration of it expressed in parts per million. The conversion is expressed by Equation
4:
Since ppm is used to express air concentrations, let
be the concentration of CO
2 floating inside the tank at a specific time interval dt, we use Henry’s law which describes the solubility of a gas in a liquid by Equation
where
is the concentration of dissolved CO
2 in fermenting wine (mol/L),
is Henry’s law constant for CO
2 in white wine, approximately
at 20°C (lower than water which is
), and
is the partial pressure of CO
2 in atm. Substituting
, and converting from mol/L to g/L, by multiplying with the molar mass of CO
2 (44.01 g/mol) the final Equation
6:
provides the concentration of CO
2 inside the fermenting wine. Concluding the ratio of CO
2 concentrations in the liquid over the air under equilibrium conditions is expressed by Equation
7
This equation allows estimation of the CO2 content in fermenting white wines from ppm gas-phase concentrations under standard conditions. That is, the mass concentration of CO2 in fermenting white wine over time is approximately 37% of the mass concentration in the gas phase.
Biomass fermentation residues. It includes any form of a specific product or metabolite and substances already included in the must that take part in the fermentation process. The development of particular components or biological decontamination can be measured by weighting the solid state extracted material from the fermenting wine (in g/L) during the controlled decantation of wine from one vessel to another, which is primarily aimed at separating it from lees and sediment, thereby enhancing its clarity, microbiological stability, and overall sensory purity.
Temperature of the fermentation process (maintained constant) in .
Alchohol concentration measured in g/L. The alcohol concentration is the output variable (consequent), while all others are input variables (antecedents).
These measurements have been obtained using the dataset provided from [
60], which included fermentations of white grape yeast. Given a dataset with column
X representing an antecedent, We assume that all input variables follow a Gaussian or a Gaussian skewed distribution during fermentation, except temperature, which follows more of a constantly controlled profile. We define the following statistical measures:
where
is the arithmetic mean of
X.
representing the median value of
X.
denoting the sample standard deviation (ddof=1) of
X. The median and mean are the measures used to provide the mean, which is sensitive to extreme values, and the median is robust to outliers. The relationship between these two measures provides insight into the skewness of a distribution. We also define a dispersion parameter
according to the following Equation
11:
Using Equation
11, the normalized skewness adjustment
parameter is computed for each variable according to Equation
12:
Given the dataset
D, of
N timeseries attributes denoted as:
, where each
is a time series attribute of length
T, given by:
Then,
, input data measure denoted as attribute three Gaussian membership functions
are constructed, for
with parameters (centers) expressed by Equation
13:
where
contains the centers for each attribute. Each Gaussian membership function
for
is defined using Equation
14:
where
is the minimum observed value,
is the mean value from
8, and
is the maximum value adjusted by
12. The complete fuzzy partition for an attribute variable
x is then given by Equation
15:
where each member of
follows
14 with parameters from (
13) and bandwidth
from
11. Uniform hyperparameters are used across all input attributes MF functions (high, medium, low) to set the appropriate Gaussian curve over the range of accepted attribute values. These parameters are presented in
Table 1.
In order to smooth consequtive timeseries of infered alchool value of the fuzzy controller, the Gaussian smoothing of discrete measurements with a boundary mode set to nearest, cant be used and it is computed via discrete convolution where the Gaussian kernel G has standard deviation and the boundary condition enforces for and for , with the kernel weights for truncated at and normalized to sum to unity, such that each smoothed point , replicates the nearest boundary value (nearest neighbor) when the kernel window exceeds the measurements domain.
The following
Section 3.6 presents the authors’ fuzzy autoencoder of a time series of fermentation parameters to create a first-stage Recurrent Neural Network capable of generalization of prediction of fermentation curves from historical data. Experimentation with the fuzzy inference controller implementation is presented in
Section 4.2.
Fuzzy Fermentation Autoencoder
In order to provide fermentation parameters predictions, a time series of a dense number of parameter measurements is required. These datasets should have minute scale resolutions for the deep learning RNN models to minimize losses and offer accurate results. Only machine learning approaches, such as decision tree-based predictors (LightGBM) or SVR machines, are available if such data are available in more than hourly periods. Focusing on white wine fermentation processes, and since such dense datasets are not yet widely available to train RNNs, the authors focus on an autogenerated approach provided by a fuzzy autoencoder that combines fermentation parameters knowledge from literature [
13,
49,
50,
61,
62], accomodated small sets of collected dataset of wine fermentations, such as the acquired data from the SmartBarrel system, to fuzzy generate fermentation data sequences. The fermentation encoder is modeled through fermentation phase-dependent fuzzy rules [
63], implementing the following attributes:
More specifically, the authors use the mathematical formulation provided by Equation
16 to describe parameter dynamics during the fermentation phases.
where the membership functions for each one of the fermentation phases are defined according to Equation
17:
The trimf is the triangular membership function and its corresponding parameters (start, peak, end), trapm the trapezoidal membership function and its corresponding parameters (start of rise, top start, end top and fall end), and smf the S-shaped membership function and its smoothly increased parameters from 0 to 1, a,b accordingly.
The biomass concentration
is used since it is mentioned in [
60], of the provided white wine fermentation curves and monitored by the SmartBarrel system by weighting the removed solid residues of the wine in each wine clarification steps (4-6 during the fermentation process). This parameter kinetics in g/L is modeled using a phase-specific growth kinetics Equation
18:
where
g/L is the Initial biomass,
h is a Lag time constant,
g/L is the maximum biomass as recorded,
h
−1 is the growth rate,
h is the exponential fermentation midpoint,
g/L/h is the decline rate,
h
−1 is the death rate and
is the noise process term. The sugar concentration
exhibits complementary phase behavior with respect to
and it is modeled using Equation
19:
where
g/L is the initial sugar concentration modeled using a uniform distribution (
).
h
−1, is the sugar consumption rate in g/hour (using a uniform distribution
).
g/L is the residual sugar,
g/L is the transition amount coefficient at the stationary fermentation phase,
h
−1, is the stabilization stationary phase rate,
g/L is the final concentration and
is the noise term. Moreover, the fermentation process evolves using the rate equations described in Equation
20:
where
is the fuzzy-controlled growth rate and
g/g is the yield coefficient. The complete system has been validated against industrial fermentation data. The pH rules have be mathematical formulated according to Equation
21, as mentioned and mechanistically explained in [
62]:
Finally, the fuzzy rules based on literature wine fermentation responses that govern the fuzzy autoencoder are presented in
Table 2 and further analytically elaborated over fermentation phases and previously expressed equations on
Table 3. The noise terms presented in
Table 3 are expressed by the Equation
22 bellow:
The described fuzzy controller can provide analytical white wine fermentation parameter curves as modeled using per-phase Equations presented in
Table 3. This can lead to dense fermentation datasets generation, except alcohol concentrations that can be inferred using the alcohol fuzzy controller described in
Section 3.6 using white wine experimental fermentation curves. This autoencoding process can simulate white wine fermentation processes with minute resolution granularity acquisition of fermentation parameters.
The fuzzy autoencoded datasets, in turn, are used by the authors’ proposed variable cells and layers LSTM model called V-LSTM, presented in
Section 3.7. This deep learning model can, in turn, offer future responses to fermentation processes. More precisely, the authors propose an algorithm for fermentation parameter predictions that has historical parameter data as input. Due to insufficient data sources, the fuzzy controller is primarily used as an autoencoder and predictor of alcohol degrees. Until sufficient data collection, the fuzzy autoencoder provides training sets for the V-LSTM model to offer temporary predictions (future fermentation parameter responses).
3.7. Proposed V-LSTM Model
The authors propose a new model for predicting wine fermentation parameters from up to now monitored values of pH, temperature, CO
2 tank concentration, sugar, alcohol, and biomass concentrations [
60]. The proposed model is an LSTM model with fuzzy autoencoding and self-healing capabilities.
Figure 4 illustrates the process steps of the V-LSTM model.
Figure 5 illustrates the V-LSTM model structure of variable cells and layers and its corresponding data inputs and outputs.
The V-LSTM model can be trained using two different training modes: a) autoencoding data training mode and b) actual data training mode. The operation mode selection is dependent on use and can be arbitrarily set. As shown in
Figure 4, if in autoencoding mode, steps 1,2 and 3 are used to provide actual training data for the model. The actual data training mode assumes that a dataset of timely-dense fermentation measurements has been acquired and moves straight to the
Figure 4.4 step of the model hyperparameters calibration.
Figure 4 describes the V-LSTM model framework integrating fuzzy logic and LSTM (Long Short-Term Memory) neural networks for fermentation process modeling and particularly focusing on providing data input parameters prediction in the future, called attributes looking at variable timestep windows of paste measurements. The process begins with collecting a minimal dataset of fermentation parameters such as concentrations of sugar, CO
2 biomass, and pH and a set of fuzzy rules that express their inter-relationship in a fuzzy manner. The dataset is used to formulate: 1) An alcohol fuzzy controller, as described in
Section 3.6, and 2) a fermentation data autoencoder, as described in
Section 3.6. The autoencoder is used to generate dense measurements of fermentation data. At the same time, the fuzzy controller is trained using the minimal dataset and then used to provide alcohol measurement inferences for the data generated by the fuzzy autoencoder.
V-LSTM model training includes also a pre-processing step (see
Figure 4.4), that involves the determination of The included LSTM model number of cells is
, and the number of layers is
l. These hyperparameters are first investigated by performing random searches using, as search parameters, the maximum number of trials and the minimum distance between values over a pre-determined range of cell values (8..512) and layer values (1..10). These values can be manually set at the V-LSTM model. The hyperparameters tuning process ends with selecting the minimum loss cells first and then using that minimum number of cells to select the minimum loss number of layers. The loss parameter investigated is the validation RMSE loss of a portion of the entire dataset used for training and, therefore, validation of the respective LSTM generated models [
36]. Upon selection of cells and layers hyperparameters, the final LSTM model is built as illustrated in
Figure 5.
The built model is trained over the dataset of k attributes using a pre-selected timestep of historical data window and predictions time length of predictions to infer for that timestep. Then, the dataset time series is loaded to memory and transformed into normalized data using min-max normalization per attribute. The same applies to the dataset labels that include the next timestep min-max normalized data equal in size to the predictions timelength .
Figure 5 illustrates the layer-wise architectural diagram of the V-LSTM (Variable-Length LSTM) model used for time-series predictions. It outlines how input sequences are transformed through stacked LSTMs and dense (NN) layers, reshaped, normalized, and finally mapped to a prediction output.
This V-LSTM model architecture is a hybrid RNN-NN variable size and depth time-series model that takes multivariate sequential 2D array inputs of data, where is the historical time series window of the multivariate data of k attributes. It utilizes pre-tuned l stacked layers of pre-tuned LSTM cells each. Then, it uses two dense NN to smoothly transform the stacked LSTM output of values to and finally to 1D array of consecutive values from the second NN layer. These values are then reshaped to form a 2D () array. This array is the model’s final prediction output. That is, after passing through a batch normalization step to smooth outliers jitter on the prediction value attributes.
In conclusion, the proposed V-LSTM model combines automatic fuzzy data encoding and parameter autotuning processes. It is well-suited for tasks like fermentation process forecasting, sensor data prediction, or any sequential regression application involving fuzzy or biological systems.
Section 4.3 also evaluates the authors’ proposed V-LSTM model.
5. Conclusions
This paper presents a new wine fermentation monitoring system called SmartBarrel. The system is equipped with two low-cost probing IoT devices, an Electronic nose capable of monitoring fermenting gas releases of alcohol, CO, and CO2, and an electronic tongue capable of monitoring basic wine fermenting parameters such as fermentation residues, pH, sugar concentrations and color changes. These IoT devices are installed on the lid of stainless steel fermentation tanks, probing and transmitting close to real-time measurements to the cloud. The system is assisted by the community edition open-source ThingBoard AS platform and ThingsBoard mobile application for remote monitoring and visualization. The proposed system supports cloud services and visualization and utilizes the Cassandra NoSQL database for its data storage location.
The authors also added the capability in their SmartBarrel system to offer a real-time estimation of alcohol degrees without using an additional meter but with a fuzzy controller capable of inferring alcoholic content from fermentation parameters. This fuzzy controller can also be implemented at the IoT device level. The authors also proposed a cloud-based variable cells and layers LSTM model called V-LSTM for predicting future fermentation parameters trained on either past fermentation data or data provided by fuzzy logic autoencoders. The proposed VLTM model can also auto-tune its model schema of the number of LSTM layers and cells per layer used based on portions of data training and, therefore, selecting the best hyperparameters per case study or scenario. The authors set as future work a modification of their currently proposed VLSTM model that can have multiple strands [
36], due to the selection of different hyperparameter values on re-training on new data, and therefore policies to apply the best strand inferences for each case accordingly.
The authors’ experimentation focused mainly on the E-nose SmartBarrel node, validating its functionality and overall SmartBarrel system functionality via the alcohol fuzzy controller inferences, achieving an score of 0.87 over new SmartBarrel fermentation data. Furthermore, the authors also experimented with their proposed V-LSTM predictor, showing that it can achieve RMSE scores down to 0.16, which is 45-73% less than existing prediction SVR and shallow NN models. The authors also denote the need for a dense-cloud-based measurement of wine fermenting parameters for deep learning models such as V-LSTM to achieve even better prediction results.
Figure 1.
SmartBarrel High-level system architecture and system components
Figure 1.
SmartBarrel High-level system architecture and system components
Figure 2.
Illustration of the SmartBarrel E-nose device, parts, and sensory components
Figure 2.
Illustration of the SmartBarrel E-nose device, parts, and sensory components
Figure 3.
Illustration of the SmartBarrel E-tongue device, parts, and sensory components
Figure 3.
Illustration of the SmartBarrel E-tongue device, parts, and sensory components
Figure 4.
V-LSTM process flow diagram of fuzzy parameters generation, hyperparameters training, model training and predictions over new data streams
Figure 4.
V-LSTM process flow diagram of fuzzy parameters generation, hyperparameters training, model training and predictions over new data streams
Figure 5.
V-LSTM model structure, layers, data input and output
Figure 5.
V-LSTM model structure, layers, data input and output
Figure 6.
SmartBarrel E-nose Evaluation for the fermentation of a Debina rose mix of white Debina variety with red Vlachiko variety in the area of Zitsa, Epirus, Greece
Figure 6.
SmartBarrel E-nose Evaluation for the fermentation of a Debina rose mix of white Debina variety with red Vlachiko variety in the area of Zitsa, Epirus, Greece
Figure 7.
SmartBarrel E-nose (P-nose) gas concentration measurements from MQ-7 (CO) MOS sensor, MG-811 (CO2) NDIR like solid-state electrochemical sensor, and MQ-3 MOS alcohol sensor, showing both processed concentrations and raw signals. The upper row displays (a) carbon monoxide (CO) and (b) carbon dioxide (CO2) concentrations in parts per million, while the lower row shows (c) ethanol concentrations (C2H5OH) in milligrams per liter and (d) the corresponding raw sensor outputs.
Figure 7.
SmartBarrel E-nose (P-nose) gas concentration measurements from MQ-7 (CO) MOS sensor, MG-811 (CO2) NDIR like solid-state electrochemical sensor, and MQ-3 MOS alcohol sensor, showing both processed concentrations and raw signals. The upper row displays (a) carbon monoxide (CO) and (b) carbon dioxide (CO2) concentrations in parts per million, while the lower row shows (c) ethanol concentrations (C2H5OH) in milligrams per liter and (d) the corresponding raw sensor outputs.
Figure 8.
SmartBarrel E-nose temperature plot in the air and inside the fermenting yeast (internal temperature)
Figure 8.
SmartBarrel E-nose temperature plot in the air and inside the fermenting yeast (internal temperature)
Figure 9.
Alcohol fuzzy controller inference values (green line) over not known fermentation curve of alcohol concentrations (blue line)
Figure 9.
Alcohol fuzzy controller inference values (green line) over not known fermentation curve of alcohol concentrations (blue line)
Figure 10.
V-LSTM model tuning process of the number of cells per V-LSTM layer using the RMSE as loss function
Figure 10.
V-LSTM model tuning process of the number of cells per V-LSTM layer using the RMSE as loss function
Figure 12.
Validation and evaluation results of the V-LSTM model
Figure 12.
Validation and evaluation results of the V-LSTM model
Table 1.
Fuzzy controller that partitions attributes (both antecedents and consequence) into three classes (low, medium, high) with Gaussian MFs hyperparameters and calibrated values to achieve minimum RMSE
Table 1.
Fuzzy controller that partitions attributes (both antecedents and consequence) into three classes (low, medium, high) with Gaussian MFs hyperparameters and calibrated values to achieve minimum RMSE
| Hyperparameter |
Description |
Calculation |
Calibrated Value |
|
offset
|
offset from minimum value for the attribute
|
|
|
|
offset
|
offset from minimum value for the attribute
|
|
|
|
w curve bandwidth |
Width of the gaussian-skewed gaussian curve expressed as a fraction of the standard deviation
|
|
default k=3 |
|
center value of the low membership function |
|
|
|
center value of the medium membership function |
|
|
|
center value of the high membership function |
|
kd=1 |
Table 2.
Fuzzy Rule Base for Fermentation Phases
Table 2.
Fuzzy Rule Base for Fermentation Phases
| Antecedent |
Consequent |
| IF phase is lag |
THEN biomass grows slowly (), sugar remains high (210 g/L) |
| IF phase is exponential |
THEN biomass follows sigmoid (), sugar decays exponentially |
| IF phase is stationary |
THEN biomass declines linearly (), sugar approaches 30 g/L |
| IF phase is death |
THEN biomass decays exponentially (), sugar stabilizes at 20 g/L |
| IF phase is lag |
THEN pH = 4.5 (constant), C |
| IF phase is exponential |
THEN pH decreases sigmoidally, T strictly controlled |
| IF phase is stationary |
THEN pH stabilizes near 3.2, T maintenance continues |
| IF phase is death |
THEN pH slowly recovers, T control remains active |
Table 3.
Fuzzy rule-chain used by the fermentation autoencoding process
Table 3.
Fuzzy rule-chain used by the fermentation autoencoding process
| Antecedents and Conditions |
Consequent conditions Actions |
| If lag fermentation phase (0-20h) |
| Biomass: |
|
| Sugar: |
(constant high) |
| pH: |
(no change) |
| Temp: |
(strict control) |
| CO2: |
(very low) |
| Alcohol: |
(none produced) |
| If exponential fermentation phase (20-70h) |
| Biomass: |
|
| Sugar: |
|
| pH: |
|
| Temp: |
|
| CO2: |
|
| Alcohol: |
|
| If stationary fermentation phase (70-150h) |
| Biomass: |
|
| Sugar: |
|
| pH: |
(stabilized low) |
| Temp: |
|
| CO2: |
|
| Alcohol: |
|
| If death fermentation phase (>150h) |
| Biomass: |
|
| Sugar: |
(constant low) |
| pH: |
|
| Temp: |
|
| CO2: |
|
| Alcohol: |
(slow decline) |
Table 4.
Wine ethanol Concentration Conversion table
Table 4.
Wine ethanol Concentration Conversion table
| Ethanol (g/L) |
% vol |
| 10 |
1.27 |
| 12.6 |
1.59 (Table wine minimum) |
| 45 |
5.7 |
| 82.9 |
10.5 (Dry wine minimum) |
| 94.7 |
12.0 (Typical non-dry wine) |
| 150 |
19.0 (Fortified wine maximum) |
Table 5.
Summary of training parameters of the V-LSTM model.
Table 5.
Summary of training parameters of the V-LSTM model.
| Parameter |
Value |
| Number of attributes (k) |
6 |
| Time window length () |
255 (12 × 24) - 24hours |
| Prediction length () |
288 (12 × 24)- 24hours |
| Number of LSTM layers (l) |
10 |
| Number of LSTM cells per layer () |
64 |
| Optimizer |
Adam |
| Minimum learning rate |
|
| Learning rate reduction factor |
25% |
| Learning rate patience |
1 epoch |
| Early stopping patience |
5 epochs |
| Max number of epochs |
100 |
Table 6.
Mean and standard deviation of RMSE for V-LSTM evaluation (testing) and validation (train) over 12 datasets, each one representing 100 fermentations with 5-minute resolution measurements.
Table 6.
Mean and standard deviation of RMSE for V-LSTM evaluation (testing) and validation (train) over 12 datasets, each one representing 100 fermentations with 5-minute resolution measurements.
| Metric |
Mean |
Std. Dev. |
| Validation RMSE (Epochs=40.66) |
0.161468 |
0.001817 |
| Evaluation RMSE |
0.159915 |
0.000895 |
| Trainable Epochs over train datasets |
Dataset D1 D2 D3 D4 D5 D6 D7 D8 D9 D10 D11 D12
Epochs 51 67 47 55 44 38 36 33 33 30 29 25 |