Open Access Paper
28 December 2022 Intelligent unmanned medicine cabinet based on 51 single-chip microcomputer
Ning Li, Chunyue Wang, Dan Zhang, Ruoxuan Wang, Yaqin Fan
Author Affiliations +
Proceedings Volume 12506, Third International Conference on Computer Science and Communication Technology (ICCSCT 2022); 125062J (2022) https://doi.org/10.1117/12.2662536
Event: International Conference on Computer Science and Communication Technology (ICCSCT 2022), 2022, Beijing, China
Abstract
With the relatively uneven distribution of medical resources in China and a new outbreak of COVID-19 at the end of 2019, we developed an intelligent medicine cabinet to alleviate the problem of high pressure and difficulty in accessing medical care in hospitals around the country. The medicine cabinet has a signal transmission circuit system based on 51 microcontroller and a new X-Y trajectory control module, which controls the Pulse Width Modulation (PWM) signal by Proportion Integration Differentiation (PID) algorithm to improve the accuracy of the DC motor. It has the functions of online drug selection, drug sales, drug transmission, etc. Meanwhile, the online drug purchase system based on the WeChat applet can reduce the probability of infection by a new coronavirus. And the new X-Y cargo track will significantly improve the safety of fragile drugs while ensuring their delivery. The development of this medicine cabinet will greatly reduce the operating cost of pharmacies and meet the demand of people to purchase medicine at night.

1.

INTRODUCTION

At present, about 80% of China’s medical resource are concentrated in cities, and nearly 80% of the medical resources in cities are concentrated in large hospitals, people living in rural and remote areas generally face the problem of lack of medical care and medicine, while the medical resources in urban centers are firmly occupied by patients with minor and frequent illnesses, leading to a waste of medical resources. At the same time, when conducting social statistics, it was found that only about one-tenth of pharmacies in China 24-hour sales to meet customers’ supper needs cannot be satisfied. Based on the above problems, the author developed an integrated intelligent unmanned medicine cabinet for medical care and medicine sales to improve the current situation1.

We use artificial intelligence and other advanced technologies to build an unmanned medicine cabinet intelligent brain. Combined with the current mature real-time calls, intelligent vending machine, based on the Internet of Things, it is an intelligent medical system with a remote Bluetooth module as the core and a single-chip microcomputer as the core. Through the application of artificial intelligence technology, common diseases of patients can be effectively solved, the workload of large hospitals can be reduced, and repeated manual operations can be replaced by artificial intelligence and other technologies, thereby reducing the operating costs of pharmacies. In order to build a reasonable and sustainable intelligent medical ecosystem, and promote the deep integration of artificial intelligence and the pharmaceutical industry2-5

2.

OVERALL RESEARCH IDEA AND METHODOLOGY

In the composition of unmanned medicine cabinet hardware, the first is the upper computer operation part, through the USB interface to access the intelligent touch screen to the upper computer. Next is the cargo channel control part, combining Bluetooth technology and cell phone terminal applet to transmit instructions to the 51 MCU, the MCU receives the instructions and then controls the motors of the cargo channel and the pickup platform respectively through the L298N DC motor drive module to push out the drugs to the pickup port and use the sensor feedback to complete the drug purchase operation. The intelligent medicine cabinet system is shown in Figure 1.

Figure 1.

Intelligent medicine cabinet system.

00105_PSISDG12506_125062J_page_2_1.jpg

3.

X-Y TYPE CARGO CHANNEL CONTROL

The traditional pusher is usually transported in an elastic way, which is convenient and convenient, but it is only suitable for goods that are not easily broken, and there is a big limit on the size of the goods. Intelligent automatic medicine box, using new X-Y channel,,which can ensure that fragile drugs are intact. MCS-51 is used as the main control chip. The crawler and X-Y cargo channel are controlled by the L298N drive motor to complete the drug-pushing work. The system requires high-precision positioning of the x-axis and y-axis motors, so the PID algorithm with PWM modulation can be considered to realize the motor speed regulation by software programming inside the microcontroller, which can reduce the power consumption and at the same time make the motor speed be controlled effectively. The User drug purchase process is shown in Figure 25, 6.

Figure 2.

User drug purchase process.

00105_PSISDG12506_125062J_page_2_2.jpg

