1 Introduction
Mezcal is socially considered as an elixir [1] and the Official Mexican Norm considers mezcal as an alcoholic beverage composed of 100% agave, which is obtained by distillation of juices fermented [2]. Unfortunately, alcoholic beverages are commonly adulterated by diluting with water, ethanol, ethyl alcohol or methanol. Normally, alcoholic adulteration is performed for economic reasons, and it can cause health problems, especially when alcoholic beverages are adulterated with methanol [3]. Therefore, the adulteration of alcoholic beverages is an illegal and clandestine practice [4].
The recognition of adulteration of alcoholic beverages can be done using several techniques, most of which are expensive, time-consuming for sample preparation or use large amounts of solvents [5-6]. Some of these techniques are high-performance liquid chromatography, nuclear magnetic resonance, gas chromatography, fluorescence spectrometry and UV-Vis spectrometry [7]. In particular, this last technique is considered for several applications. For example, the characterization of materials, determination of absorbance in thin films [8], detection of defects in wood [9], detection of glucose in salivary fluid [10] and for the teaching of chemistry [11].
The physical phenomenon of spectrophotometry consists of measuring the degree of absorbance of light in a specific wavelength range. This requires three basic components, a light source, a monochromator and a detector. The light source and detector define the wavelength limits. The monochromator separates the light produced by the source into different wavelength ranges. Subsequently, a sample is placed between the monochromator and the detector, which is illuminated with a specific wavelength. The light not absorbed by the substances present in the sample, can be quantified by the detector [12]. However, the high-cost of spectrophotometry equipment is the main problem. For example, the Cary 60 UV-Vis spectrophotometer costs around $ 30,000 and the DR-1900 spectrophotometer costs between $ 2,000 and $ 8,000 [13]. Consequently, this equipment is inaccessible due to their high cost for the vast majority of educational institutions around the world, either for research or teaching activities [14, 16].
However, in the literature, the manufacture of a spectrophotometer with simple components, such as cardboard, diffraction gratings of digital discs (DVD), cell phones or digital cameras has been reported [11, 16]. Also, a spectrophotometer based on LEGO pieces has even been successfully developed [17]. However, the vast majority of these home-made equipment do not have the following two elements: (1) an automation system to carry out complex measurements and (2) a graphical control interface. However, the spectrophotometer proposed in this work does have both elements.
Trying to solve the problem of (1) recognizing adulterated mezcal and (2) avoiding the high cost of lab equipment. The aim of this work is to develop a homemade spectrophotometer considering an easy methodology, in order to solves the two previous problems. Meanwhile, the importance of this work is to encourage teachers, without deep knowledge in electronics and programming, to develop their own homemade spectrophotometer, avoiding high payments, and to develop laboratory practices with students. This spectrophotometer is designed to recognize Mezcal adulteration and to develop laboratory practices with students.
2 Materials and methods
A simple methodology for designing a low-cost spectrophotometer based on Arduino is presented in the first section. Later, the spectrophotometer diagram is shown in Figure 1. Subsequently, the programming code of the microcontroller-Atmega328P is explained step by step. This microcontroller is used in the Arduino data acquisition board due to its simple programming procedure.

