Note: * is a required field,
please fill it in during the registration stage↓
* 1. Introduction to project functions
This work is an AI intelligent anti-epidemic medicine box placed in the hospital, which aims to assist medical staff in building a protective barrier. The medicine box uses STM32F407 as the main control, and uses human body temperature sensors, GPRS modules, WIFI modules, visual cameras, etc. to realize the integration of medicine collection and placement, multiple authentication identification, temperature detection, automatic message notification, cloud and local system real-time information detection and equipment control. For the cloud system, we use applet to interact with the local system through the MQTT protocol. For the local system, we use the medicine box system developed by FREERTOS and LVGL for control and are equipped with two sets of software and hardware control solutions to ensure that the system can be controlled under abnormal conditions.
*2. Project attributes
The project is open, original, and has its own innovations;
*3. Open source agreement
The open source agreement of this project uses GPL3.0.
Please fill it in during the competition stage↓
*4. Hardware part
System overall solution
This work is based on STMicroelectronics' STM32F407ZGT6 high-performance microcontroller as the main controller. The control system is divided into the doctor side and the patient side. Through the cooperation of multiple sensors, it realizes the integration of medicine collection and placement, multiple authentication identification and door opening, human body temperature detection, automatic disinfection of medicine boxes, automatic message notification, real-time information detection and equipment control of cloud and local systems. Using the ESP8266 WIFI module to connect to the Alibaba Cloud server and interact with the WeChat applet through the MQTT protocol, it can realize a more intuitive view of the patient's medication information and equipment control on the mobile client.

Mechanical structure design
We set up the infrared temperature measurement module and K210 camera on a high bracket. The medicine box is spliced with acrylic plates and a certain area is reserved. The servo is connected to the loose-leaf to drive the box-type revolving door. The main control board is placed in the reserved position next to the medicine box, with layer separation, which improves the aesthetics of the project.

Introduction to the main modules
GPRS SMS sending module
The SMS sending module is mainly used to remind patients to take medicine on time. The GPRS module is the main component of the SMS sending module. It is a GSM module with GPRS data transmission function. The GPRS module is a simplified version of a mobile phone, which integrates the main functions of GSM communication on a circuit board and has functions such as sending short messages, making calls, and transmitting data.

The WIFI
module mainly sends information from the local system to the cloud server. Using the AP mode of the ESP8266WIFI module, a TCP connection is established with the host computer, and then the MQTT protocol is used to send data to the cloud server to realize the subscription and publication of MQTT topics.

STM32 and WeChat applet can interact with data through MQTT topic subscription and publication.
When STM32 sends data: STM32 is the publisher, WeChat applet is the subscriber, and Alibaba Cloud server is the communication transfer station. When STM32
receives data: STM32 is the subscriber, WeChat applet is the publisher, and Alibaba Cloud server is the communication transfer station. Voice
module
The voice module is used to remind patients of major matters to install the process to pick up medicines and broadcast drug information, so that patients can understand the precautions such as medication. This module uses the SYN6288 chip, and receives the text data to be synthesized and realizes voice conversion through asynchronous serial communication.

Temperature upper limit setting module
The main function of the temperature upper limit module is to alarm for abnormal temperature. The module includes a direction key composed of four micro buttons and a four-position dip switch. When the dip switch is turned on, the LCD screen enters the setting interface of the temperature upper limit alarm value. The left and right buttons are used to control the movement of the cursor. The upper button indicates the value plus one, and the lower button indicates the value minus one. The temperature measurement part

of the temperature measurement module
uses the MLX90614 sensor, and the distance measurement part uses the HC_SR04 module. Since distance is the main factor affecting the accuracy of infrared temperature measurement. We use the temperature measurement results at different distances for temperature compensation.

Sound and light alarm module
This module assists the temperature upper limit setting module to alarm for abnormal temperature. The sound and light alarm module consists of two parts, one is the sound system composed of a buzzer, and the other is composed of four LEDs of different colors, which are used for system operation prompts and auxiliary functions.

Power supply circuit design
In order to ensure the stable power supply of each module, the power supply circuit adopts a step-down chopper BUCK circuit. The 12V DC power supply is input from the power adapter, and then it is stepped down to 5V by the BUCK circuit and then passes through the AMS117 linear regulator, and the linear regulator outputs a stable 3.3V DC power supply.

The main control circuit design
is based on the STM32F407ZGT6 main control. We have led out all the pins to facilitate subsequent function expansion.

