Detection of Butter Adulteration with Margarine Using Gas Sensors and Machine Learning

Authors

DOI:

https://doi.org/10.24925/turjaf.v14i6.1701-1707.8729

Keywords:

Butter adulteration, Food safety, E-nose, Machine learning, Artificial intelligence, Gas sensors

Abstract

This study aims to detect margarine adulteration in butter using a rapid, low-cost, and non-destructive method. Volatile compound profiles of butter–margarine mixtures prepared at different ratios (0%, 25%, 50%, 75%, and 100%) were acquired using a BME688 gas sensor array. The raw gas-resistance data were preprocessed using a comprehensive pipeline, including removal of missing data, noise reduction, time-axis alignment, spline interpolation, isolation of environmental effects, and standard scaling. Using the processed data, regression models were trained to continuously predict the butter proportion in the mixture, and classification models were trained to assign samples to predefined classes. In the regression analyses, gradient boosting regression (GBR) achieved the best performance, while in the classification analyses, the multilayer perceptron (MLP) achieved the best performance. Among the tested heater profiles, the HP-411 profile provided higher accuracy in distinguishing butter–margarine mixtures than the other profiles. Overall, the results show that integrating the BME688 gas sensor with machine-learning algorithms enables high-accuracy detection of margarine adulteration in butter. The proposed method offers a practical, rapid, and field-deployable alternative to classical analytical techniques, contributing to improved food safety and quality control.

References

Akram, U., Sahar, A., Sameen, A., Muhammad, N., Ahmad, M. H., Khan, M. I., Usman, M., & Rahman, H. U. ur. (2023). Use of Fourier transform infrared spectroscopy and multi-variant analysis for detection of butter adulteration with vegetable oil. International Journal of Food Properties, 26(1), 167-178. https://doi.org/10.1080/10942912.2022.2158860

Anagaw, Y. K., Ayenew, W., Limenh, L. W., Geremew, D. T., Worku, M. C., Tessema, T. A., Simegn, W., & Mitku, M. L. (2024). Food adulteration: Causes, risks, and detection techniques—review. SAGE Open Medicine, 12. https://doi.org/10.1177/20503121241250184

Andrès, E., Lorenzo-Villalba, N., Terrade, J.-E., & Méndez-Bailon, M. (2024). Fat-Soluble Vitamins A, D, E, and K: Review of the Literature and Points of Interest for the Clinician. Journal of Clinical Medicine, 13(13), 3641. https://doi.org/10.3390/jcm13133641

Ansorena, D., Ramírez, R., Lopez de Cerain, A., Azqueta, A., & Astiasaran, I. (2023). Oxidative Stability and Genotoxic Activity of Vegetable Oils Subjected to Accelerated Oxidation and Cooking Conditions. Foods, 12(11), 2186. https://doi.org/10.3390/foods12112186

Bao, Y., & Pignitter, M. (2023). Mechanisms of lipid oxidation in water‐in‐oil emulsions and oxidomics‐guided discovery of targeted protective approaches. Comprehensive Reviews in Food Science and Food Safety, 22(4), 2678-2705. https://doi.org/10.1111/1541-4337.13158

Bosch. (2024). BME688 Datasheet. https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bme688-ds000.pdf

Bosch. (2025). BME688 Development kit. https://www.bosch-sensortec.com/media/boschsensortec/downloads/product_flyer/bst-bme688-fl001.pdf

Che Man, Y. B., Syahariza, Z. A., Mirghani, M. E. S., Jinap, S., & Bakar, J. (2005). Analysis of potential lard adulteration in chocolate and chocolate products using Fourier transform infrared spectroscopy. Food Chemistry, 90(4), 815-819. https://doi.org/10.1016/j.foodchem.2004.05.029

Çakmakçı, S., Çelik, K., Ertem, H., Çalışkan, H. (2020). Tereyağı olarak satılan yağlarda bazı hileler ve kalite özelliklerinin tespiti: Erzurum örneği. Gıda, 45(4), 800-813. https://doi.org/10.15237/gida.GD20053

Demirkol, A., Guneser, O., & Yuceer, Y. K. (2016). Volatile compounds, chemical and sensory properties of butters sold in Çanakkale. Tarım Bilimleri Dergisi, 22(1), 99-108. https://doi.org/10.1501/Tarimbil_0000001372

Dıraman, H. (2006). Tereyağı ve Naturel Zeytinyağında Muhtemel Tağşişlerin Kapiler Kolon Gaz KromatografisiYöntemi Kullanılarak Cis Trans Yağ Asitleri Düzeyi İle Belirlenmesi Üzerine Bir Çalışma. Akademik Gıda, 4(4), 3-10. https://doi.org/10.15237/gida.GD20053

FAO. (2024a). Dairy Market Review: Overview of global market developments in 2023. https://openknowledge.fao.org/handle/20.500.14283/cd0443en

FAO. (2024b). Dairy Market Review: Overview of global market developments in 2024. https://openknowledge.fao.org/handle/20.500.14283/cd3524en

Fruehwirth, S., Egger, S., Flecker, T., Ressler, M., Firat, N., & Pignitter, M. (2021). Acetone as Indicator of Lipid Oxidation in Stored Margarine. Antioxidants, 10(1), 59. https://doi.org/10.3390/antiox10010059

