## 4 Discussion  
This study represents a significant exploration into the integration of multi-spectral sensors and machine learning algorithms for the rapid and accurate detection of milk components. The dairy industry increasingly demands such innovative technologies to accelerate and enhance the accuracy of quality control processes. In this context, the XGBoost algorithm utilized in our study has enabled a portable device to accurately predict the protein and fat content of milk samples. This technology allows for the on-site and rapid analysis of milk components, offering significant advantages in quality control processes and production efficiency. Our findings indicate that the processing of spectral data and the application of machine learning algorithms provide high accuracy in predicting milk components. In particular, the superior performance of the XGBoost model demonstrates its ability to produce accurate and reliable results. These results are considered a significant advancement when compared to similar studies in the current literature [12, 13]. Furthermore, mid-infrared spectroscopy (MIR) has been widely recognized for its potential in detecting adulterants and contaminants in milk, which aligns with our study's focus on quality control enhancements [14, 15]. Figure 10: Data transmission using the MQTT protocol. Figure 9: Data readings during the learning phase. The working principle of the AS7265x involves directing light towards the sample and the sensor detecting the reflected or transmitted light, converting it into spectral data. These data contain valuable information about the physical and chemical properties of the milk and are subsequently processed by the microcontroller. The sensor communicates with the microcontroller via I2C and UART interfaces, ensuring fast and reliable data transfer. In conclusion, the AS7265x sensor provides precise and reliable spectral measurements necessary for milk analysis, playing a crucial role as one of the fundamental components of the edge sensor node. The design of this sensor measurement point is critically important for achieving high accuracy in the chemical component analyses of milk. The positioning and protection of the sensor form the basis of quality control processes in the dairy industry, making this structure one of the most significant features of the edge sensor node. This process demonstrates the device's capability to continuously collect and analyze data from milk samples, significantly contributing to real-time decision-making processes in the dairy industry. Additionally, the integration of machine learning models further supports real-time analytics and decision-making [11]. Compatibility with various devices is another critical feature of the edge gateway. It can operate on microcontroller platforms like ESP32 or mobile devices that are capable of collecting data over Bluetooth and transmitting data over WiFi. The gateway can also detect messages from different Bluetooth devices and transmit these data under relevant topic headers. This flexibility allows the system to operate effectively in multi-device environments. In conclusion, the edge gateway plays a vital role in the data collection and transmission process. It captures Bluetooth messages and transmits them as MQTT messages over WiFi, contributing to secure, effective, and timely data distribution. This process is a crucial component for real-time decision-making and data analytics in critical applications such as the dairy industry. Despite these advancements, this study has certain limitations that should be considered when interpreting the findings. Firstly, the dataset used in this study is limited to milk samples from a single geographical region and does not cover the full diversity of milk types found globally. This may restrict the model's generalizability across different environmental and dietary conditions, which can influence milk composition.