Academic Journal of Science and Technology ISSN: 2771-3032 | Vol. 13, No. 1, 2024 210 A Portable Fiber Optic Real‐time Smartphone‐based Visible Spectrometer Liqiang Huang1, 2, * 1Fisheries College, Jimei University, Fujian Xiamen 361021, China 2Water environment and fishery resources monitoring center, Jimei University, Fujian Xiamen 361021, China * Corresponding author: hlq369@jmu.edu.cn Abstract: A portable and cost-effective smartphone spectrometer was designed and tested for colorimetric analysis. The ambient light sensor of smartphone was applied as a detector, and an external light-emitting diode (LED) was used as a light source. An optical fiber is used to connect the cuvette and the mobile phone. Additionally, an Android smartphone application was designed for automatically quantifying the spectral parameters, such as absorbance and transmittance based on transmitted light intensity detected by the smartphone ambient light sensor. Determination data can be quickly verified on the spot and be displayed immediately on the phone screen. The device was evaluated by determining malachite green samples and compared with a commercial spectrophotometer. Results showed that this device can perform well with a simple structure and low-cost. The absorbance data read by this device were as high as that of commercial device. A linear regression (R2=0.999) was achieved with a linear range(0~75mg/L) in the experiment of quantifying malachite green, with RSDs ranged from 0.12% to 0.48 %. Results demonstrated that our device showed good accuracy and stability in fast speed. With the advantages of cost-effective, user friendly and portability, this smartphone spectrometer holds great application potential in many application fields. Keywords: Smartphone, Ambient light sensor, Spectrometer. 1. Introduction As an universal analytical instrument used for quantitative analysis, spectrophotometer is widely used in many fields such as chemistry, chemical engineering, environment, medicine, etc. However many traditional spectrophotometers are bulky and expensive, and their widespread promotion and use are greatly limited. Therefore, preparing portable spectrometer currently holds great significance in being able to quantify analytes on site. Nowadays, smartphones are equipped with sensitive optical sensors that can measure parameters such as light intensity, chromaticity, and color, making them suitable for simulating portable spectrophotometer[1]-5]. Two major methods are applied in constructing smartphone spectrometers respectively depending on the sensors they used: one is to use the phone's camera sensor, and the other is to use the phone's ambient light sensor. The method of using a phone camera as sensor is to capture and take photos of the sample, then analyze and process the photos using color extraction software to extract the color values (RGB values/chromaticity values/grayscale values, etc.) of the images[6]-9]. The RGB or grayscale values of the sample images are linearly related to its concentration within a certain range, so quantitative analysis can be performed. This method can fully utilize the increasingly powerful cameras on smartphones and obtain a large amount of optical information, but it also has some strict limitations. For example, many factors such as focusing accuracy, shooting environment, shooting distance, background, etc. can have significant impact on the experimental results. Moreover, after each photo was taken, important spectral parameters such as absorbance and transmittance cannot be displayed directly. Color extraction software needs to be used to process the photo in multiple steps before the required data can be extracted from the image information, which is quite cumbersome to use. The method of using the ambient light sensor of a mobile phone can immediately obtain the digital value of the light intensity which is directly related to the sample concentration, and the environmental requirements are also lower than those of phone photography analysis method. By applying this method, the device is relatively simple and more suitable to construct a mobile phone spectrophotometer[10]-12]. The ambient light sensor(ALS) of a mobile phone is a built- in device that can sense the intensity of ambient light, usually located next to the earpiece on the front of the phone. Its function is to adjust screen backlighting according to the environment lighting where the phone is located, achieving the purpose of energy saving. Various software( such as Phyphox and etc.) of using mobile phones to detect environmental light intensity are available on line, and they can directly display the light intensity values obtained from the phone light sensor when conducting spectrophotometric experiments. Absorbance and transmittance values can be calculated subsequently from the illuminance of blank and samples. In this study, we developed a portable and cost-effective smartphone based on ambient light sensor for rapid monitoring of colorimetric assays. To verify the reliability of the smartphone spectrometer, malachite green aqueous samples were chosen as representation and analyzed. The results of the smartphone spectrometer were compared with a commercial spectrophotometer. 2. Material and Method 2.1. Materials Smartphone (Honor Note8, installed with self-made software); 723N visible spectrophotometer (Shanghai Yoke Instrument Co., Ltd.); 211 LEDs with 620 nm wavelength, 70mA operating current and 6 ° emission angle were purchased from Qiangshengda Electronics Co., Ltd (Shenzhen, China); Narrow band filter (620 nm) was purchased from Donsnow Optoelectronic Technology Co., Ltd (Shijiazhuang, China); SKD1010 Digital Lux Meter (Shunkeda Co., Ltd); MMA optical fiber with 6mm inner diameter and 8mm outer diameter(YEKE Optoelectronics Co., Ltd, Dongguan, China). 2.2. Device design and fabrication The schematic diagram of the principle of the mobile smartphone spectrometer and the finished prototype are shown in Figure 1. The light beam with a specific wavelength emitted by the LED passes through the sample cuvette, optical fiber, then enters into the light sensor of mobile phone. When needed, a filter could be placed above the light sensor. A self- designed software in the mobile phone can display the intensity value of transmitted light in real time. The base of the cuvette is 3D printed with black resin, and circular holes are opened on the opposite sides to place LED and optical fiber respectively. It is better to choose LEDs with smaller light-emitting angle, which can concentrate the light beam on a small area without using focusing lens, improve the intensity of incident light and reduce scattered light. The wavelength of light source can be changed by using LED with different wavelengths. The intensity of incident light can be adjusted by changing the resistance value of R(serving as current limiting resistance). LEDs can be easily plugged in and out to provide different wavelengths. When another kind of sample need to be detected, just replace the LED and filter. The use of optical fiber can make the installation of the device more flexible and portable. A detachable clip is used to located the optical fiber to the mobile phone. When the clip is removed, the phone can easily restore its original usage functions. Figure 1. Schematic diagram of principle and finished prototype of smartphone spectrometer There are many software based on mobile phone ambient light sensor in the mobile phone market, which can directly display the light intensity value in the form of numbers. Operator thus can record the transmitted light intensity of blank and samples, and then calculates absorbance, transmittance and other spectroscopy values according to the formula of light absorption law. To avoid manual calculation and to realize displaying result values directly on the mobile screen, we designed an Android software suitable for smartphone spectrometer using MIT App Inventor programming language. MIT App Inventor can directly control the ambient light sensor of the mobile phone through a "lights sensor" component to obtain digital values of light intensity, this makes subsequent processing very convenient. When a blank is placed and the "ZERO" key of the software is pressed, the software will automatically reads and stores the average transmitted light intensity value of the blank, automatic zero adjustment , then displaying 100%T and 0.000A for sample test. When the sample to be detected is placed, the software can display the average transmitted light intensity value, and then calculated automatically to obtain the transmittance (T) and absorbance(A) values and displayed them on the screen immediately according to the following formulas: T = Ib / Ix (1) A = -lgT (2) Ib is the average transmitted light intensity value obtained when measuring blank, and Ix is the average transmitted light intensity value obtained when measuring samples. 2.3. The detection of samples When conducting a quantitative test experiment using the smartphone spectrometer, first put in purified water as blank and press the zero key to fulfill zero adjustment, next put in the sample to be tested, wait for a few seconds, then the screen will display the illumination value, light transmittance, and absorbance. In this experiment, different concentrations of malachite green aqueous solution (0, 15, 30, 45, 60, 75 mg/L) were used as samples. The main wavelength of LED used is 622 nm, which has a considerable wavelength selectivity and can be used to detect malachite green samples with the maximum absorption wavelength around 615 nm. The accuracy and stability of the smartphone spectrometer were estimated by detecting malachite green samples with different concentrations. The results of the smartphone spectrometer were compared with a commercial 723N spectrophotometer. 3. Results and Discussion 3.1. Performance of smartphone spectrometer without filter under different LED driving current We first use the simplest device which has no equipped with filters to determine malachite green samples under different LED driving currents. Results compared with 723N spectrophotometer were showed in Fig. 2. 212 Figure 2. Curves of Concentration and Absorbance by smartphone spectrometer under different LED driving currents compared with 723N spectrophotometer The luminous intensity of LED is proportional to its driving current within its rated operating current range. The greater the current, the greater the light intensity emitted by LED, and the light sensor of smartphone spectrometer can obtain stronger illumination. However, the absorbance and the LED current are not consistent. Our experimental results show that the absorbance measured by the smartphone spectrometer tends to decrease when the driving current exceed 4mA. But at the case of 1~4mA, the absorbance values under different LED currents are almost equal. The experimental results show that when the LED currents is controlled in a suitable range, the absorbance measured by the mobile phone can be basically positively correlated with the concentration and can be used for quantitative analysis. However, if the LED driving current exceed appropriate range, the measured absorbance value will decline distinctly along with deterioration of linearity. Since the working current of the LED does not exceed its rated working current(70mA) in all the tests, we speculate that this exception is likely caused by a phone- controll threshold value, which can change the responsivity of the light sensor. 3.2. Intensity of transmitted light of smartphone spectrometer under different LED driving current In order to find the reason for the low absorbance and poor linearity at higher LED driving currents, we used a smartphone spectrometer and a commercial luminance meter to detect the transmitted light intensity of LED at different current. When using a commercial luminance meter, just change the optical fiber outlet of the smartphone spectrometer to the probe of skd1010 digital lux meter. Put in purified water and monitor the transmitted light intensity detected by the two instruments at different LED driving currents. Experiment results(Fig. 3) showed that, when the driving current of LED gradually increases from 0 to 30mA, the reading of SKD1010 digital lux meter steadily increases linearly, while the smartphone spectrometer has an inflection point at 2600 Lx. This phenomenon shows that the light intensity emitted by the LED is linearly proportional to its driving current within 0~30mA, and the inflection point at 2600 Lx should be caused by a limitation of the phone light sensor itself. The smartphone spectrometer has 2 linear working areas on both sides of the 2600 Lx inflection point. We speculate that the two areas were being divided purposely by the mobile phone manufacturers to adapt to night and daytime respectively. The ambient light is strong during the daytime(> 2600 Lx), so the sensitivity of the sensor is artificially inhibited to a lower level to prevent misoperation; at night or in a dark environment the ambient light maybe become weaker (< 2600Lx), so the sensitivity of the sensor is restored to a high level. Therefore, it is necessary to skirt this inflection point in order to ensure transmitted light intensity of all of the samples could fall into a linear region. Figure 3. Transmitted light intensity under different LED drive currents Analysis according to Fig. 2 and Fig. 3 can show that when the LED current is under 4mA, the transmitted light intensity of samples can be kept under 2600 Lx. In these cases, the linear relationship between the transmitted light intensity and the sample concentration is good, which well conforms to the Lambert Beer law. Therefore, we can draw a conclusion that for the honor note8 mobile phone, the linear range of transmitted light intensity must be kept within 2600 Lx in order to make the mobile smartphone spectrometer work normally. In addition, because the uncertainty of the results will increase significantly when the transmitted light intensity is below 5 Lx, it is best to maintain the transmitted light intensity between 5 and 2600 Lx as a practical working area. When using, first place in a blank sample, adjust the current limiting resistance to ensure that the light intensity value on the screen does not exceed 2600 Lx. Since the blank sample has the maximum transmitted light intensity, the transmitted light intensity of all of the subsequent samples can fall into the linear working area. Obviously, it can be derived that for the note8 smartphone spectrometer, the maximum effective absorbance A can be deduced as: A= -lg (5/2600) = 2.7. So when the absorbance of the sample is >2.7, the measurement error would increase. 3.3. Influence of filter Although the smartphone spectrometer without filter can work, it is found that absorbance values and sensitivity of this smartphone spectrometer are much lower than that of commercial instruments (Fig.2). We speculate that the reason may be that the spectral bandwidth of the smartphone spectrometer is too wide. Although the main wavelength of LED used in this device is 622 nm, it still has a spectrum distribution range from 590 nm to 660 nm(Fig.4). If no filter is used, the mobile phone light sensor will receive all the transmitted light within this range of 70 nm, and the final result is the total absorbance of 213 the sample within the range of 590 nm to 660 nm. According to the law of light absorption, the transmitted light intensity at the wavelength Itλ = I0·e Ɛλbc, Total intensity of transmitted light on the sensor It´ =  Itλ = I0·e Ɛλbc, measured absorbance A= lgT = lg(It´/I0 ) = lg(I0·e Ɛλbc /I0 ) = lg( e Ɛλbc). However, it is obvious that at wavelengths other than the maximum absorption wavelength of 615 nm, the molar absorption coefficient Ɛ λ is always lower than that at 615 nm, eventually the absorbance read by this smartphone spectrometer will be always lower than that measured by a commercial spectrophotometer at 615 nm. Therefore, in order to improve the measured value of absorbance and make it close to the true value, we must try to enhance the monochromaticity of the light source, narrow the wavelength distribution range of the light source, and reduce the spectral band width of the incident light. Here we improve the device by covering the surface of smartphone light sensor with a piece of 615 nm narrow-band filter(Fig.4). It must be noted that due to the obstruction of the filter, the LED driving current must be appropriately adjusted to make the transmitted light intensity maintain between 5 and 2600 Lx, ensuring both the linear range and a wide concentration measurement range. Figure 4. Spectral range of LED(622nm) and filter(615nm) used in the study Figure 5. Measurement results of smartphone spectrometer (with filter) compared with 723N spectrophotometer After adding the filter, the absorbance of the smartphone spectrometer was significantly improved, indicating that the sensitivity of the instrument was significantly promoted (Fig. 5). The working curve equation of smartphone spectrometer is A = 0.036Cx - 0.022 (R2 = 0.999, Cx is in mg/L), while the working curve equation of 723N spectrophotometer is A = 0.032Cx + 0.048 (R2 = 0.995). The similar slopes mean that both of the two devices have the same detection sensitivity when detecting malachite green. The absorbance values of the smartphone spectrometer are quite close to that of commercial instrument, even performs well when A>2.0. Therefore, using of filter can effectively increase the absorbance value and make it closer to the results of commercial instruments. Results also reveal that strong linear regression (R2 = 0.999) analysis with a linear range(0 ~75 mg/L) were found for this smartphone spectrometer, and the detection limit(3 σ/S) of 0.066 mg/L for malachite green was achieved from determination of pure water(n =11). This device also had high repeatability that ranged from 0.12 % to 0.48 % RSD. In the process of 11 times consecutive measurements of a 30 mg/L malachite green sample, the RSD was acquired as 0.18%, which means that the device has good precision. All the results demonstrated that our device showed good accuracy and stability. 4. Conclusion In this study, we developed a low-cost smartphone spectrometer device and explored the suitable operate parameters in determination. The results demonstrate our device was highly stable and accurate to perform liquid colorimetric rapid assays, and there were no significant differences between our device readouts compared with a professional spectrophotometer when detecting malachite green. Due to the advantages of cost-effective, user friendly and easy manufacturing, this smartphone spectrometer has excellent potential to be a widely used rapid colorimetric instrument in many occasions, such as water quality monitoring, agricultural residue detection, food safety testing and environmental analyses. References [1] Shogah, Z.A., Bolshakov, D.S. & Amelin, V.G. Using Smartphones in Chemical Analysis. J Anal Chem 78, 426–449 (2023). https://doi.org/10.1134/S1061934823030139. [2] Tobiszewski, M., Vakh, C. Analytical applications of smartphones for agricultural soil analysis. Anal Bioanal Chem 415, 3703–3715 (2023). https://doi.org/10.1007/s00216-023- 04558-1. [3] Yumnam, M., Gopalakrishnan, K., Dhua, S. et al. A Comprehensive Review on Smartphone-Based Sensor for Fish Spoilage Analysis: Applications and Limitations. Food Bioprocess Technol (2024). https://doi.org/10.1007/ s11947- 024-03391-3. [4] Suvardhan Kanchi, Myalowenkosi I. Sabela, Phumlane Selby Mdluli, Inamuddin, Krishna Bisetty. Smartphone based bioanalytical and diagnosis applications: A review. Biosensors and Bioelectronics102, 136-149(2018). https://doi.org/ 10.1016/ j.bios.2017.11.021. [5] Kaja Kalinowska, Wojciech Wojnowski, Marek Tobiszewski. Smartphones as tools for equitable food quality assessment. Trends in Food Science & Technology 111, 271-279(2021). https://doi.org/ 10.1016/ j.tifs.2021.02.068. [6] Miguel Ángel Aguirre, Kenneth D. Long, Antonio Canals, Brian T. Cunningham. Point-of-use detection of ascorbic acid using a spectrometric smartphone-based system, Food 214 Chemistry 272, 141-147(2019). https://doi.org/10.1016/ j.foodchem.2018.08.002. [7] Álvarez-Bermejo, J.A., Morales-Santos, D.P., Castillo- Morales, E. et al. Efficient image-based analysis of fruit surfaces using CCD cameras and smartphones. J Supercomput 75, 1026–1037 (2019). https://doi.org/10.1007/s11227-018- 2284-y. [8] Khachornsakkul, K., Dungchai, W. A Portable Reflective Absorbance Spectrophotometric Smartphone Device for the Rapid and Highly Accurate Determination of Amlodipine in Pharmaceutical Formulation and Human Urine Samples. ANAL. SCI. 37, 963–969 (2021). https://doi.org/10.2116/ analsci.20P349. [9] Kubacki, K., Mermer, K., Paluch, J. et al. Spectrofluorimetric and smartphone-based detection methods for determination of gentamicin. Monatsh Chem 155, 899–909 (2024). https://doi.org/ 10.1007/s00706-024-03244-x. [10] Chen, Y., Fu, Q., Li, D. et al. A smartphone colorimetric reader integrated with an ambient light sensor and a 3D printed attachment for on-site detection of zearalenone. Anal Bioanal Chem 409, 6567–6574 (2017). https://doi.org/10.1007/ s00216-017-0605-2. [11] Abd-ElSalam, HA.H., Saleh, G.N.N., Waked, K.G. et al. A miniaturized, portable, cost-effective photometer with a smartphone detector as a demonstrative model for measuring the total phenolic content of some nutraceuticals. Chem. Pap. 78, 6607–6615 (2024). https://doi.org/ 10.1007/s11696-024- 03560-w. [12] Q. Fu, C. Zhang, J. Xie, Z. Li, L. Qu, X. Cai, H. Ouyang, Y. Song, D. Du, Y. Lin, Y. Tang. Ambient light sensor based colorimetric dipstick reader for rapid monitoring organophosphate pesticides on a smart phone, Anal. Chim. Acta 1092, 126–131 (2019). https://doi.org/10.1016/j.aca.2019.09.059.