Test plan
Before testing, confirm that the mechanical structure of the medicine box is stable, the hardware circuit works normally, the power supply is from the 12V adapter DC power supply, there are no other irrelevant external additional circuits and control devices, and the project software program is normal.
Actual test: Approach the medicine box device, the temperature measuring device automatically measures the temperature and displays the temperature, face recognition or fingerprint recognition, after hand disinfection, the medicine box automatically rotates to open the door, three doses of medicine are placed in the medicine box, infrared detection shows that the medicine is placed, and the door automatically closes after 5 seconds and the disinfection device is started for disinfection; the patient receives a text message reminder to pick up the medicine, goes to pick up the medicine, approaches the medicine box device, the temperature measuring device automatically measures the temperature and displays the temperature, after swiping the fingerprint, the medicine box automatically opens the door, infrared detection shows that the medicine is taken away, the door automatically closes and disinfection is performed, the patient scans the code for recognition, the medicine is voice-announced and the device information is uploaded to the cloud server.
Test conditions
(1) Environment: Indoor laboratory, overhead multi-light lighting environment.
(2) Tools: Medicines, etc.
Test results
The test results are shown in the table.
Test 1Test
2Test
3Temperature
measurement, face scanning,
medicine dispensing ,
automatic switch,
automatic disinfection,
hand disinfection, SMS sending and receiving
SMS, fingerprint recognition , code scanning recognition, voice broadcast, cloud server applet, temperature measurement, face scanning, medicine dispensing , automatic switch, automatic disinfection, hand disinfection, SMS sending and receiving SMS, fingerprint recognition , code scanning recognition, voice broadcast, cloud server applet, temperature measurement , face scanning, medicine dispensing , automatic switch, automatic disinfection, hand disinfection , SMS sending and receiving SMS
Fingerprint recognition
Scan code recognition Voice
broadcast
Cloud server
applet Doctor
side
Normal
... The information about the patient's medication and body temperature will be uploaded to the Alibaba Cloud server through ESP8266, which is convenient for doctors to quickly and accurately view the patient's relevant information. STM32 uses the ESP8266 WIFI module to connect to the Alibaba Cloud server and interact with the WeChat applet through the MQTT protocol, which can make it easier to view the patient's medication information and control the device on the mobile client. LVGL In order to facilitate the viewing, modification, and entry of relevant information on the local system, we have developed a simple and easy-to-use user interface through LVGL. LVGL is a free, open source GUI library with beautiful interface, low resource consumption, high portability, responsive layout and other characteristics. You can view relevant user information, control the device and change the user's personal information to facilitate the system data update, and it is also equipped with intimate functions such as self-service drug search and one-click help. The program flow first initializes each peripheral module, connects to the Internet through the WIFI module, and then sends the peripheral data to the MQTT server built by Alibaba Cloud through the MQTT protocol. The WeChat applet then interacts with the STM32F407ZGT6 chip indirectly through the MQTT server, and interacts with the peripheral data through MQTT topic publishing and subscription. Then the temperature measurement module is used to measure the normal temperature and then fingerprint or face recognition is used to detect the classification of personnel. If it is a doctor and there is no medicine in the medicine box, the medicine placement procedure is executed. If it is a patient, if there is medicine in the medicine box, the medicine collection procedure is executed. a) Medicine placing procedure: first disinfect and wash hands through voice reminder, then the box door will automatically open and then put the medicine in, the box door will automatically close, automatically disinfect, and then notify the patient to take the medicine b) Medicine taking procedure: first disinfect and wash hands through voice reminder, then the box door will automatically open and then take out the medicine, the box door will automatically close, automatically disinfect, and then wait for the doctor to put the medicine in Theoretical analysis and calculation of face recognition method Face detection is the first step of the face recognition algorithm. The face recognition process is mainly divided into face image acquisition, face detection, face registration, face representation, and face image matching and recognition. The goal of face detection is to find the corresponding positions of all faces in the image. The output of the algorithm is the coordinates of the face circumscribed rectangle (ellipse) in the image. Thanks to the optimization of the .kmodel model by the hardware KPU of k210. MaxiHub is used to train the face model, store the face information of doctors or patients, realize face recognition to open the door, and reduce contact. 1. Load various models 2. Run the face detection model to find the face position in the picture and frame the face 3. 4. Convert the cropped face image into the format received by KPU . 5. Run the 5-point key point model of the face to obtain the positions of the left eye, right eye, nose, left corner of the mouth, and right corner of the mouth. 5. Perform an affine transformation on the original face image to transform it into a frontal face image, and convert the frontal face image into KPU format. 6. Use the 196-dimensional eigenvalue model of the face to calculate the 196-dimensional eigenvalue of the frontal face image, and calculate the final face feature feature. 7. Compare the obtained face features with the previously saved face features to obtain a set of scores, select the largest score, and if the score exceeds 80 points, the person is considered to be identified. Temperature difference correction system distance is the main factor affecting the accuracy of infrared temperature measurement. We use temperature measurement results at different distances for temperature compensation. The target temperature measurement distance (cm) measures the temperature.




36.5 19.33 35.35 1.29 36.5 16.61 35.49 1.01 Temperature deviation
36.5 132.14 33.97 2.53 36.5 109.38 34.45 2.05 36.5 92.77 34.63 1.93 36.5 88.38 34.75 1.87 36.5 65.25 34.91 1.75 36.5 56.15 35.05 1.59 36.5 43.23 35.21 1.45 36.5 19.33 35.35 1.29 36.5 16.61 35.49 1.01 Y: Compensated temperature value X: Distance (CM) Target temperature Measuring distance (cm) Measuring temperature Temperature deviation 36.5 82.42 36.69 -0.19 36.5 79.51 36.65 -0.15 36.5 60.86 36.59 -0.09 36.5 47.02 36.53 -0.03 36.5 28.27 36.44 0.06 36.5 20.25 36.45 0.05 36.5 19.55 35.40 0.10 36.5 14.94 36.38 0.12 36.5 8.95 36.31 0.19 From the above table, we can see that the temperature deviation is basically maintained at about 0.2, which can meet the use. *6. BOM list *7. Competition LOGO verification Please upload a project picture containing the competition logo. The logo is printed on the PCB in the form of silk screen. Click zip to download the competition logo! (Competition logo).zip * 8. Demonstrate your project and record it into a video. Upload video requirements: Please shoot horizontally, with a resolution of no less than 1280×720, in Mp4/Mov format, and a single video size limited to 100M; video title: Lichuang Electric Race: {Project Name}-{Video Module Name}; such as Lichuang Electric Race: "Autonomous Driving"-Team Introduction. More details: https://diy.szlcsc.com/posts/d76d9cb41705430e9a54e7a5feed07a5



