1. Introduction
The Chinese medicine manufacturing market in Taiwan has reached up to 11.5 billion NT dollars (not including herbs and health food). Traditional Chinese medicine and pharmacology are specific medical behaviors of Chinese people. According to the report [
1], there are up to 6 million visits to Chinese medicine clinics annually in Taiwan, and fewer than 10% of Chinese medicine clinics, among more than three thousand, have Chinese medicine pharmacists practicing dispensing. Reasons for this might include the environment full of dust, the workload, and the work pay, none of which are likely to attract qualified pharmacists to engage in the Chinese medicine industry. Moreover, the dispensing fee for traditional Chinese medicine clinics from the Taiwan Health Insurance Bureau is much lower than the western drug dispensing fee, so a lot of traditional Chinese medicine clinics employ nursing staff or assistants without pharmacist qualifications for dispensing medicine in order to reduce the personnel costs. The safety of public medication use therefore has room for improvement.
Most traditional Chinese medicine is dispensed with scientific Chinese medication (powdered) and paid for by the Health Insurance Bureau. However, the variety of scientific Chinese medication is great, and the scientific Chinese medication appears in powder form with similar appearance, color, and odor, which are difficult to distinguish, and can easily result in incorrect administration of medicine. After scientific Chinese medicines have been mixed into a package, these medicines can therefore not be distinguished by color or size, as can western troches. It is necessary to establish careful dispensing steps and to develop standard operating procedures (SOP) with a pharmacist double-checking the correctness of the dispensed items, protecting patients from regret caused by human negligence. Automatic packaging machines are currently being introduced into the traditional Chinese medicine dispensing process. Pharmacists first put the dispensed medicines into a medicine tank (bowl). After shaking the tank manually by hand or automatically by machine, pharmacists then evenly distribute medicines into 42–45 separate slots for bagging and sealing. However, there is no systematic pharmaceutical processing record before mixing Chinese medicines in the tank.
At present, western drug dispensing functions well, and large automatic dispensing systems are employed teaching hospitals, as western drugs are administrated by troches which can be easily counted and distinguished by size and color using mature techniques. On the other hand, traditional Chinese medicine still depends on manual dispensing. Based on the need for correctly dispensing traditional Chinese medicine, the “smart traditional Chinese medicine chest” [
2,
3] and “smart traditional Chinese medicine dispensing platform” [
4,
5] have been developed to promote dispensing efficiency. The “smart traditional Chinese medicine chest” emphasizes a reminder function using “lights”, when pharmacists dispense medicine, to reduce the likelihood of taking the wrong gallipots. Nevertheless, the system does not double-check the replacement of the gallipot onto the shelf, and the weighing process during medicine dispensing is performed manually by the pharmacists, presenting of the opportunity for human negligence in terms of mis-replacement of the gallipot, thus requiring a huge amount of manpower support. The “smart traditional Chinese medicine dispensing platform” utilizes an RFID-based medicine item confirmation system to ensure the correctness of the medicine dispensed. This platform has found broad application in some hospitals, e.g., Taipei City Hospital. Integrated with mixing machines and automatic packaging machines, this platform is able to reduce some of the required manpower. However, dispensing and weighing are still done by hand.
With regard to traditional Chinese medicine dispensing devices, existing products in the market are restricted to automatic packaging machines (e.g., V-45 MT and V-830 MT—automatic medicine packing machines
http://www.vital-medical.com; and V-830 M—automatic scientific Chinese medication packing machine
http://jh.pgo.tw), which have the function of evenly distributing dispensed powder into several packaging bags. Among the existing patents, the “dispensing device” [
6] takes mixed powder, evenly distributes the powder for packaging, and cleans the powder residual. There also exists “Automatic capsule filling system” designed for aiming at automatic capsule filling process. Such devices are similar to automatic troche packaging equipment. All of the above equipment and patents aim at the automatic packing of dispensed powder. Although there are microcomputer counting machines for troches or capsules for western drug dispensing, these machines are not suitable for performing automatic dispensing for traditional Chinese medicine. The “intelligent traditional Chinese medicine dosing machine” [
7] has a vertical pipe structure using control circuits and valves to output traditional Chinese medicine through the delivery pipe to complete traditional Chinese medicine dosing. Such structures are able to solve the dust problem and reduce the use of floor space, but improvements with respect to the weighing accuracy for tiny amounts of powder, the uniformity of compound dispensing, cross-contamination, and the reduction of dispensing time are not addressed.
By observing the current requirements for the dispensing process and the existing automatic packaging machines, an automatic traditional Chinese medicine dispensing machine requires primary functions that include automatic positioning for compound dispensing, automatic powder discharge, and accurate automatic weighing, making it a challenging research and development task. In consideration of the numerous types of traditional Chinese medicine and in order to avoid cross-contamination in the gallipot during medicine discharge, the designed automatic traditional Chinese medicine dispensing machine requires a completely innovative mechanism, allowing an independent powder feeding/discharge mechanism for each gallipot. With regard to the accuracy of the automatic weight measurement, a small error for each prescribed dose is expected (e.g., lower than +/−0.2 g). What is more, the integration of electromechanical control and information systems is expected to achieve the goals of full automation from prescription to dispensing (reducing manpower and human error) and accurate medication.
In order to conform to the above requirements, the innovative powder dispensing mechanism developed in this study is designed using a shelf-based mechanism. Unlike the patent in [
8], a Vending Machine with Automated Detection of Product Position, our proposed shelf-based mechanism deals with powder dispensing and weighing. The vending machine presented in [
8] uses adjustable dividers on the shelf to accommodate different-sized products and uses optical recognition to determine the identities of the products and the vertical and horizontal positions of the location markers. However, the products in the vending machine [
8] are not in powder form, and the vending machine is therefore not able to dispense and measure powder. In our system, each gallipot on the shelf is equipped with a gallipot base and a gear push discharge mechanism. There is great demand for accuracy in the powder weight measurement, motor positioning, and (rotation) speed control in the control system. Since medicine discharge is performed by screw rotation, the screw rotation angle should be precisely controlled for powder dose. This is considered to be a challenging research and development task.
In consideration of the costs and control complexity/accuracy, stepping motors with open-loop control are applied to many products. Accordingly, stepping motors are also used for positioning and discharging control in this study. There have been many research works on stepping motors carried out in the past. Reference [
9] uses a back-electromotive force (back-EMF)-based load angle estimation (a senseless load angle estimator) for step loss detection and stall detection of a stepping motor. Reference [
10] analyzes the working mode of stepping motors in half step and full step in dynamic conditions at different frequencies. Reference [
11] proposes an adaptive control of a stepping motor drive using a hybrid neuro-fuzzy approach in which the ANFIS [
12] is used to build a Sugeno fuzzy model for controlling the stepping motor drive. Reference [
13] presents an application of the fuzzy logic principle to control the speed of a stepping motor drive in a closed-loop control and uses a low-cost microcontroller to verify design performance. Reference [
14] shows a LabView-based soft control method for the starting acceleration and stopping deceleration stages of stepping motors. Reference [
15] presents a controller driver for a 2-phase stepping motor with full step sequence, using a voltage to frequency converter. The acceleration/deceleration control curves of trapezoidal and new S model of a stepper motor under the open-loop control based on Microcontroller Unit (MCU) were studied in Reference [
16], and the relationship curve between the control pulse and time was discretized to determine the stepping motor control scheme. The results showed that the acceleration/deceleration control of the new S model exhibited little noise, high positioning accuracy, and good flexibility. Reference [
17] studied the open-loop stepping drive of PMSM (permanent magnet synchronous motor) using an open-loop compensation method of PWM dead-time to improve the control precision of the winding current and the precision of the step interval under stepping drive mode. Reference [
18] discusses the implementation of an open-loop stepping motor drive controller using CPLD; the improvement in CPLD computing speed improved the performance of the controller. Reference [
19] proposed a control scheme for reducing the resonance of hybrid stepping motors. The motor currents are controlled in a synchronously rotating frame with excitation frequency. The d-axis current provides the torque for the external load, and the q-axis current provides the transient torque for damping the motor. The angle of the motor back-EMF is used by an observer to estimate the motor speed. The simulation and experimental results showed that this proposed method was able to effectively damp the resonance of micro-stepping controlled motors. Reference [
20] showed that the spontaneous reverse speed of a permanent magnet stepping motor when controlled in full step, open-loop mode was equal to three times the forward speed. The reverse running will arise when the undershoot of the single-step response exceeds 50% (or a damping factor of less than 0.11). The growth of the undershoot in response to repeated steps will cause resonance problems, including stalling and speed reversal.
Most past research works on weighing have focused on error correction and dynamic response compensation. Reference [
21] proposed a practical compensating method for the creep error in load cells through the use of digital processing. A weighted composite function as a compensation function for use in flexibly expressing a creep error curve and a compensation model for calculating the amount of compensation corresponding to the weight loading history were presented. However, the weight being measured in this research was in kg, while the weight measured in our study is in g. Reference [
22] applied a double load cells self-balance method for measuring the static load of bridges. Reference [
23] proposed a novel model-based signal filtering technique to improve the dynamic measurement of load cells. As the load cell is an underdamping oscillation response requiring a longer time to be stable, a real-time filtering for compensating dynamic response is needed. Reference [
24] presents an optimal G-shaped load cell design for measuring weight in two different ranges. Reference [
25] proposes a linear time-varying continuous-time filter to dynamically compensate load cell response. Reference [
26] presents an optimal neural network based on ALMNN for reducing serious non-linearity errors.
A hardware mechanism design and control for shelf-based automatic Chinese medicine dispensing machine is presented in this study. The hardware contains a linear guide mechanism, a weighing mechanism, a retractable mechanism, a gallipot base discharge mechanism, and a lifting platform mechanism, all of which are controlled by an automatic weighing controller and lifting platform controller. These controllers control different motors for different purposes: the guide motor for the horizontal movement of the weighing mechanism to the assigned position of the traditional Chinese medicine gallipot; the retraction motor for extending the medicine spoon (which is connected to the weighing element) in order to hold powder or retracting the medicine spoon; the rotation motor for controlling the powder discharge amount; the medicine spoon motor for flipping the medicine spoon to pour powder into the mixing bowl; and the lifting motor for the lifting of the mixing bowl to hold the powder discharged from the medicine spoon. The completed software/hardware is proven, by means of an experiment, to conform to the requirements for the traditional automatic Chinese medicine dispensing machines, which are able to automatically feed and weigh prescribed powder according to the prescription order and pour powder into the mixing bowl. Moreover, the dose amount and dispensing details can be recorded in a database for further applications, such as gallipot inventory, gallipot location optimization, etc. Several Bayesian-based approaches [
27,
28,
29,
30] have been proposed for tackling inventory and location optimization problems where dynamic decision-making is involved.
The presented automatic Chinese medicine powder dispensing machine offers several innovative or important features that are beneficial to Chinese medicine.
The very first practical Chinese medicine powder dispensing machine with a weighing function: Such a commercial Chinese medicine powder dispensing machine is not yet available in the market.
The innovative and low-cost design of the gallipot base with powder discharge mechanism: Each gallipot is equipped with one gallipot base, which can be controlled by the weighing mechanism to discharge powder with the desired weight. An innovative gear push discharge element is designed in the gallipot base. The driving force of the gear push discharge element for discharging comes from the motor on the weighing mechanism; therefore, the cost of the gallipot base is low.
Avoidance of cross-contamination among different powders: Each individual gallipot has its own gallipot base when powder is being discharged; therefore, powder cross-contamination among different gallipots is avoided.
Flexible size: The number of shelves can be increased easily as needed; therefore, the number of powder gallipots can be increased as well.
Reduction of human error: Once the gallipots have been put correctly on the shelves, the presented machine can automatically dispense and precisely weigh the desired Chinese medicine powders without human effort, reducing human negligence significantly.
Implementation of a parabolic type of S mode speed control for stepping motor: The parabolic S mode speed control provides faster and more stable movement speed and accuracy than the trapezoidal mode.
Stepping motors are used in the presented machine for their ease of control, low cost, and durability.
3. Results
Figure 30 displays the appearance of the automatic powder dispensing machine using a shelf-based mechanism, with an aluminum extrusion assembly as the frame material, and components of weighing mechanism and gallipot base being 3D printed.
Figure 31 shows the flowchart of the system operation. First, the controller receives the prescription information and moves the guide block to the assigned gallipot. Based on the required dose weight, the weighing mechanism drives the screw through the stepping motor to extend the retractable platform, where the powder discharge coupler is coupled with the drive of the discharge mechanism on the gallipot base. The rotation motor drives the discharge mechanism to drop the powder into the medicine spoon until the designated weight is reached. The retractable platform on the weighing mechanism is then retracted, and the block returns to its initial position. The lifting platform is further operated in order to raise/lowered it to the position of the medicine spoon following the completion of weighing. When the lifting platform is in position, the retractable platform on the weighing mechanism is extended to flip the medicine spoon and pour the powder. The lifting mechanism then proceeds to the next operation, having completed the above operation, and determines the entry of the next prescription. If there is no next prescription, then dispensing is completed.
To test the system effectiveness, we carried out a weighing precision test, transverse displacement positioning precision test, lifting platform stability test, transverse displacement speed test, and discharge speed test.
3.1. Weighing Precision Test
When dispensing traditional Chinese medicine, pharmacists weigh the medicine according to the prescription. The proposed system automatically dispenses powder, and the amount of powder discharged is accurately controlled. The weighing precision test is carried out under distinct automatic discharge weights, including 3 g, 5 g, 10 g, 15 g, 18 g, and 21 g, 3 times each, in order to calculate the average absolute error and the maximal error and thus to verify the weight accuracy within a reasonable range.
With thrice repeated weighing for each different weight, we subsequently obtain three measurement (absolute) errors for each different weight. The maximal error is selected, and the mean error is calculated (sum of 3 absolute errors divided by 3) for each weight, e.g., the maximal error among 3 measurements for the weight of 10 g was 0.06 g, and the absolute mean error of these 3 measurements was 0.03 g. The red line in
Figure 32 shows the maximal errors for the different weights, and the blue line shows the absolute mean error. The absolute mean error (blue line) appeared in the range of 0.03 g~0.28 g. Then, the average absolute error (sum of all six absolute mean errors divided by 6) was 0.17 g, thus achieving the expected goal of the design.
3.2. Transverse Displacement Positioning Precision Test
The powder discharge coupler on the weighing mechanism must be accurately coupled with the drive of the discharge mechanism on the based of each gallipot on the medicine shelf in order to rotate the gear push element to discharge the powder from the gallipot for weighing. The coupling parts are shaped like teeth. Under 2 mm positioning error, the weighing mechanism normally drives the rotation of the discharge mechanism. It is necessary to test whether the weighing mechanism on the block driven by the linear guide accurately moves to the assigned position.
When designing the hardware mechanism, the positioning point of each gallipot position is set. A tape ruler is attached to the side of the linear guide in order to observe the distance moved. The zero point on the ruler is close to point F. The weighing mechanism, driven by the guide motor, moves from A (initial position) to the positions (B, C, D, E, and F) of the assigned gallipots and then back to A. The position of at which it stops is recorded. The experiment was repeated five times for each point, and the test results are shown in
Figure 33, whereby the linear guide motor does not exhibit stalling or overshoot during operation. When the guide motor moves the weighing mechanism to point F, it should stop at 3.0 cm (expected position). However, it stops at 3.1 cm (green line), and the errors are all 0.1 cm for 5 tests. For points E and C, the errors are all 0.0 cm for 5 tests. For points A and B, the errors are all 0.1 cm for 5 tests. For point D, the errors are all 0.2 cm for 5 tests. Therefore, the error is within 2 mm, conforming to the design requirement.
3.3. Lifting Platform Stability Test
A mixing bowl is placed on the lifting platform to collect the weighed powder from each shelf to test the stability of the lifting positioning. The platform has to be in the position below the medicine spoon with enough room so that the medicine spoon can be flipped to pour powder without leaking or spreading the powder. A tape ruler is attached on the side of the lifting mechanism in order to observe the stopping position. for the experiement was repeated five times and the position data recorded; the results are shown in
Figure 34. For point A, the errors are all 0.0 cm for 5 tests. For point B, the errors are all 0.2 cm for 5 tests. The error exhibited is within 2 mm, which is an acceptable engineering accuracy range.
3.4. Transverse Displacement Speed Test
The horizontal movement speed of the weighing mechanism is related to the dispensing time. Two different speed control curves, the trapezoidal curve and the S-curve, are utilized for testing the average speed by moving the block from the initial position to different positions. The pulse frequency used during the constant speed interval for these two speed control methods is 3.125 kHz.
Table 2 lists the times measured from the initial point to various positioning points using trapezoidal speed control. The transverse movement speed is subsequently calculated, as shown in
Table 3.
Table 4 lists the time measured from the starting point to various positioning points using the S-curve speed control. The transverse moving speed is also calculated, as shown in
Table 5. The data show that the average transverse moving speed for the S-curve is 23.89 cm/s, which is faster than that of the trapezoidal curve, which is 21.79 cm/s. Additionally, S-curve speed control is more stable during acceleration and deceleration periods than the trapezoidal speed control.
3.5. Discharge Speed Test
The effectiveness of this system should balance the powder weight precision and discharge speed. By measuring the time required for automatic discharge using different discharge weights, the discharge speed is calculated.
Table 6 lists the time for discharging different weights, and
Table 7 shows the corresponding average discharge speed. The average discharge speed of the automatic weighing mechanism is 0.22 g/s.
4. Discussion
In the presented design, each Chinese medicine powder gallipot is equipped with its own base with a powder discharge mechanism. 3D printing was used for the prototype of the gallipot base, demonstrating the feasibility of this design. For future commercialization, the gallipot base can be mass produced, and the cost per unit will be low due to its simple design.
Since each gallipot has its own base, cross-contamination of the powder will not occur while discharging. Moreover, the power driving the discharge mechanism comes from the stepping motor on the weighing mechanism via the coupling of the coupler and the drive. Although many gallipot bases are required for each shelf, only one weighing mechanism is needed for each shelf. The stepping motors used on the weighing mechanism for rotating the coupler, flipping the medicine spoon, and retracting/extending the retractable platform are 200 steps per revolution at 100 Hz. The average speed of powder discharge is 0.22 g/s. Faster stepping motors could be used to improve the discharge speed for commercialization of this machine.
The number of shelves can be increased in accordance with the needs of the application, as an aluminum extrusion frame is utilized. The presented machine has two shelves, with a total of 10 gallipots. If 100 gallipots were needed, a 5-shelf machine could be designed with 20 gallipots on each shelf. The size of such a design would have a height of 160 cm and a width of 200 cm. The estimated cost for this 5-shelf 100-gallipot machine would be $1800.
Since powder discharge is achieved by the coupling of the coupler teeth and the drive teeth, it is necessary to precisely move the weighing mechanism to the gallipot base at the right position so that the rotation motor is able to drive the discharge mechanism. Furthermore, it is also necessary to raise/lower the mixing bowl on the lifting platform to the right position in order to collect the powder from the medicine spoons. Positioning errors for both were all within 2 mm, satisfying the precision requirement.
The weighing element used in this study can read up to 1 kg, at the resolution 0.01 g. The weighing average absolute errors were in the range of 0.03 g~0.28 g. For a 3-day, 9-dose prescription (3 doses per day), the weighing errors per dose were in the range of 0.003 g~0.03 g, which is acceptable.
Since the weighing mechanism consists of three motors, a load cell, and other parts, its weight is not light. Moreover, its moving speed affects the dispensing time. A more powerful stepping motor is used for driving this weighing mechanism. Two different speed control curves, trapezoidal curve and S-curve, were tested. The average transverse moving speed of the S-curve was faster than that of the trapezoidal curve. The S-curve speed control was also more stable during starting and stopping periods than the trapezoidal speed control.
With the help of the weighing mechanism, the powder consumption of each gallipot can now be systematically recorded in the database. Therefore, the development of a gallipot inventory becomes possible. In the future, a management system could be developed to send an alarm when a gallipot is almost depleted for replacement. Another interesting feature that would also be feasible is optimal gallipot location planning for faster dispensing. Based on historical statistical data, it would be possible to place the most commonly used Chinese medicine at locations as close as possible to the initial position of the weighing mechanism, resulting in faster dispensing.
Since the gallipot bases were printed by a 3D printer, the quality of the gallipot bases leaves room for improvement in the commercialization of this machine. Nano coating can also be applied to gallipot bases and medicine spoons, so that powder particles do not adhere to the bases and spoons. This will also increase the accuracy of powder discharge and prevent powder cross-contamination on the spoon.
5. Conclusions
A shelf-based automatic powder dispensing machine was presented in this study to improve the workload of Chinese medicine pharmacists, who currently dispense and weigh powder manually. The system is framed with aluminum extrusion bars, on which linear guide mechanisms and 3D-printed components are assembled. Software and hardware were designed to control the motor positioning/speed of the control systems and for automatic weighing. Mechatronics were applied to implement the functions of automatic dispensing, automatic weighing according to the prescription, and automatic pouring of the dispensed powder into the mixing bowl.
In the entire operation process of the system, the target functions operated normally. Driving the weighing mechanism to the assigned position and extending the retractable platform in order to couple the discharge mechanism with the gallipot base were correctly controlled. Also, the gear push element was able to accurately drop the powder into the medicine spoon for automatic weighing.
After testing, the system showed an average absolute error of weighing of 0.17 g, a horizontal positioning accuracy within 2 mm, a lifting platform positioning accuracy also within 2 mm, a transverse moving average speed of 23.89 cm/s with the S-curve speed control, and an average powder discharge speed of 0.22 g/s.
The system is indeed able to provide the functions needed for the automatic dispensing and weighing of traditional Chinese medicine, offering systematic traditional Chinese medicine dispensing history records, and promoting traditional Chinese medicine dispensing efficiency and accuracy.