3.1

PWM

Pulse Width Modulation (PWM) is a very effective technique. The analog circuit is controlled using the digital output of the microprocessor. For 51 Single - Chip Computer, the IO port output is a digital signal, and we need to output different analog voltage to add to the enabling side of the L298N driver chip to adjust the motor speed. Therefore, PWM is used by this system to convert digital signals to analog signals and to obtain different analog voltage signals. Changes in the duty cycle of the output square wave at the input/output port.

For a DC motor, when the output pin is high, the motor rotates; when the output is low, the motor stops. That is, the higher the duty cycle of the PWM wave, the higher the output analog voltage value, and the faster the speed of the DC motor. Through the experiment, we have determined that the DC motor can reach a more suitable speed when the duty cycle is about 70%. The code to generate PWM is shown in the Appendix.

3.2

Incremental PID algorithm speed control

Incremental PID speed adjustment has three adjustment modes: proportional adjustment, integral adjustment and differential adjustment. Scale adjustment refers to the scale adjustment of the deviation of the system. The larger the proportional parameter is, the faster the system adjusts. However, if the proportional parameter is too large, it will affect the stability of the system. The purpose of integral adjustment is to eliminate the steady state error of the system by integrating. The strength of the integral adjustment is related to the integral time constant of Ti. As the time constant decreases, the combined effect also increases. The difference adjustment is an important indicator to reflect the system offset rate. The method can predict the change trend of the offset and generate an amplification factor to reduce the error. With suitable differential parameters, it not only can reduce overshoot but also can shorten the adjustment time. The effect of different parameters of PID on the signal is shown in Figure 47-8.

The block diagram of the PID is shown in Figure 3. The system consists of input, PID controller, controlled object, feedback, output, etc.

00105_PSISDG12506_125062J_page_3_2.jpg

Figure 3.

System schematic of PID.

00105_PSISDG12506_125062J_page_3_1.jpg

PID is a kind of linear control, which forms the control quantity by a linear combination of proportional (P), integral (I), and differential (D) of the deviation of the given value r(t) from the actual output value y(t), to control the object you need. The parameters and their meanings are shown in Table 1.

Table 1.

Parameters and meanings.

ParametersMeaning
r(t)Given value
y(t)Actual output value
e(t)Difference between the input and the output
KpProportionality coefficient of the PID controller
TiIntegration coefficient of the PID controller
TdDifferentiation coefficient of the PID controller

The differential equation of PID is:

00105_PSISDG12506_125062J_page_4_1.jpg

The discretization process results as follows:

00105_PSISDG12506_125062J_page_4_2.jpg

The essence of PID parameters tuning is to improve the dynamic and static indexes of the system by changing the parameters of the regulator to match its characteristics with those of the process, so as to achieve the best control effect. The patchwork test method on the engineering tuning method was adopted by the system. The X-axis motor of the X-Y cargo receiving platform is measured several times at P=0.23, I=0.07, and D=0.03, and the Y-axis motor is measured at P=0.36, I=0.06, and D=0.02 with the best W-stability performance, the smallest output error, and the speed stability as required. The effect of different parameters of PID on the signal is shown in Figure 49.

Figure 4.

The effect of different parameters of PID on the signal.

00105_PSISDG12506_125062J_page_4_3.jpg

The code for the PID algorithm is shown in the Appendix.

4.

BLUETOOTH AND SMALL PROGRAMS

WeChat applets are increasingly accepted by the public as a new open platform that can be used without downloading any application. The WeChat applet for online purchase was adopted by the smart medicine cabinet system, which mainly based on WeChat developer tools, and combined with WXSS, WXML, Java Script, JSON, the four languages for development10. Customers only need to scan the code to enter the small program and choose the medicine they need to buy. This way makes it unnecessary for customers to choose from the original touch screen, avoiding indirect contact with other customers and avoiding the secondary spread of epidemics. The applet communicates with the 51 microcontroller in the smart medicine cabinet system through the HC-08 Bluetooth module to transmit information about the medicine selected by customers to the system. After receiving the corresponding information, the microcontroller will send out control instructions to push the medicine, and finally, users can successfully get the medicine they need.

5.

CONCLUDING REMARKS

