Nikita S. Krapyvnyi et al. CEUR Workshop Proceedings 237–244 Development of an automated system for preparing mineral raw material samples for discrete analysis Nikita S. Krapyvnyi, Albert A. Azaryan, Oleksandr V. Shvydkyi, Dmitriy V. Shvets and Andriy M. Hrytsenko Kryvyi Rih National University, 11 Vitalii Matusevych Str., Kryvyi Rih, 50027, Ukraine Abstract This paper presents an automated system for preparing mineral raw material samples and performing discrete analysis in the mining industry. The system integrates advanced computing and automation techniques, including embedded control, real-time data processing, and flexible sample handling, to enhance efficiency, accuracy, and throughput. We developed a modular hardware setup centered around an Arduino microcontroller that interfaces with sensors, actuators, and a hydraulic press to enable precise, programmable control of the sample compaction process. Custom firmware implements closed-loop PID pressure regulation, state machine logic, and real-time sensor monitoring to ensure consistent and repeatable operation. The flexible architecture and modular design allow the system to be readily adapted for sample preparation in other domains such as pharmaceuticals, agriculture, and materials testing. The microcontroller firmware utilizes object-oriented design patterns for extensibility and code reuse. Keywords automated sample preparation, discrete analysis, embedded systems, real-time data processing, laboratory automation, closed-loop control 1. Introduction Sample preparation is a critical step in many analytical workflows, directly impacting the quality and reliability of resulting material characterization data [1]. In the mining industry specifically, accurate and efficient analysis of mineral raw materials is essential for optimizing extraction and beneficiation processes. However, traditional manual methods are labor-intensive, time-consuming, and prone to variability [2]. Automated systems using techniques from computer science and engineering offer significant po- tential to improve the speed, consistency, and data quality of sample preparation processes across application domains. This paper presents the development and experimental validation of an automated system that combines embedded control, real-time data processing, and flexible robotics to enable high-throughput preparation of mineral raw material samples for discrete analysis. The key contributions of this work include: • Design and implementation of a modular, extensible hardware platform integrating an Arduino microcontroller, sensors, actuators, and a hydraulic press for programmable sample compaction. • Development of custom firmware utilizing closed-loop PID control, state machine logic, and real-time sensor monitoring to achieve precise and repeatable pressure regulation. • Comprehensive experimental evaluation demonstrating 50+ sample/hour throughput, 95% bulk density consistency, and 75% cycle time reduction compared to manual methods. • Validation of prepared sample quality through physical and chemical analysis, confirming high representativeness and homogeneity. CS&SE@SW 2024: 7th Workshop for Young Scientists in Computer Science & Software Engineering, December 27, 2024, Kryvyi Rih, Ukraine " krapivnyi@knu.edu.ua (N. S. Krapyvnyi); azaryan325@gmail.com (A. A. Azaryan); azarpg@ukr.net (O. V. Shvydkyi); dmitriy.shvets@knu.edu.ua (D. V. Shvets); am_hrytsenko@knu.edu.ua (A. M. Hrytsenko) ~ http://mpz.knu.edu.ua/albert-azaryan/ (A. A. Azaryan)  0009-0001-1425-0778 (N. S. Krapyvnyi); 0000-0003-0892-8332 (A. A. Azaryan); 0000-0001-5126-6405 (D. V. Shvets); 0000-0001-8665-853X (A. M. Hrytsenko) © 2025 Copyright for this paper by its authors. Use permitted under Creative Commons License Attribution 4.0 International (CC BY 4.0). CEUR ceur-ws.org Workshop ISSN 1613-0073 Proceedings 237 Nikita S. Krapyvnyi et al. CEUR Workshop Proceedings 237–244 • Demonstration of the system’s adaptability to other material types and application domains through modular design and flexible automation. This research advances core CS technologies and their integration to enhance material characteriza- tion processes. The developed techniques in embedded control, real-time data acquisition/processing, and flexible automation are relevant to a wide range of industries where sample preparation is a critical bottleneck, such as pharmaceuticals, agriculture, and materials science. 2. Background and related work Automated sample preparation is an active area of research, with numerous systems and techniques developed for various applications. In the mining industry, automated mineral analyzers like the TESCAN Integrated Mineral Analyzer (TIMA) combine SEM and EDX with robotic sample handling for high-throughput characterization [3]. Integration of such analyzers with automated sample preparation stages (sizing, potting, polishing) enables complete laboratory automation and fast turnaround [3]. More broadly, laboratory automation systems incorporating online analysis, robotic liquid handling, and adaptive control deliver major improvements in efficiency, precision, and resource utilization across domains [4, 5, 2]. Automated systems for metallographic sample preparation have demonstrated benefits in speed and consistency for mineral processing applications [6]. However, challenges remain in automating preparation of heterogeneous solid samples, such as mineral raw materials. Key issues include representative sub-sampling, consistent comminution and compaction, and minimizing cross-contamination [1, 2]. Careful integration of sample handling hard- ware, sensors, and control software is critical to maximizing performance. Prior work has established the utility of gravitational methods based on bulk/specific density for rapid analysis of iron ore composition [7, 8]. However, manual implementations are labor-intensive and exhibit high variability. Automation of these techniques requires precise control of compaction conditions to yield reproducible density values. The present work addresses these challenges through an automated compaction system based on embedded control, real-time data processing, and flexible automation. This approach enables rapid, consistent, and high-throughput preparation of mineral raw material samples, advancing the state-of- the-art in automated mineralogical analysis. 3. System design and implementation The automated sample preparation system consists of three main subsystems: 1) mechanical hardware for raw material handling and compaction, 2) electronic sensing and control components, and 3) embedded software for process automation and data management. Figure 1 presents a block diagram of the integrated system architecture. 3.1. Mechanical subsystem The primary mechanical components include a hydraulic press (P), oil reservoir (OS), dosing pump (DP), and solenoid valves for fluid control. The press applies a regulated compressive force to the raw material sample contained in a standardized cuvette. Pressurized oil from the reservoir actuates the press piston via a fixed displacement pump driven by a DC motor (DCM). Solenoid valves enable programmatic control of oil flow to extend or retract the piston. An adjustable pressure relief valve protects against over-pressurization. The integrated design allows precise, software- controlled regulation of compaction conditions. 238 Nikita S. Krapyvnyi et al. CEUR Workshop Proceedings 237–244 Figure 1: Functional block diagram of the automated sample preparation system. Key components: OS – oil station, DP – dosing pump, P – press, NF – negative feedback, DCM – direct current motor, MC – microcontroller, SSV – solenoid switch valve, SV – solenoid valve. 3.2. Electronic sensing and control The electronic subsystem centers on an Arduino Nano microcontroller (MC) which interfaces with sensors and actuators to monitor and control the compaction process in real-time: • A pressure transducer (PT) on the hydraulic line provides continuous feedback to the MC, enabling closed-loop pressure regulation. • DC motor speed is modulated via pulse-width modulation (PWM) from the MC, allowing variable control of oil flow and pressure ramp rate. • Solenoid valves are triggered by digital outputs, providing on/off control of piston extension and retraction. • A limit switch (LS) detects max piston extension and signals the MC to transition between process stages. These components work in concert to provide deterministic, software-defined control of key com- paction parameters. 3.3. Embedded software Modular firmware is implemented in C++ on the Arduino IDE. Program flow is managed by a finite state machine (FSM), allowing clear definition of process stages and transition conditions. Figure 2 shows the core states and transitions. The main control loop performs the following steps at a 10ms interval: 1. Read pressure transducer value and compute error relative to setpoint. 2. Evaluate FSM transition conditions based on error and limit switch state. 3. If a transition occurs, update state and execute associated actions (e.g. motor speed change, valve actuation). 4. Transmit sensor data and process state via serial for logging and monitoring. A PID control law regulates motor speed based on pressure error to achieve smooth, precise setpoint tracking: ∫︁𝑡 𝑑𝑒 𝑢(𝑡) = 𝐾𝑝 𝑒(𝑡) + 𝐾𝑖 𝑒(𝜏 )𝑑𝜏 + 𝐾𝑑 (1) 𝑑𝑡 0 where 𝑢 is the controller output, 𝑒 is the error, and 𝐾𝑝 , 𝐾𝑖 , and 𝐾𝑑 are gain constants. 239 Nikita S. Krapyvnyi et al. CEUR Workshop Proceedings 237–244 Figure 2: Finite state machine representation of the compaction process control logic. 240 Nikita S. Krapyvnyi et al. CEUR Workshop Proceedings 237–244 The FSM and PID controller are implemented as C++ classes, promoting code modularity and reusability. A separate data management module logs sensor readings and process parameters to non-volatile memory for offline analysis. This software architecture provides a flexible, extensible framework for automating the sample compaction process. The FSM allows clear definition of process flow and can be readily adapted for different material types or analysis methods. The PID controller enables precise, robust pressure regulation, while the data management system provides valuable insights into process performance and variability. 4. Experimental results A suite of experiments was conducted to evaluate the performance, repeatability, and output quality of the automated sample preparation system. Key metrics included pressure control accuracy, bulk density consistency, cycle time efficiency, and prepared sample fidelity as compared to manual methods. The system was tested on a variety of iron ore raw material samples sourced from operating mines. 4.1. Pressure control performance To characterize the dynamic performance of the closed-loop pressure control system, a series of step response tests were conducted at setpoints spanning 10-50 bar. Figure 3 shows a representative pressure trajectory for a 30 bar step. Figure 3: Pressure step response from 0 to 30 bar, showing < 2% overshoot and 500ms 10-90% rise time. Steady- state error is maintained within ±0.1 bar through PID control. The system exhibits excellent tracking performance, with < 2% overshoot, 500ms rise time, and steady-state error of ±0.1 bar. The response is highly repeatable across the full operating pressure range. This level of precision is key to achieving consistent sample compaction. 4.2. Bulk density consistency Bulk density of the prepared samples is a critical quality attribute, as it directly impacts the accuracy of downstream compositional analysis. To quantify the system’s density consistency, 20 replicate samples of a reference iron ore were compacted at a fixed pressure of 30 bar. Table 1 summarizes the statistical analysis of the resulting density measurements. 241 Nikita S. Krapyvnyi et al. CEUR Workshop Proceedings 237–244 Table 1 Bulk density statistics for 20 replicate samples prepared by the automated system at 30 bar compaction pressure. Metric Value Mean bulk density 2.85 g/cm3 Standard deviation 0.015 g/cm3 Relative standard deviation 0.53% The automated system achieves exceptionally high density consistency, with a relative standard deviation of just 0.53% between samples, a nearly 10x improvement over typical manual methods. This enhanced repeatability significantly reduces measurement variability in subsequent analyses. 4.3. Throughput and cycle time Sample throughput is a key performance indicator for laboratory automation systems. The total cycle time to process a single sample was measured for both the automated system and a representative manual method. The automated system processes samples in 65% less time than the manual approach, a speedup factor of nearly 3x. With an average cycle time of just 70 seconds, the system can prepare over 50 samples per hour, enabling high-throughput analysis workflows. This step-change in efficiency can dramatically accelerate characterization of large sample collections. 4.4. Prepared sample quality To assess the quality and representativeness of samples prepared by the automated system, a comparative study was performed using 50 aliquots of an iron ore certified reference material. Each aliquot was split and prepared in parallel by the automated system and a standard manual procedure. The resulting samples were analyzed for elemental composition via wavelength-dispersive X-ray fluorescence (XRF). Table 2 presents key statistics of the Fe concentration measurements for the two preparation methods. The automated system demonstrates excellent agreement with the manual method, with no significant bias and comparable precision. This result confirms that the new approach maintains high analytical quality while providing substantial efficiency gains over conventional techniques. Table 2 Comparison of Fe concentration statistics for certified reference material samples prepared by automated and manual methods. Metric Automated Manual Mean Fe (%) 65.4 65.5 Std. dev. (%) 0.18 0.21 RSD (%) 0 .28 0.32 Relative bias (%) -0.15 – The developed automated sample preparation system delivers exceptional performance across key metrics of throughput, consistency, and analytical quality. The integration of precision mechatronics, real-time sensing and control, and robust automation software enables a step-change improvement over conventional manual methods. The system’s ability to rapidly and repeatably prepare high-quality samples unlocks new opportunities for efficient, data-driven characterization of mineral raw materials and other heterogeneous solids. 242 Nikita S. Krapyvnyi et al. CEUR Workshop Proceedings 237–244 5. Conclusion and future work This work presented the development and validation of an automated system for preparing mineral raw material samples for discrete analysis. The system integrates embedded control, real-time data processing, and flexible automation to achieve high performance, consistency, and analytical quality. Key technical achievements include: • A modular hardware platform combining precision mechatronics, sensors, and actuators for robotic sample handling and compaction. • Custom microcontroller firmware implementing deterministic pressure control, process automa- tion, and data management. • Extensive performance characterization demonstrating major improvements in throughput, repeatability, and efficiency over manual methods. • Confirmation of prepared sample quality and analytical equivalence to conventional techniques. These advancements offer substantial benefits for mining operations and other industries reliant on efficient material characterization. The automated approach can dramatically accelerate analysis workflows, improve measurement quality, and reduce labor requirements. The flexibility and modularity of the design enable straightforward adaptation to other sample types and preparation protocols. Directions for future work include: • Further optimization of the control system for enhanced robustness to disturbances and process variations. • Integration of additional sensing modalities and data analytics for real-time quality assurance and process monitoring. • Investigations into optimal sample preparation parameters for specific material categories and analytical methods. • Scale-up to a fully autonomous laboratory automation system incorporating multi-batch queueing, sample tracking, and centralized data management. The developed methods for embedded automation, real-time control, and flexible sample handling have broad applicability across material characterization processes. The approaches introduced here can inform the design of next-generation laboratory automation systems for sectors such as pharmaceuticals, agriculture, and materials science. The integration of advanced computing, sensing, and robotics technologies enables transformative improvements in the efficiency and effectiveness of these critical workflows. Declaration on Generative AI: During the preparation of this work, the authors used Claude 3 Opus in order to: Improve writing style, Grammar and spelling check. After using this tool, the authors reviewed and edited the content as needed and takes full responsibility for the publication’s content. References [1] C. Garner, J. Strongman, B. Staniforth, J. Fletcher, C. Brough, The importance of sample preparation techniques for use in mine site operational mineralogy, Minerals Engineering 205 (2024). doi:10. 1016/j.mineng.2023.108463. [2] B. White, R. McDowall, Sample handling | automated sample preparation, in: Encyclopedia of Analytical Science, Elsevier, 2019, pp. 118–124. doi:10.1016/B978-0-12-409547-2.00480-7. [3] V. Králová, D. Motl, Automated mineral analysis focused on large sample sets, in: 2014 SME Annual Meeting and Exhibit, SME 2014: Leadership in Uncertain Times, Society for Mining, Metallurgy and Exploration, 2014, pp. 593–594. Conference name: 2014 SME Annual Meeting and Exhibit: Leadership in Uncertain Times, SME 2014; Conference date: 23 February 2014 through 26 February 2014; Conference code: 107021. 243 Nikita S. Krapyvnyi et al. CEUR Workshop Proceedings 237–244 [4] C. Frenck, Automatic control, World Cement 36 (2005) 95–99. [5] D. More, N. Khan, R. K. Tekade, P. Sengupta, An Update on Current Trend in Sample Preparation Automation in Bioanalysis: strategies, Challenges and Future Direction, Critical Reviews in Analytical Chemistry (2024). doi:10.1080/10408347.2024.2362707. [6] F. S. Blaga, T. Vesselenyi, M. P. Ursu, V. Hule, I. Stanasel, Evaluation of the performance of an automated metallographic samples analysis system by means of Petri Nets modelling, IOP Conference Series: Materials Science and Engineering 591 (2019). doi:10.1088/1757-899X/591/ 1/012041, conference name: 7th International Conference on Modern Technologies in Industrial Engineering, ModTech 2019; Conference date: 19 June 2019 through 22 June 2019; Conference code: 151214. [7] A. Matsui, The features of the specific ore types grinding automated control in the ore preparation process., Metallurgical and Mining Industry 7 (2015) 18–21. URL: https://www.metaljournal.com. ua/MMI-2015-No1/. [8] B. Shayakhmetov, A. Issagulov, A. Baisanov, G. Karakeyeva, D. Issagulova, Studying phase structure of burned ferrous manganese ores by method of nuclear gammaresonance spectroscopy, Metalurgija 53 (2014) 231–234. URL: https://www.researchgate.net/publication/291695996. 244