Open Access
yanshiju@usst.edu.cnThe developed device reduces manpower and time consumption, improving staining efficiency in digestive endoscopy centers.
It has a compact design with minimal contamination to the operating environment.
The developed device demonstrates excellent staining performance and has been recognized by clinicians.
Open Access
yanshiju@usst.edu.cnThe developed device reduces manpower and time consumption, improving staining efficiency in digestive endoscopy centers.
It has a compact design with minimal contamination to the operating environment.
The developed device demonstrates excellent staining performance and has been recognized by clinicians.
Objective: To develop an automated staining device addressing the issues of cumbersome operation, low efficiency, and cluttered workspace associated with current clinical rapid on-site evaluation using Diff-Quik staining for aspiration specimen cytological smears. Methods: The device integrates a microcontroller to control motors, peristaltic pumps, solenoid valves, and fans, enabling the automatic transfer of cytological slides, delivery of staining and rinsing solutions, and forced-air drying. Results: Preliminary test results indicated that the developed device successfully performs four key steps, including Diff-Quik A and B staining, rinsing, and drying, achieving automatic staining of cytological smears. Conclusion: The developed device features a compact footprint and has no pollution to the operating environment, offering a practical solution for automated, efficient, and convenient slide staining during rapid on-site evaluation procedures.
In 2022, pancreatic cancer accounted for approximately 511,000 new cases and 467,000 deaths worldwide. It remains one of the most lethal malignancies, ranking sixth in cancer-related mortality, contributing to nearly 5% of all cancer deaths worldwide. The mortality rate of pancreatic cancer has remained stable in many countries, including those in the European Union, over the last decades. As mortality from other cancers, such as lung cancer, colorectal cancer, prostate cancer, breast cancer and gastric cancer, continues to decline, the public health burden of pancreatic cancer has increased [1, 2]. Over one-third of pancreatic cancer cases from 1990 to 2019 were associated with the digestive system [3].
For the diagnosis of pancreatic and other digestive tract lesions, endoscopic ultrasound-guided fine-needle aspiration/biopsy (EUS-FNA/B) has become a widely accepted and effective technique [4-6]. EUS-FNA/B enables real-time, ultrasound-guided needle puncture to obtain specimens from target lesions, offering advantages of minimal trauma, rapid recovery, and low cost [7].
During EUS-FNA/B procedures, Rapid On-Site Evaluation (ROSE) facilitates pathologists to quickly assess the adequacy and diagnostic value of collected specimens, which is particularly crucial for less experienced operators and centers with lower diagnostic yields. In current clinical practices, ROSE is typically performed using Diff-Quik staining, a rapid staining method evolved from Wright’s stain and is commonly applied in cytological evaluations. Diff-Quik staining offers a quick turnaround time and produces clear background staining, aiding in accurate visualization of cellular morphology and structure [8, 9]. Through Diff-Quik staining, pathologists can preliminarily determine whether aspirated specimens is representative of the lesion and evaluate its pathological properties [10].
Currently, the Diff-Quik staining process is manually operated by medical personnel (Figure 1). Manual operations, including smear preparation, fixation, staining, and rinsing, have several drawbacks: 1. Low efficiency, long time consumption, and significant physical workload; 2. Space occupation by equipment and tools, along with environmental disruption caused by manual dripping of dye solution and rinsing under running water; and 3. High demand for experience and skills.


These challenges highlight an urgent clinical need for an automated cytological smear processing device to enhance staining efficiency, reduce environmental contamination, and enhance the practicality of Rose in routine workflows.
In this study, we developed an automated cytological smear staining device for ROSE. This device is capable of independently executing four core processes - Diff-Quik A and B staining, rinsing, and air drying, and is equipped with safety features such as emergency stop and power-off restart to ensure reliable operation and minimize potential losses in clinical settings.
2.1 Overall scheme design
The developed cytological smear staining device is based on the STM32G432RBT6 microcontroller and integrates multiple functional units, such as LCD display, control buttons, stepper motors, a peristaltic pump, and solenoid valves. The schematic diagram of the device composition is shown in Figure 2.