The new X-Y type cargo channel and WeChat small program for purchasing medicine are adopted by the 51 microcontroller-based smart medicine cabinet. This greatly reduces the damage to the goods caused by the high drop of the traditional vending machine due to the transportation method. At the same time, the use of unmanned medicine cabinets reduces the cost of selling medicine at night in pharmacies and meets people’s demand for medicine at different periods. It can also alleviate the problem of difficulty in purchasing medicine to a certain extent for areas where medical resources are less allocated. At the same time, it promotes the deep integration of intelligence and medical care.

ACKNOWLEDGEMENTS

This work is supported by the Natural Science of Jilin Province (20200401122GX).

REFERENCES

[1] 

Chen, M., Wu, Q., Zhang, F., et al., “Challenges and insights of intelligent health care services,” Chinese Journal of Hospital Management, 29 (8), 597 –599 (2013). Google Scholar

[2] 

Istepanian, R. S., Woodward, B. and Richards, C. I., “Advances in telemedicine using mobile communications,” IEEE 2001 23rd Annual International Conference of the IEEE Engineering Medicine and Biology Society, 3556 –3558 Istanbul, Turkey, New York, IEEE,2001). https://doi.org/10.1109/4233.908361 Google Scholar

[3] 

Marescaux, J., Leroy, J., Gagner, M., et al., “Transatlantic robot-assisted telesurgery,” Nature, 413 (6854), 379 –380 2001). https://doi.org/10.1038/35096636 Google Scholar

[4] 

Shenai, M. B., Tubbs, R. S., Guthrie, B. L., et al., “Virtual interactive presence for real-time, long-distance surgical collaboration during complex microsurgical procedures,” J. Neurosurg, 121 (2), 277 –284 (2014). https://doi.org/10.3171/2014.4.JNS131805 Google Scholar

[5] 

Wang, X., Zhang, H., Liu, Z., He, R. and Wang, Z., “Intelligent medical system of unmanned pharmacy based on InternetPlus,” in 2021 International Conference on Networking, Communications and Information Technology (NetCIT), (2021). Google Scholar

[6] 

Zhang, C., Wang, T. and Li, C., “Microcontroller-based speed control of DC motor,” Chemical Automation and Instrumentation, 46 (11), 885 –890 (2019). Google Scholar

[7] 

Zhao, Z., “[Control and Application of Vending Machine Based on Embedded System],” Soochow University, Jiangsu, (2017). Google Scholar

[8] 

Zhu, R. and Wu, H., “DC motor speed control system based on incremental PID algorithm,” Instrumentation Technology and Sensors, (7), 121 –126 (2017). Google Scholar

[9] 

Li, X. G., and Hui, Y. H., “Design and implementation of motor servo control system with analysis of scientific materials,” Advanced Materials Research, (2011). Google Scholar

[10] 

Song, S., Ma, Y., Liu, T., Lin, X. and Zhou, X., “Design and implementation of ‘i self-discipline’ WeChat applet,” Computer Programming Skills and Maintenance, (09), 81 –83 (2021). Google Scholar

Appendices

APPENDIX

(1)

Code of PID

00105_PSISDG12506_125062J_page_5_1.jpg
00105_PSISDG12506_125062J_page_6_1.jpg

(2)

Code of small program and microcontroller communication

00105_PSISDG12506_125062J_page_6_2.jpg

(3)

Code of PWM

00105_PSISDG12506_125062J_page_6_3.jpg
00105_PSISDG12506_125062J_page_7_1.jpg
© (2022) COPYRIGHT Society of Photo-Optical Instrumentation Engineers (SPIE). Downloading of the abstract is permitted for personal use only.
Ning Li, Chunyue Wang, Dan Zhang, Ruoxuan Wang, and Yaqin Fan "Intelligent unmanned medicine cabinet based on 51 single-chip microcomputer", Proc. SPIE 12506, Third International Conference on Computer Science and Communication Technology (ICCSCT 2022), 125062J (28 December 2022); https://doi.org/10.1117/12.2662536
Advertisement
Advertisement
RIGHTS & PERMISSIONS
Get copyright permission  Get copyright permission on Copyright Marketplace
KEYWORDS
Medicine

Intelligence systems

Analog electronics

Microcontrollers

Artificial intelligence

Pharmacy

Evolutionary algorithms

Back to Top