Frontiers in Computing and Intelligent Systems ISSN: 2832-6024 | Vol. 12, No. 1, 2025 28 Design of Non‐contact Measurement of Alcohol Concentration Based on the Lambert‐beer Law Miao Tang, Xin Wen, Qiuxin Yang, Shenhong Xia, Yiwen Luo Southwest Petroleum University, School of Sciences, Nanchong, Sichuan, 637001, China Abstract: This paper is based on the lambert-beer law, measuring the transmission rate of infrared light through alcohol to determine its concentration in a non-contact manner. Compared to traditional measurement methods, non-contact measurement minimizes the risk of alcohol contamination, while being simple and efficient. The design section includes mechanical structure, sensor filtering and sampling circuits, main control systems, and human-computer interaction programs. A high-order fitting algorithm was employed to establish a mathematical model relating alcohol concentration to voltage values, followed by data processing of the measured voltage values for different alcohol concentrations. Using this model, the corresponding alcohol concentrations were obtained. The relative error between measured values and calibrated values was found to be within 2.12%, demonstrating the accuracy of the experimental apparatus. Additionally, to address the impact of temperature variations on voltage values, a water calibration method was implemented to further reduce experimental errors. This achieved high-precision measurement of alcohol concentration and validated the rationality of the experimental system design. Keywords: Alcohol Concentration; Non-contact; Spectral Analysis; Lambert-beer Law. 1. Introduction Currently, most commonly available devices for measuring alcohol concentration are based on refractive index methods. This method involves creating standard gradients of alcohol concentration and using an Abbe refractometer to measure the refractive index of standards, from which a standard curve for alcohol is plotted. Samples’ refractive indices are then measured and used with this curve to calculate their alcohol concentrations. However, this method has significant accuracy deviations due to temperature fluctuations and external light interference. Additionally, infrared spectroscopy combined with partial least squares regression [1] has been experimentally validated as applicable for quantitative analysis of ethanol content in liquor, yielding successful results. The quantitative analysis demonstrated that the relative error between measurements and gas chromatography results did not exceed 0.81%, with a recovery rate ranging from 99.2% to 100.8%, indicating high accuracy and reliability of this model. Furthermore, this method has significant advantages in terms of operability, convenience, cleanliness, and non-destructiveness, making it highly applicable. It has strong potential in the field of ethanol detection in liquor and can serve as a reference method. Besides these methods, there are also gas chromatography, hydrometers, spectrophotometry, densitometry, and three- dimensional fluorescence methods among others [2]. The three-dimensional fluorescence method identifies ethanol as a fluorescent substance; when its volume fraction is less than 50%, the fluorescence intensity of its characteristic peak correlates with its volumetric concentration. Many researchers have done research on non-contact method to measure alcohol concentration. For instance, Zhao Leihong’s team proposed a non-contact measurement technique for alcoholic gases using a BP neural network algorithm for nonlinear processing based on neural network calibration algorithms. Zhou Yang’s team utilized Fourier- transform infrared spectroscopy along with a TSL245 optical frequency converter as a receiver to measure different concentrations of alcoholic solutions and identified spectral ranges sensitive to alcohol concentration between 1250 nm and 1350 nm. To solve temperature effects, Fu Qingbo’s team employed four solutions: direct calibration, global calibration, orthogonal signal processing, and generalized least squares weighting methods to mitigate temperature effect on the overall system performance. Due to various limitations present in current market instruments for measuring alcohol concentration, existing devices are often unsuitable for accurate, rapid non-contact measurements in practical applications [3,4]. With the developments of optoelectronic technology, non-testing measurement techniques are continuously being developed and applied across various fields. Scholars both domestically and internationally are engaged in research within this area. Examples include Albert Mozer’s team abroad which developed a high-precision real-time method for detecting alcohol concentration using infrared spectroscopy; similarly, Michel Toual’s team researched breath gas analysis techniques for detecting alcohol based on infrared spectroscopy and laser technology. Domestic researchers have also developed numerous non-contact alcohol concentration measurement systems focusing on key technologies; a typical example is Peng Chuang’s team which designed an alcohol testing system centered around microcontroller technology that meets detection requirements. This device does not limit itself to spectrometers or spectrophotometers but utilizes photodiodes as spectral detection sensors instead. For data processing, compact microcontrollers were selected for ease of integration which reduced equipment costs while enhancing portability of the device. The focus of designing devices based on near-infrared spectroscopy lies in identifying suitable wavelength light sources and establishing a mathematical model relating light attenuation to alcohol concentration. Given that photodiodes exhibit good linear performance, established models can be transformed into new models representing relationships between voltage signals and alcohol concentrations. 29 Furthermore, by replacing light sources with appropriate wavelengths along with corresponding types of photodiodes, this device can also be utilized for detecting concentrations in other solutions as well as mixed solutions; thus, it holds promising application prospects. 2. Principles of Alcohol Measurement 2.1. Selection of Light Source Different ethanol concentrations result in distinct absorption characteristics and transmission peaks of the solution, with significant variations occurring particularly between wavelengths of 200 nm to 600 nm.[5] The use of infrared light for measuring alcohol concentration[6], particularly near-infrared spectroscopy, is rapid and does not damage the sample, reducing sample costs and requiring less technical expertise from operators. This method has broad applications, including in pharmaceutical chemistry [7]. Spectral analysis is a widely used analytical technique, with common methods including transmission spectroscopy and reflection spectroscopy. A detailed comparison of these methods reveals that while each has its advantages and disadvantages, our experimental measurements lean more towards transmission spectroscopy. In transmission spectroscopy, the sample is placed between the light source and the detector, which measures the transmitted light through the sample. In reflection spectroscopy, the detector is on the same side as the light source, collecting reflected light. The former method offers simpler measurements and more direct quantitative analysis; however, in reflection spectroscopy, the reflected light includes both specular and diffuse reflections. While diffuse reflections carry information about the structure and composition of the sample, their propagation path within tissues is complex. Thus, although quantitative analysis is theoretically possible, this complexity leads to dispersed outgoing light with limited information and weak signal strength, significantly increasing requirements for probes and making accuracy difficult to ensure. Although sample thickness has a significant impact on transmission spectroscopy, its simpler measurement process and more direct quantitative analysis make it preferable compared to the weaker signals and complex quantitative analysis associated with reflection spectroscopy; thus, this study opts to utilize transmission spectroscopy for research purposes. Near-infrared spectroscopy (NIR) [8,9] has rapidly developed in recent years as a fast detection method that allows for both qualitative and quantitative analysis of substances simultaneously; thus it has been widely adopted. The advantages of near-infrared spectroscopy include its preprocessing capabilities, low cost, low pollution levels, retention of chemical properties of substances, and environmental friendliness, making it suitable for widespread application in alcohol detection. Based on the principle of infrared absorption, this technology utilizes the interaction between molecular substances and infrared light at specific wavelengths. In common infrared absorption spectra, alcohol molecules absorb infrared light at specific wavelengths. Measuring devices typically emit an infrared beam through a region containing an alcohol sample and then receive the transmitted infrared light. The detector within these measuring devices detects the intensity of transmitted light and calculates alcohol concentration based on variations in this intensity. This occurs because higher alcohol concentrations result in more alcohol molecules absorbing infrared light, leading to a decrease in transmitted light intensity. 2.2. Lambert-beer Law Based on the study of the lambert-beer law, we obtained that different substances absorb light intensity to varying degrees. Therefore, when measuring a substance, it is advisable to select a wavelength at which the substance has a relatively high absorbance for detection [1]. The mathematical expression of the lambert-beer law is: In this equation, A is absorbance, T is transmittance (the ratio of transmitted light intensity (I) to incident light intensity (I0)); K is the molar absorptivity coefficient, which is related to the properties of the absorbing substance and the wavelength (λ) of the incident light; c is the concentration of the absorbing substance in mol/L; and b is the thickness of the absorbing layer in cm. When a beam of monochromatic light [2] passes through a solution being measured, its intensity decreases according to the solution’s absorbance. The length through which the transmitted light travels can be standardized using calibrated instruments. Therefore, under consistent standards, one can eliminate the influences of K and b and indirectly measure the concentration of the substance being tested through transmittance. 3. System Design 3.1. Overall System Structure The design of the system for measuring alcohol concentration primarily includes mechanical structure, sensor filtering and sampling circuits, main control systems, human- computer interaction programs, and data processing. The system block diagram is shown in Figure 1; both main control and data processing are performed by an STM32F103 microcontroller. Sensor filtering and sampling consist of a 120 nm infrared LED, an InGaAs photodiode PD1300- 130D32, and a 16-bit ADC sampling chip ADS1115. Human- computer interaction is facilitated by the STM32 microcontroller. The alcohol concentration measurement system constructed based on this design is illustrated in Figure 2. When operational, the STM32F103 microcontroller drives the infrared LED to emit light through an alcohol liquid sample; on the opposite side, an InGaAs photodiode detects real-time voltage changes which are then input into a pre- written data model for concentration calculation displayed on a screen. The overall structure does not require high-cost optical components; thus, this design can be controlled at very low costs when used as a development module, lowering barriers for mass production or commercialization. A description of implementing digital filtering methods with microcontrollers follows [10, 11, 12]; such low-power embedded systems can be widely used in data acquisition fields. Digital filtering techniques have significant advantages over analog filtering in addressing low-frequency interference and random signal noise reduction. They also offer many benefits such as fast computation speeds and flexible adjustment of filter characteristics to resolve issues like slow acquisition speeds and random errors in data collection. Researching feasible digital signal processing KbcTA  )/1lg( 30 methods within low-capacity systems like microcontrollers holds significant importance. Commonly used digital filtering algorithms include: clipping filter, median filter, arithmetic mean filter, weighted average filter, moving average filter, low-pass filter, and composite filter. Analyzing the application environment for microcontrollers allows these algorithms to be validated and applied in practice. Clipping filter: This method calculates the increment between two consecutive sampled values collected during measurements. A predetermined maximum value ΔY is set; then this ΔY is compared with increments collected during sampling sessions. If an increment is less than or equal to ΔY, it is considered valid data; if greater than ΔY, then only data from the previous sample session is regarded as valid data instead. Median filter: This method involves taking N (“N” means numerous) consecutive samples where N is typically an odd number, sorting these N values, and selecting the middle value as the final sampled value outputted after filtering processes occur. Arithmetic mean filter: This method involves continuously collecting N samples where their values are averaged arithmetically; thus yielding an average value as output after filtering operations occur during measurement sessions conducted thereafter. Weighted average filter: This algorithm applies weighted averages by assigning different weights to each data point within an input sequence while ensuring that all weights sum up to one; thus resulting from multiplying N sampled values by their respective weights before summing them together yields final output results obtained after filtration procedures take place thereafter. Moving average filter: This method retrieves valid sampled values by averaging current samples with those from previous N-1 sessions conducted beforehand. Low-pass filter: The difference equation algorithm follows Y_n = a*X_n + (1-a)* Y_(n-1), where this equation simulates low-pass filters based upon its principles during operation phases executed thereafter. The specific operational process for composite filtering involves first removing impulse interference components from data using median filtering algorithms; subsequently applying recursive averaging methods on remaining data post-median filtration processes have been applied previously thereafter. Within low-power embedded systems like microcontrollers that possess limited computational capabilities relative to higher-end systems available today, these digital filtering algorithms have gained widespread applications owing largely due mainly because they effectively address various challenges encountered throughout data acquisition processes while improving overall accuracy and reliability levels achieved therein. Figure 1. Block Diagram of System Figure 2. System for alcohol concentration measurement 3.2. Independent Component Architecture Design 3.2.1. Hardware Design After comparing, a commonly used 10 mm quartz cuvette is selected, with the sensor and infrared LED positioned on either side of the cuvette. The reserved holes on both sides are designated for the placement of the light source and sensor. The LED and sensor should not contact the glass surface of the cuvette to prevent minor friction. Additionally, a central hole is reserved for a temperature sensor to monitor the temperature of the alcohol sample in real-time. The internal wall structure incorporates four crossbars to precisely position the two glass surfaces of the cuvette, 31 ensuring minimal movement during alcohol concentration measurement, as shown in Figure 3. The back structure of the device includes reserved interfaces for circuit board modules, facilitating easy installation of the circuit board; the overall mechanical assembly is shown in Figure 4. Figure 3. Diagram of mechanical device Figure 4. Physical diagram of model Key components of the hardware system include: a 1200 nm infrared diode light source, an InGaAs photodiode PD1300-130D32, a temperature sensor MLX90614ESF, and a 16-bit ADC sampling chip ADS1115. The power supply section provides a stable power source for digital devices, with the infrared sensor receiving a dedicated three-terminal voltage regulator to ensure stability; a stable tantalum capacitor is used to maintain low ripple voltage levels in this power supply configuration. The three-terminal linear voltage regulator [13, 14] is a DC voltage conversion circuit characterized by no pole, low ripple, and low noise levels. It is widely used in battery- powered devices, PDA products, and post-regulated sources due to its wide input voltage range and stable output voltage levels. One notable feature of this regulator is its packaging with three pins, making it simple to integrate into external circuits and easy to use; it can also be compatible with TO- 220 type three-terminal packages. Reliability is one of its key characteristics; thus, designing a highly reliable bandgap reference startup circuit is crucial in developing three- terminal linear voltage regulators. The voltage membrane structure bandgap reference circuit includes one zero-current degenerative element while low-voltage bandgap reference circuits may contain multiple elements; therefore, it is important during design to eliminate degenerative components from this circuit configuration entirely. In term of Sampling and filtering section, the photodiode operates under reverse bias from the power supply, functioning as a current source; by using a series sampling resistor, this photocurrent is converted into varying voltages which are then matched through an operational amplifier- based voltage follower circuit for impedance matching before sampling occurs. The subsequent circuit incorporates an RC filtering arrangement to reduce voltage fluctuations and enhance precision, as illustrated in Figure 5. Figure 5. Design drawing of sampling and filtering circuit 光敏传感器的输入端 - Input Terminal of Photodetector 滤波输出 - Filtered Output 信号滤波处理 - Signal Filtering Process ADC 采样部分 - ADC Sampling Section 电源部分 - Power Supply Section 传感器电路 - Sensor Circuit 近红外灯电路 - Near-Infrared Light Circuit LCD 显示屏 - LCD Display Screen 温度传感器 - Temperature Sensor 接口部分电路 - Interface Circuit Section 酒精检测模块 - Alcohol Detection Module 32 The modular interface design encapsulates all hardware into a single alcohol detection module; through an IIC communication interface, density values and temperature readings are returned to the microcontroller for calculations leading to determined alcohol concentrations, the PCB diagram for this device is shown in Figure 6. Figure 6 has been omitted. This modular design allows for easy portability through simple programming onto microcontroller systems such as Arduino, STM32, or ESP32, enhancing flexibility in alcohol concentration detection while improving convenience in embedded development. 4. Alcohol Concentration Measurement Experiment 4.1. Steps in the Measurement Experiment Prepare a high-concentration alcohol solution and dilute it with deionized water to create samples of varying concentrations, including high (65%-85%), medium (45%- 65%), and low (20%-45%). Allow the solutions to stand undisturbed. Use a syringe to draw an appropriate volume of the sample solution (5-10 ml), then inject it into the cuvette, cover it with the cuvette lid, and place it into the alcohol measurement device. Record the voltage displayed by the photodetector, taking multiple measurements to calculate an average value. To minimize temperature-related effects during these steps, conduct the experiment in a closed indoor space with air conditioning to maintain a constant room temperature. 4.2. Precautions in the Measurement Experiment Alcohol solutions need to stir them evenly with a glass rod or allow them to stand undisturbed; otherwise, uneven density may lead to inaccurate measurement results. When preparing solutions of different concentrations during the experiment, allow them to stand for a period to ensure that any heat generated from mixing dissipates completely. Maintain a constant temperature environment during experiments, either in a sealed room or one with stable air conditioning; continuously monitor values returned by the temperature sensor, and if any change exceeds 0.5 degrees Celsius, halt measurements until the temperature returns to preset values before resuming testing. 5. Analysis of Temperature Influence 5.1. Effect of Temperature on Alcohol Concentration The measurement of alcohol concentration typically relies on specific physical methods; however, these methods are often influenced by environmental factors, with temperature being the most significant one. Temperature not only affects the volatility of alcohol but can also impact the accuracy and stability of measuring devices. Therefore, understanding and controlling the influence of temperature on alcohol concentration measurements is crucial for ensuring measurement accuracy. This experiment was conducted at room temperature, where temperature is an important factor in measuring alcohol concentration. Because indoor temperatures are not fixed, it is necessary to consider the effects of temperature on alcohol concentration measurements to improve the instrument’s accuracy. 5.1.1. Experimental Temperature Conditions Forty samples of alcohol solutions were prepared at room temperature with concentrations ranging from 15% to 100%. Each sample was divided into five portions and stored at constant temperatures of 13°C, 18°C, 22°C, 25°C, and 28°C respectively. The samples were collected in covered glass bottles to prevent evaporation. A hydrometer was used to measure the alcohol concentration while simultaneously recording the temperature readings from a temperature sensor; MATLAB was utilized for higher-order data fitting. 5.1.2. Data Processing Figure 7. Cubic linear relationship between alcohol concentration and voltage. 33 Figure 8. Curve of alcohol concentration function at different temperatures The goodness of fit refers to how well the regression line fits the observed values. Initial fit and quadratic fit revealed a poor linear relationship between measured values and fitted values, with goodness-of-fit values of 0.9863 and 0.9864 respectively. After observing the distribution characteristics of the measured values, we find it meet cubic fit’s characteristics. After applying cubic fitting, the resulting function curve is shown in Figure 7, with a goodness-of-fit value of 0.9937 indicating a strong cubic polynomial relationship between alcohol concentration and voltage values. Several groups of data of alcohol concentration and voltage at different temperatures were obtained through experiments, and the function curve of alcohol concentration and voltage was obtained by least square cubic curve fitting, as shown in Figure 8. 5.2. Temperature Solution To address temperature variations issues, we adopted deionized water for initial parameter calibration, and the principle is as follows: under controlled temperature conditions, before measuring alcohol concentration, we firstly recorded the voltage value when filling the cuvette with deionized water and then used to fit a predictive function curve for future reference. For subsequent concentration measurements, we filled the cuvette with deionized water again and manually adjusted a knob until the displayed voltage matched the calibration curve before continuing with further concentration measurements. 5.3. Validation of Experimental Accuracy At constant temperatures, both deionized water calibration and non-calibration methods were used to measure alcohol concentrations and voltage values; least squares methods were employed for curve fitting analyses. The relative error is used for error analysis of the fitting curve, and the relative error formula is: ∆ In this formula, ∆ is the difference between measured values and calibrated values; C is the calibrated alcohol concentration value, and the results are summarized in Table 1 below. Table 1. Error analysis of measured value and standard value Measuring voltage /V Standard alcohol concentration /% Alcohol concentration to be measured /% Relative error /% 3.5 85.4943 87.1662 1.95 3.3 71.7090 72.3626 0.91 3.1 60.3956 61.0903 1.15 2.9 48.9517 49.9429 2.02 2.7 34.7749 35.514 2.12 In Table 1, after analyzing and comparing the data, we can see that the relative error values for alcohol concentrations measured under constant temperatures are less than 2.12%. This indicates that our self-designed instrument achieved high precision in measuring alcohol solutions. Thus, this experimental setup demonstrates high reliability, suitable for subsequent research studies conducted thereafter. 6. Conclusion The device designed based on the Beer-Lambert law directly calculate alcohol concentration by measuring and analyzing alcohol molecules’ absorption characteristics under specific wavelengths of light, enabling rapid, accurate, and non-contact detection of alcohol concentration. This paper continues in-depth research on non-contact alcohol concentration measurement technologies, combined with artificial intelligence and machine learning techniques, can develop an intelligent alcohol concentration detection system that offers real-time monitoring and early warning capabilities. In summary, this device provides a new method and technology for achieving rapid, accurate, and non-contact alcohol detection based on research into non-contact measurement of alcohol concentration. In the future, research directions will focus on further enhancing the accuracy and 34 stability of measurement technologies and applying them in practical scenarios to offer users more convenient and safe alcohol measurement methods, and providing better services and safeguards for society. References [1] Wang Zhenzuo, Lv Jiahui, Guo Weiliang, etc. Determination of ethanol content in distilled spirits using short-wave near infrared spectroscopy with partial least square regression model [J]. Science and Technology of Food Industry, 2005, (11): 158-160. [2] Bu Guijun, He Xiaosong, Zheng Xiaojiang, et al. Study on the Characteristics of Three-Dimensional Fluorescence Excitation- Emission Spectra of Methanol and Ethanol [J]. Spectroscopy and Spectral Analysis, 2012, 32 (02): 420-424. [3] WANG Hongbin; WANG Weihua; FANG Ye. Design of Non- Contact Measurement System for Alcohol Concentration [J]. Journal of Lanzhou Institute of Technology, 2024,31(06):81- 85. [4] Zhong Zhiqiang. The research of university physics experiment data processing method based on Python language [J]. Journal of Anshan Normal University,2016,18(02):77-81. [5] YAN Feng YANG Jun-Jie SHI Jiu-Lin. Detection of edible alcohol and industrial alcohol by spectral technique [J]. Journal of Food Safety and Quality,2016,7(07):2828-2834. DOI:10. 19812/j.cnki.jfsq11-5956/ts.2016.07.043. [6] Zhouweiwei. Non-destructive Test Alcohol content of Driver Earlobe Based on Near infrared Spectrum [D]. Shandong university, 2014. [7] ZHOU Ying; LI Dong-yun. Advantages and Application Development of Near Infrared Spectroscopy in Screening of Illegal Chemical Additives in Health Food and Chinese Patent Medicine [J]. GuangZhou Chemical Industry, 2023,51(05): 135-138. [8] Xia Y, Zou S ,Xie P , et al.A kind of multi-dot ensemble regression AI detector for lubricating oil additive content based on lambert-beer law[J].Spectrochimica Acta Part A: Molecular and Biomolecular Spectroscopy,2024,318124436-. [9] ZHOU yang, LIU jie, Wang jiyuan. Absorption mechanism and application of infrared spectra of ethanol [J]. China Brewing, 2013, 32(12):128-130. [10] Luo Zhangcheng, Zuo Shizhu, Huang Qiang, et al. Three-port voltage stabilizing circuit with high reliable start and low voltage difference [J/OL]. Microelectronics,1-9[2025-03-28]. https:// doi.org/10.13911/j.cnki.1004-3365.240030. [11] Zheng Lixia, Wu Jin, Zhang Xiuchuan, etc.Sensing detection and quenching method for InGaAs single-photon detector [J]. Acta Physica Sinica, 2014,63(10):222-230. [12] Zhouweiwei. Non-destructive Test Alcohol Content of Driver Earlobe Based on Near-infrared Spectrum[D]. Shandong University, 2014. [13] Zhu Hengjun, Wang Fazhi, Yao Zhongmin. Analysis and Implementation of digital filter algorithm based on MCU [J]. Journal of Qiqihar University(Natural Science Edition),2008, (06):53-54+57. [14] Wang Zhenzuo, Lv Jiahui, Guo Weiliang, etc.. Determination of ethanol content in distilled spirits using short-wave near infrared spectroscopy with partial least square regression model [J]. Science and Technology of Food Industry, 2005, (11):158-160. [15] A high-bandwidth low current transimpedance amplification circuit[J]. Liu Hao;Dong Chunhui;Yang XinYing;Cheng Feng; Zhang Qingxian;Liao Kaiyong;Lu Zhigang;Gao Zhiyu;Luo Tingfang; Huang Qichang;Li Weilan.Journal of Instrumentation, 2021.