Figure 2. Structure of the smear carrier and its base. (A) Main view of the structure; (B) Side view of the structure; (C) Physical prototype of the structure. 1: gear 1, 2: rack fixedly connected below the carrier, 3: gear 3, 4: guideway, 5: gear.
2.2 Mechanical structure design
2.2.1 Design of carrier motion mechanism
The mechanical structure of the device was designed using SolidWorks. As shown in Figure 3, the carrier motion mechanism is essentially a two-degree-of-freedom variable pivot rotation system [11]. In this design, the carrier supports cytological smear slides and performs two types of motion: translation and rotation. The translation is achieved using a gear-rack mechanism, which converts the rotational motion of a motor into linear movement of the carrier. The rotation is achieved through a gear mechanism, which converts the rotational motion of the motor into the tilting motion of the carrier. The motion transmission routes are as follows:


Translation: The output shaft of the translation motor is fixed to gear 1, which engages with rack 2. Rack 2, rigidly attached beneath the carrier, moves linearly, driving the carrier along the horizontal axis. During linear motion, gear 3 remains stationary, and its flattened upper surface remains in contact with the bottom of the moving carrier, allowing relative motion between the carrier and gear 3.
Rotation: The output shaft of the rotation motor is fixed to gear 5, which meshes with gear 3. When gear 3 rotates, it induces a tilting motion in the carrier. During this process, the bottom of the carrier maintains contact with the flattened upper part of gear 3, but no relative motion occurs between them.
To avoid mechanical interference between translation and rotation, gear 1 and gear 3 are designed to be coaxial.
The base of the carrier is made of steel to ensure sufficient load-bearing capacity. Two stepper motors and all associated gears are mounted on this base. The output shaft of each motors is connected to its relevant driving gear by a key. After receiving the motion command from the upper computer, the microcontroller activates the translation motor, driving the carrier to undergo horizontal linear movement. Once the carrier reaches the specified position, the rotation motor is activated to tilt the carrier. Simultaneously, the peristaltic pump operates during the translation phase to deliver staining or rinsing solution. During the tilting phase, the peristaltic pump stops working to drain residual staining or rinsing solution, preventing cross-contamination and ensuring staining quality.
2.2.2 Design of the liquid pathway


2.3 Component selection and software design
2.3.1 Component selection
In this study, Altium Designer was used to design the circuit schematic and Printed Circuit Board layout. The electronic control system of the developed automated smear staining device consists of several functional modules, including the main control module, stepper motor module, peristaltic pump module, solenoid valve control module, LCD display module, EEPROM storage module, button input module, and power supply module.
In the main control module, a STM32G431 chip is used for overall system control and data processing. This microcontroller offers a stable development environment and an extensive set of peripheral modules, enabling seamless integration with external hardware components.
In the stepper motor module, a type 57 stepper motor paired with a DM556 stepper motor driver was selected [12-14]. The stepper motor provides a holding torque of 2.4 N·m, which is sufficient to support stable movement of the carrier.
For the peristaltic pump module, a 304 K peristaltic pump driven by a JBT-BM controller was used [15, 16]. The pump operates at a rotation speed of 300 r/min and is compatible with #24 tubing. The flow rate of the pump is set at 1000 ml/min, which is sufficient for the delivery of dye solution and rinsing water.
For the solenoid valve module, a normally closed, direct-acting solenoid valve operating at DC 24 V was selected [17, 18]. The pressure range of this solenoid valve is 0-0.2 MPa. Its opening and closing are controlled via a three-way relay module.
In this device, a TFT-LCD screen is incorporated to display real-time information related to staining process and stepper motor positioning, especially for emergency detection and failure handling [19]. This LCD screen operates at 5 V and is capable of displaying 10 lines of information simultaneously, with a maximum of 16 characters per line. The LCD screen features a backlight with a working voltage of 4.5 to 5.5 V, ensuring clear display even under low-light conditions.
To prevent parameter loss and reset difficulties in the event of a power outage, the system stores the stepper motor position in real time. A 2K-bit EEPROM (AT24C02) was selected for this purpose [20]. The EEPROM operates independently of program space and achieves data reading and writing through Inter-Integrated Circuit communication technology, ensuring safe data storage in case of a power outage.
The button module enables user interaction and manual intervention during the staining process. Each button is connected to GPIO port on the microcontroller, ensuring efficient hardware wiring and convenient software processing.
Specifically, buttons B1, B2, B3, and B4 are connected to pins PB0, PB1, PB2, and PA0 of the microcontroller, respectively. B1 initiates the staining processes, B2 confirms smear placement, B3 confirms smear removal, and B4 has dual functions - short press for emergency stop and long press for execution mode switching. Once the system is powered on, the microcontroller continuously scans the button states. When a button is pressed, the corresponding program is executed promptly.
2.3.2 Software design
The software program was developed using the Keil uVision5 platform from Keil Corporation. Software control is the key to stable and coordinated operation of all functional modules. The control system includes subprograms, such as the main program, stepper motor driver, peristaltic pump controller, storage program, button interaction program, and solenoid valve controller. As shown in Figure 5, the program first performs initialization of all modules after startup. Then, the operating mode of the device is selected and controlled via physical button inputs. During the staining process, the LCD display module continuously displays the current operational stage in real time.