Figure 1 1) Spectrophotometer diagram. 2) Components of the spectrophotometer. a) High power lamp, b) Atmega328P microcontroller, c) FTDI-FT232, d) LM234 signal amplifier, e) Light beam generated by the lamp, f) Biconvex lens, g) Light diffractor, l) Photoresistor, j) ULN2003 controller, k) 28BYJ-48 stepper motor, m) Servomotor.
The Atmega328P has the function of controlling the electronic components (stepper motor, servos, etc.) and also saving the data obtained by the optical measurement system. The next section discusses the programming of the control interface. The next section shows the spectrophotometer calibration using a spectrophotometer VE-5100uv from VELAB. Finally, the preparation of the cuvettes with different concentrations of mezcal and ethyl alcohol is explained.
2.1 Electronic components of the spectrophotometer
The spectrophotometer is composed of these three electronic setups: (1) A data acquisition system using Arduino, and which consists of an Atmega328P microcontroller (Figure 1-b) with an FTDI-FT232, the electronic component responsible for communication between the microcontroller and the computer((Figure 1-c. (2) A light detection system with a photoresister (Figure 1-I and an LM234 signal amplifier (Figure 1-d). (3) An optical stimulation system, which is composed of: A high-power lamp (Figure 1-a), a biconvex lens (Figure 1-f), a light diffractor (Figure 1-g) which rotates by a 28BYJ-48 stepper motor (Figure 1-k), and which is controlled by the ULN2003 controller (Figure 1-j).
2.2 Electronic components of the spectrophotometer
In the Arduino -based spectrophotometer, a 50W, 12V-30V Led lamp was used. It provides the light for stimulation. The lamp has a 2-amp switch, a 4-inch 12V cooling fan and a converter to boost the DC-DC Boost 150W voltage to 12-35V 6A. The structure of the lamp was made with a 3D printer (Figure 2).
2.3 Focusing system and light diffraction
Normally, the light spectrum of a lamp is scattered, so it must be focused to increase its intensity. Therefore, a biconvex lens (Figure 3-f) was used to focus the light spectrum. The distance selected for the light source and the lens was 12 cm. Afterwards, the light beam is diffracted using a DVD fragment (Figure 3-h), as reported in the literature [12], this diffractor is appropriate. The distance between the lens and the diffractor is 7 cm. The diffractor is placed on the 28BYJ-48 Unipolar stepper motor (Figure 3-m), and depending on where the diffractor is placed, a certain wavelength will be produced. The stepper motor uses a 5V supply voltage with a ULN2003 controller (Figure 3-n). An electromechanical system (Micro Servo 9g SG90) was implemented to obstruct the light beam of the lamp (Figure 3-b).

Figure 3 Focusing and light diffraction system. a) Lamp, b) Interruption bar, c) SG90 servo motor, d) LED, e) Stray light beam, f) Biconvex lens, g) Focused light beam, h) Diffractor, i) Light beam with certain wavelength, k) Thin film, o) Transmitted light beam, l) Photoresist, m) 28BYJ-48 stepper motor, and n) ULN2003 stepper motor driver.
2.4 Light detection system
The diffracted light beam with a specific wavelength is transmitted through the cuvette and will then be detected by a photoresist. Then, an electric signal is generated that depends on the detected wavelength. Subsequently, it is necessary to set the signal reading limits between 0V and 5V. An inverting amplifier was used and the value of the input resistance (Rf) was calculated by using (1).
Where Vo is the output voltage (volts), Vi is the input voltage, and Ri is the input resistance (ohms). The photoresistor response was calibrated as follows: first, its response is measured with and without thin film, obtaining a value of Ri. Then, the gain and Ri values are substituted and the value of Rf is obtained. For example, if the thin film has a high transmittance, the energy captured by the photoresist will be high. If the cuvette has low transmittance, the energy captured by the photoresistor will be lower. The LM324 integrated circuit, which has 4 operational amplifiers inside it was used for the light detection system. This circuit is cheap and easy to get. The electronic diagram of the detection system is shown in Figure 4. For the detection system, a photoresistor was used (Figure 4-d), because it is easy to acquire in the market, it is low cost compared to other types of light detectors and has an adequate luminescent response. Figure 4 shows the electrical connection between the photoresistor and the signal amplification board in spectrophotometry equipment.