FSSAI. (2016). Manual of methods of analysis of foods oils and fats.

Gao, J. (2024). R-Squared (R2) How much variation is explained? Research Methods in Medicine & Health Sciences, 5(4), 104-109. https://doi.org/10.1177/26320843231186398

Gemechu, A. T., Tola, Y. B., Dejenie, T. K., Grace, D. R., Aleka, F. B., & Ejeta, T. T. (2021). Assessment of Butter Adulteration Practices and Associated Food Safety Issues along the Supply Chain in Traditional Communities in the Central Highlands and Southwest Midlands of Ethiopia. Journal of Food Protection, 84(5), 885-895. https://doi.org/10.4315/JFP-20-355

Hodson, T. O. (2022). Root-mean-square error (RMSE) or mean absolute error (MAE): when to use them or not. Geoscientific Model Development, 15(14), 5481-5487. https://doi.org/10.5194/gmd-15-5481-2022

Keskin, H. (2022). Assessment of physicochemical characteristics, oxidative, and thermal properties of butters. Gıda, 47(2), 169-182. https://doi.org/10.15237/gida.GD21121

Koca, N., Kocaoglu-Vurma, N. A., Harper, W. J., & Rodriguez-Saona, L. E. (2010). Application of temperature-controlled attenuated total reflectance-mid-infrared (ATR-MIR) spectroscopy for rapid estimation of butter adulteration. Food Chemistry, 121(3), 778-782. https://doi.org/10.1016/j.foodchem.2009.12.083

Lee, C.-L., Liao, H.-L., Lee, W.-C., Hsu, C.-K., Hsueh, F.-C., Pan, J.-Q., Chu, C.-H., Wei, C.-T., & Chen, M.-J. (2018). Standards and labeling of milk fat and spread products in different countries. Journal of Food and Drug Analysis, 26(2), 469-480. https://doi.org/10.1016/j.jfda.2017.10.006

Milli, M., Söylemez Milli, N., & Parlak, İ. H. (2025). Rapid detection of honey adulteration using machine learning on gas sensor data. npj Science of Food, 9(1), 74. https://doi.org/10.1038/s41538-025-00440-9

Molnár, B., & Géczy, A. (2024). Electronic Nose Based on AI-capable Sensor Module for Beverages Identification. 2024 47th International Spring Seminar on Electronics Technology (ISSE), 1-5. https://doi.org/10.1109/ISSE61612.2024.10603721

Novais, L. M. R. de, Melara, V. K., Salome, K. S., Barison, A., Mascarenhas, R. de O., Andrade, M. V. de O., Lasmar, M. C., Freitas, J. M. de, Fernandes, M. R. S., & D’Oca, C. D. R. M. (2024). Investigation of fraud in the production of butter: a forensic case study of criminal association. Food Additives & Contaminants: Part A, 41(10), 1219-1231. https://doi.org/10.1080/19440049.2024.2387191

Parlak, İ. H., Milli, M., & Milli, N. S. (2025). Machine Learning–Based Detection of Olive Oil Adulteration Using BME688 Gas Sensor Matrix. Food Analytical Methods, 18(7), 1454-1464. https://doi.org/10.1007/s12161-025-02803-0

Sánchez, R., Díaz, F., & Melo, L. (2025). Portable MOS Electronic Nose Screening of Virgin Olive Oils with HS-SPME-GC–MS Corroboration: Classification and Estimation of Sunflower-Oil Adulteration. Chemosensors, 13(10). https://doi.org/10.3390/chemosensors13100374

Sanislav, T., Mois, G. D., Zeadally, S., Folea, S., Radoni, T. C., & Al-Suhaimi, E. A. (2025). A Comprehensive Review on Sensor-Based Electronic Nose for Food Quality and Safety. Içinde Sensors (C. 25, Sayı 14). Multidisciplinary Digital Publishing Institute (MDPI). https://doi.org/10.3390/s25144437

Seraj, A., Mohammadi-Khanaposhtani, M., Daneshfar, R., Naseri, M., Esmaeili, M., Baghban, A., Habibzadeh, S., & Eslamian, S. (2023). Cross-validation. Handbook of HydroInformatics: Volume I: Classic Soft-Computing Techniques, 89-105. https://doi.org/10.1016/B978-0-12-821285-1.00021-X

Tahmas Kahyaoğlu, D., Çakmakçı, S. (2016). Determination of the adulteration of butter with margarine by using fat constants. Tarım Bilimleri Dergisi-Journal of Agricultural Sciences, 22(1), 1-8. https://doi.org/10.1501/Tarimbil_0000001362

Uysal, R. S., Boyaci, I. H., Genis, H. E., & Tamer, U. (2013). Determination of butter adulteration with margarine using Raman spectroscopy. Food Chemistry, 141(4), 4397-4403. https://doi.org/10.1016/j.foodchem.2013.06.061

Downloads

Published

27.06.2026

How to Cite

Söylemez Bayramoğlu, K., & Parlak, İsmail H. (2026). Detection of Butter Adulteration with Margarine Using Gas Sensors and Machine Learning. Turkish Journal of Agriculture - Food Science and Technology, 14(6), 1701–1707. https://doi.org/10.24925/turjaf.v14i6.1701-1707.8729

Issue

Section

Research Paper