The button control program plays a central role in realizing in realizing human-machine interaction, enabling manual setting and adjustment of the device’s operational state.
The function update_Key_Status () is responsible for real-time button status updates. It is embedded in the system tick handler SysTick_Handler (), ensuring continuous scanning of button states after the system is powered on. Once a button press is detected, the corresponding task program is executed immediately.
The output I/O ports of the microcontroller are connected to the control signal terminals of the DM556 driver: pulse (PUL)+, PUL-, direction (DIR)+, DIR-, enable+, and enable-. The PUL and DIR signals are used to control the motor’s motion and direction, while the enable signals control motor activation. In order to prevent interference caused by the simultaneous operation of two motors, the translation motor is given higher control priority than the rotation motor during execution.
The control program for peristaltic pumps is relatively simple. By configuring the GPIO ports responsible for the pump’s power and direction, the microcontroller can initiate or terminate the fluid delivery process as required.
Three relays are used to control the corresponding solenoid valves. To prevent malfunctions caused by negative pressure during valve operation, an LED status indicator is incorporated to display real-time operational condition of the peristaltic pump.
In the storage program, Inter-Integrated Circuit bus is used for data communication. The Inter-Integrated Circuit bus protocol includes five basic data transmission modes. In this device, Current Address Read mode is applied for reading, and Byte Write mode is used for data writing [21].
The LCD display program is designed to provide real-time feedback on device status. In parameter setting mode, the LCD displays the configured operating speed of the stepper motor. In dyeing mode, it displays the current dyeing step, the remaining time for that step, and relevant user operation information.
Upon system startup, all modules undergo initialization. Subsequently, the smear staining process is initiated, and the LCD displays operation instructions simultaneously. In standby mode, the buttons are continuously monitored, and the staining process will be activated after the user responds. The stepper motor drives the platform to execute translation and rotation, the peristaltic pump to supply liquid, and the relay-controlled solenoid valves to switch the dye solution.
The flow of the staining process is shown in Figure 6.


Upon startup, all modules are initialized and enters a standby state, waiting for subsequent commands (button B1);
1. Once button B1 is pressed, the staining process starts. The microcontroller controls the stepper motor to move the carrier to the front access window, allowing users to open the device and load cytological smears onto the carrier. The control system then waits for the staining initiation command (button B2);
2. After the smears are loaded and button B2 is pressed, the carrier is moved to the rear position directly below the dropper. The peristaltic pump and the solenoid valve for staining solution A are activated;
3. The dropper begins dispensing staining solution A, while the carrier moves forward simultaneously to ensure even coverage of the smear;
4. Upon completion of the first staining step, the carrier returns to the rear position and tilts to drain residual liquid;
5. The air-drying process is initiated. Simultaneously, the solenoid valve for staining solution A is closed, and the solenoid valve for staining solution B is opened; The above steps are then repeated for solution B and subsequent rinsing or drying processes as required;
6. After all staining and drying steps are completed, the system awaits the smear removal command (button B3);
7. When button B3 is pressed, the carrier is moved to the front window position, allowing users to open the device and retrieve the stained smears.
If a device malfunction occurs during any stage, button B4 may be pressed to enter sleep mode. In this mode, all system components, solenoid valves, peristaltic pump, and stepper motors, are shut off to prevent further error or damage. Once the fault is repaired, button B4 can be pressed again to restart the initialization procedure and allow the staining process to resume from the beginning.
2.4 Verification of device functions
2.4.1 Validation scheme
Initially, the hardware circuit underwent rigorous inspection to ensure precise soldering and reliable connections. Subsequently, all modules were integrated into the complete device assembly. As shown in Figure 7, the staining device is housed within a rectangular acrylic enclosure, the bottom and side panels are sealed to prevent external interference or dye leakage, and a partition plate is installed inside the housing, separating the compartments: the main mechanical structure is centrally mounted on the bottom, while the electronic control hardware is installed on the partition plate above. The liquid pipeline and droppers are placed directly above the carrier. The dye and rinsing solution reservoirs are located at the rear inside the housing.