Figure 4 a) Electronic diagram. b) Experimental setup. a) LM234, b) Jack connector for power supply, c) Connectors, d) Photoresistor, e) 4.7 KΩ resistor, f) 100 Ω resistor, g) 10 KΩ resistor and h) Conditioned output signal Ao and Ai, 3) Connection diagram of the photoresistor with the signal amplification board. a) LM234, i) Diffracted light beam, k) Thin film, o) Transmittance light beam, l) Photoresist and p) Signal amplification board.
2.5 Data acquisition and processing
To reduce the cost of the spectrophotometer, the data acquisition board can only be replaced by the Atmega328P microcontroller, which can be programmed with the Arduino IDE. For data acquisition it was necessary to build an Arduino-based data acquisition board with the Atmega328P microcontroller (Figure 5-e). This is due to its simple way of programming and its low cost. The components used to assemble the data acquisition board are as follows:
(1) The FTDI232 electronic component (Figure 5-a) helps the communication between the microcontroller and the computer, (2) 0.1uF ceramic capacitor (Figure 5-b). (3) Two 22pF ceramic capacitors, necessary in the crystal connection (Figure 5-c). (4) 16MHz crystal oscillator, necessary for the operation of the microcontroller (Figure 5-d). (5) Two-terminal push-button, it has the function of restarting the microcontroller (Figure 5-f). (6) 1000 Ω resistors (Figure 5-g).
2.6 Programming the Atmega328P Microcontroller
For programming the ATmega328P microcontroller, the Arduino IDE software was used, due to its simple programming logic. In the microcontroller, the control of a stepper motor, a servo motor, and the voltage reading of the photoresistor were considered.
Figure 6 presents the programming code and consists of four parts: (a) Declaration and initiation of variables where libraries are included (Figure 6-a). (b) Establishment of the serial transmission speed and pin assignment to the variables (Figure 6-b). (c) Acquisition of voltage values by peripheral ADC and conversion of voltage values (Figure 6-c). (d) Send voltage values, SG90 servo motors ON / OFF movement conditions and stepper motor motion conditions (Figure 6-d).
2.7 Programming the Spectrophotometer Control Interface in Visual Studio
One of the most widely used programming languages is based on Visual Basic, due to its wide variety of applications [18, 19, 20]. Therefore, a simple and friendly control interface for the spectrophotometry equipment was designed. This interface is programmed in Visual Studio, which is based on Visual Basic (Figure 7), and has the following four functions: a) Automatic selector to choose the communication port between the spectrophotometer and the computer. This interface is programmed in Visual Studio, which is based on Visual Basic (Figure 7), and has the following four functions: a) Automatic selector to choose the communication port between the spectrophotometer and the computer. c) The lamp shutter prevents the passage of the light beam. d) Optionally, a stepper servo motor can be included to introduce the sample into the equipment.
The control interface is designed in a simple way, so it can be replicated by any person without deep knowledge in electronics and programming. The interface programming code is shown in Figure 8 and consists of the following parts: a) Libraries necessary to design. b) Declare variables: V1, is to store the voltage referred to the photoresistor. INFO, a variable that allows collecting and classifying the SerialPort. Count, a variable that works as a counter to store the number of times the user "Clicks" on the "+" button. ENABLED_PORTS, allows showing the COMS available on the computer and finally readPort, a variable that searches and stores the ports available on the PC. c) “SEARCH” function of the “SELECT” button, which is executed when the button is “Clicked”, searching for the available ports on the computer. d) "CONNECT" function, which is executed each time the button is "Clicked", making the connection between the microcontroller and the computer. e) "Plus_Dreeges" function of the "+" button, which is executed every time the button is "Clicked", making the increase of degrees, turning the stepper motor in a certain direction.
f) “Less_Dreeges” function of the “-” button, making the increase in degrees, turning in the opposite direction to the previous function. g) "Open_Sample" function, to write a letter "H" or "L". h) Function called "Timer_Measurements", which runs every 1000 ms, and writes to the serial port "M", capturing in a Label called "Label_V1", the value of V1. i) Function called "Open_light", which is executed every time the CheckBox changes state, to write a letter "W" or "B". j) Function "SerialPort1_DataReceived". This function is executed every time the microcontroller sends information through the serial port. The "System.IO.Ports" library was also added. k) In this part of the code the information is classified using the SerialPort, in this way the values from the microcontroller can be identified.
2.8 Cost of spectrophotometry equipment
Table 1 shows the components of each module, as well as the cost of each component and its total cost. The cost of the proposed equipment is extremely low.
Table 1 Cost of spectrophotometry equipment.
| Components | Cost [Dollars] |
| Resistance: 1M Ω and 330 Ω; LED; Ceramic capacitor 0.1uF and 22pF; 16 Mhz crystal oscillator; FTDI FT 232; Atmega 328P microcontroller; Phenolic plate; USB-Mini B cable. | $ 5.00 |
| LED 50W; Switch: Power DC Jack connector; 4-inch, 12V fan; Converter DC-DC Boost 150W 10-32V; Structure Lamp. | $ 15.00 |
| Biconvex lens; 28BYJ-478 unipolar stepper motor; ULN2003 driver; SG90 Servo motor; 5V-1A power supply. | $ 30.00 |
| SG90 Servo Motor; MDF sample holder; CILM34; Resistance 10K Ω, 4.7 K Ω and 100 Ω; Photoresist; 14-pin socket base. | $ 50.00 |
| Total Cost | $ 100.00 |
2.9 Preparation of the cuvettes
Four cuvettes with different concentrations of mezcal and ethyl alcohol were prepared. The first cuvette contains 100% mezcal - 0% ethyl alcohol, the second cuvette contains 75% mezcal - 25% ethyl alcohol, the third cuvette 25% mezcal - 75% ethyl alcohol and the fourth cuvette 0% mezcal - 100% ethyl alcohol.
Subsequently, the transmittance of each cuvette was determined using a spectrophotometer VE-5100uv from VELAB. For each transmittance spectrum, its numerical adjustment was made. Then, the transmittance of each cuvette was determined using an Arduino-based homemade spectrophotometer. Finally, each numerical fitting was compared with the values obtained with the Arduino-based spectrophotometer.
3 Results y Discussions
The response of the homemade spectrophotometer was calibrated by several correction cycles using a commercial spectrophotometer (VE-5100uv of VELAB). These consisted of comparing the transmittance spectrum obtained by the spectrophotometer VE-5100uv from VELAB and the transmittance spectrum obtained by the homemade spectrophotometer. These cycles were carried out until an absolute error of less than 5% was obtained. The cuvettes with different concentrations of artisan mezcal and ethyl alcohol were placed in the spectrophotometer (Figure 9).