2.4.2 Test of the modules
The button module was tested by observing the response of an LED indicator on the microcontroller. The LED control code was embedded at the points corresponding to short and long button presses to verify accurate detection. When the relevant GPIO port was pulled low (grounded), the LED turned on. To prevent mutual interference between the LED module and the LCD module, a 74HC573 latch was used for electrical isolation. During LED control, the latch enable bit was first set high to enable the latch, then pulled low to maintain the LED’s state.
The LED control snippet is as follows:

After successful verification of the button module functionality, testing proceeded to the stepper motor module, peristaltic pump, and solenoid valve module using the button inputs. Each button was pressed individually to confirm that the corresponding device functions operated correctly and without error.
During operation of the stepper motor, press the RESET button on the microcontroller at any time and observe the variation of the display parameter jiaodu_a on the LCD screen before and after pressing the RESET button. If the value of jiaodu_a remained unchanged before and after pressing, it confirmed that the EEPROM module correctly stored the position data and retained it after a reset, thus passing the test.
Next, the staining process test was carried out. The staining process code was executed, and key operations were performed according to the prompts on the LCD display module. The variation of information displayed on the LCD was observed at each step of the staining process, ensuring that the system provided real-time feedback to the user.
The testing results show that the microcontroller effectively controlled the stepper motors, the peristaltic pump, and the solenoid valves to stain the smear on the carrier with different staining solutions.
After successful testing of all modules, an overall staining test was performed on the staining device. A and B Diff staining, rinsing, and drying of several hydrothorax cytological smears were carried out sequentially. The hydrothorax cytological smears specimens were provided by the Digestive Endoscopy Department of Shanghai Ruijin Hospital. Figure 8 shows the visual and microscopic examination results of the stained smear. The ROSE operating pathologist at Shanghai Ruijin Hospital evaluated the smear staining quality and confirmed that the quality of staining was sufficient for microscopic examination and diagnosis.


Figure 8. Visual and microscopic examination results of stained cytological smear. (A) Four stained cytological smears; (B) Microscopic image of a cytological smears.
In response to the current challenges of low efficiency, cluttered operating spaces, and high manpower consumption in Diff-Quick staining of cytological smears, we designed an automatic staining device specifically for ROSE-oriented aspiration specimen cytological smears. The prototype device underwent comprehensive functional verification, demonstrating its ability to effectively automate the four key processes: A and B Diff staining, rinsing, and drying of smears. The developed staining device offers several advantages, including enhanced efficiency, improved workspace organization, emergency stop functionality, and process monitoring.
In summary, this cytological smear staining device is a valuable tool for rapid staining and on-site evaluation of cytological smears, particularly in fine needle aspiration guided by endoscopic ultrasound, such as those used in pancreatic lesion diagnosis. It holds promise for improving the implementation of EUS-FNA/B cell rapid staining technology in digestive endoscopy centers.
Looking ahead, large-scale clinical trials will be conducted in collaboration with multiple medical institutions to further refine device parameters. Future efforts will focus on validating the device’s applicability to other sample types, such as lymph node punctures and thyroid fine-needle aspirations. Additionally, integration of additional staining techniques, such as Papanicolaou staining and immunocytochemical staining, will be explored to address while expanding diagnostic capabilities through.
Author contributions
Guangyan Wang: Collect and summarize materials, write and revise the paper, and draw graphs and tables; Kai Yang: Consult literature, and revise the content of the paper; Chunhua Zhou: Conduct critical review of the informative content of the article; Duowu Zou: Explain experimental data and evaluate experimental results; Shiju Yan: Design related experiments, Provide writing ideas and guide paper writing.
Funding
This research received no external funding.
Data availability
Not applicable.
Ethics approval and consent to participate
Not applicable.
Consent for publication
Not applicable.
Competing interests
The authors declare that they have no competing interests.
Acknowledgements
Not applicable.
[1] Bray F, Laversanne M, Sung H, Ferlay J, Siegel RL, Soerjomataram I, et al. Global cancer statistics 2022: GLOBOCAN estimates of incidence and mortality worldwide for 36 cancers in 185 countries. CA Cancer J Clin. 2024 May-Jun;74(3):229-263. https://doi.org/10.3322/caac.21834
[2] Zhang X, Yang L, Liu S, Cao L, Wang N, Li H, et al. Interpretation on the report of global cancer statistics 2022. Chin J Oncol. 2024 Jul 23;46(7):710-721. https://doi.org/10.3760/cma.j.cn112152-20240416-00152
[3] Wang Y, Huang Y, Chase RC, Li T, Ramai D, Li S, et al. Global burden of digestive diseases: A systematic analysis of the global burden of diseases study, 1990 to 2019. Gastroenterology. 2023 Sep;165(3):773-783.e715. https://doi.org/10.1053/j.gastro.2023.05.050
[4] Tian L, Tang AL, Zhang L, Liu XW, Li JB, Wang F, et al. Evaluation of 22G fine-needle aspiration (FNA) versus fine-needle biopsy (FNB) for endoscopic ultrasound-guided sampling of pancreatic lesions: a prospective comparison study. Surg Endosc. 2018 Aug;32(8):3533-3539. https://doi.org/10.1007/s00464-018-6075-6
[5] Wang BG, Lee IH. EUS-FNA diagnosis of pancreatic tophaceous gout: Two rare cases. Diagn Cytopathol. 2024 Sep;52(9):E222-E225. https://doi.org/10.1002/dc.25323
[6] Majumdar K, Sakhuja P. Surgical Pathology of the gastrointestinal system: Volume I - gastrointestinal tract. 1th ed. Singapore: Springer Singapore; 2022. chapter 6, Diagnostic special stains, immunohistochemical markers, and special techniques used in gastrointestinal tract pathology; p. 113-150.
[7] Wu M, Zhang J. Research progress on auxiliary techniques related to endoscopic ultrasound-guided fine needle aspiration/biopsy. J Nantong Univ (Med Ed). 2022;42(02):137-141. https://doi.org/10.16424/j.cnki.cn32-1807/r.2022.02.010
[8] Jimenez-Heffernan JA, Alvarez F, Muñoz-Hernández P, Bárcena C, Azorin D, Bernal I, et al. Cytologic features of ventricular tumors of the central nervous system: A review with emphasis on diff-quik stained smears. Acta Cytol. 2021;65(2):111-122. https://doi.org/10.1159/000512723
[9] Silverman JF, Frable WJ. The use of the diff-quik stain in the immediate interpretation of fine-needle aspiration biopsies. Diagn Cytopathol. 1990;6(5):366-369. https://doi.org/10.1002/dc.2840060516
[10] Iswenti N, Aric Frendi A, Nicen S. Application of leadership style to patient safety culture in hospitals. Proceedings of 1st International Conference on Health Sciences and Biotechnology (ICHB 2021); 2022. Atlantis Press. p. 86-88.
[11] Zhang M, Wang Y, Li S, Tao J, Xue H, Chai D, et al. Research on rotation control method of X-ray gastrointestinal diagnosis bed based on single chip microcomputer. Software. 2019;40(04):100-102. https://doi.org/10.3969/j.issn.1003-6970.2019.04.021
[12] Liu B, Cheng S. Stepper motor and drive control system. Harbin: Harbin Institute of Technology Press; 1997.
[13] Cheng D. Mechanical Design Handbook. Beijing: Electronic Industry Press; 2016.
[14] Fan C, Fan W. Selection and calculation of stepper motor. Mach Tools Hydraul. 2008;(05):310-313,324.
[15] Gao H, Liu T, Sun Z. The Peristaltic pump’s principle and application in chemical mechanical polishing process. Equip Electron Prod Manuf. 2010;39(09):48-51.
[16] Ferretti P, Pagliari C, Montalti A, Liverani A. Design and development of a peristaltic pump for constant flow applications. Front Mech Eng. 2023 July 18;Volume 9 - 2023. https://doi.org/10.3389/fmech.2023.1207464
[17] Dong Y. Analysis and use of solenoid valves. J Salt Sci Chem Ind. 2020;49(03):45-46,52. https://doi.org/10.16570/j.cnki.issn1673-6850.2020.03.014
[18] Wang X. Principle and selection of solenoid valves. Mach China. 2014;(11):183.
[19] Zhang H, Li H, Zhong H. TFT-LCD liquid crystal display technology and application research. Electron Software Eng. 2022;(18):86-89. https://doi.org/10.20109/j.cnki.etse.2022.18.021
[20] Xiang S. Study of key circuits for reliable and low power EEPROM memory in RFID [master's thesis]. Chengdu: Southwest Jiaotong University; 2018.
[21] Xu Z, Li W, Hua Y, Xu C. Application of I2C bus technology in I/O port expansion of ship energy management system. Chin Ship Res. 2019;14(01):144-149. https://doi.org/10.19693/j.issn.1673-3185.01129
ISSN: 2957-5478
Volume 4, Issue 1
March 2026
Pages: 1-76