Figure 9 a) Spectrophotometer VE-5100uv of VELAB, b) Measuring chamber, c) Cuvette support, d) Spectrophotometer cover, e) Cuvette with a concentration of 100% mezcal and 0% ethyl alcohol, f) Cuvette with a concentration of 75% mezcal and 25% ethyl alcohol, g) Cuvette with a concentration of 25% mezcal and 75% ethyl alcohol, h) Cuvette with a concentration of 0% mezcal and 100% ethyl alcohol.
Figure 10 shows the transmittance spectra for each concentration. The spectrum that presents the highest transmittance is associated with a concentration of 100% ethyl alcohol, then the spectrum associated with a concentration of 75% ethyl alcohol and 25% mezcal, then the spectrum associated with a concentration of 25% ethyl alcohol and 75% mezcal, and finally 0% ethyl alcohol and 100% mezcal. Therefore, as ethyl alcohol is added to a mezcal sample, its transmittance will increase and the quality of the mezcal will decrease.

Figure 10 Transmittance response of each cuvette with different mezcal-ethyl alcohol concentrations.
For each transmittance spectrum a numerical fitting was made (Figure 11). For a concentration of 25% Mezcal - 75% ethyl alcohol, the equation obtained is: Transmittance=26.329 ln (Wavelength)-69.327 with a R2=0.9072. For a concentration of 75% Mezcal - 25% ethyl alcohol, the equation obtained is: Transmittance=46.982 ln (Wavelength)-204.1 with a R2=0.9538. For a concentration of 100% Mezcal-0% ethyl alcohol, the equation obtained is: Transmittance=74.783 ln (Wavelength)-381.95 with a R2=0.9476.
A comparison between the luminescent response of the commercial spectrophotometer (VE-5100uv of VELAB) and the Arduino-based homemade spectrophotometer is shown in Figure 12. The luminescent comparison between both devices is carried out for the different concentrations. Figure 12 shows close results between both devices, making the Arduino-based spectrophotometer an ideal option to identify possible adulterations in Mezcal.
4 Conclusions
The contribution of this work focuses on showing a friendly methodology to develop a homemade spectrophotometer based on Arduino for laboratory practices. Trying to encourage teachers, students or researchers, without deep knowledge in electronics and programming, to develop their own lab equipment, avoiding high costs. Also, in this work, our research group showed a simple and step-by-step methodology to implement a low-cost spectrophotometry equipment based on Arduino. In addition, this this paper discusses in detail the automation process, the programming of the control interface and the Atmega328P microcontroller. The calibration of the equipment was carried out using a commercial spectrophotometer (VE-5100uv of VELAB). The luminescent response of the Arduino-based homemade spectrophotometer is adequate compared to the response of commercial equipment. Additionally, with the electronic elements presented in this work, it’s possible to develop complex laboratory equipment. Finally, the homemade arduino-based spectrophotometer made it possible to identify adulterated mezcal samples.









nueva página del texto (beta)









