Abstract: Medical rehabilitation robot is a new type of robot that has appeared in recent years. Its main function is to help patients complete various motor function recovery training. To this end, it is proposed to control the operation of the robot arm by controlling the brushless DC motor through the STM32 microcontroller, and establish a PID model through Simulink , and use XPC_Target to communicate with the control board to obtain the appropriate PID parameters of the motor during the speed regulation process, so that the robot arm can operate more smoothly. The actual clinical trial operation proves that the system can better complete the medical rehabilitation training of the arm.
As my country gradually enters an aging society, the demand for various types of rehabilitation equipment is increasing, and the demand for cost-effective medical rehabilitation equipment control systems is particularly urgent. DSP chips are relatively expensive, complex in design, and have a long R&D cycle. The size of the chip will lead to a larger printed circuit board.
This article designs a medical rehabilitation robot arm control system based on the STM32 microcontroller . It has an advanced timer for outstanding power consumption control and motor control, and can generate three pairs of configurable and complementary output PWM signals. By building a double closed-loop PID algorithm model on Simulink , the appropriate PID parameters are obtained to change the duty cycle of the PWM wave, and then the motor speed is accurately adjusted, ensuring the smooth running trajectory and stable running speed of the robot arm. Due to the advantages of small size and stable performance of brushless DC motors, the size of the robot arm can be more in line with the design concept of human kinematics.
1 Overall design
The medical rehabilitation robot arm can simulate some arm movements in daily life and achieve movement training of each arm joint, muscle training, and nerve function recovery training by creating a virtual working environment. With the STM32 microcontroller as the control core, the overall design scheme of the robot arm control is shown in Figure 1.
By using the IR2130 gate driver chip, the 6-channel PWM signals output by STM32 are specially processed to meet the working requirements of the IRF3808 high-power MOS tube in the H-bridge.
The STM32 microcontroller controls the operation of the motor by changing the commutation timing by continuously detecting the Hall signal in the brushless DC motor. When the motor is stalled, it will generate a large current, and the current value will be sampled through the ADC. When the value exceeds the threshold, the motor can be stopped. At this time, the IR2130 will automatically enter the self-protection state and shut down the output signal to ensure the safety of the arm operation.
2 Hardware Circuit Design
2.1 Gate drive
The gate drive chip uses the IR2130 chip from International Rectifier, which has high voltage, high speed, and 3 independent high and low side power MOSFET drive output channels. Its input and output signal timing is shown in Figure 2. It has over-current protection and under-voltage lockout functions, and can shut down 6 outputs in time. When an abnormal state occurs, the inverter circuit is in the off state, which can protect the motor from burning out and has a self-protection function.
Three of the six output signals have level conversion functions, so they can drive both the low-voltage side power devices and the high-voltage side power components in the bridge circuit. As shown in Figure 3, the three pairs of complementary PWM signals output by the STM32 to drive the H-bridge are increased to a voltage level that can drive the MOSFET switch.
One IR2130 can replace three IR2110s and only requires one input stage power supply to automatically generate the dead zone required for upper and lower side driving with a time of 2.5μs and obtain better control performance.
2.2 H-bridge power circuit
High-power FETs can output high voltages. The inverter circuit is mainly composed of 6 high-power FETs IRF3808, as shown in Figure 4. Each FET is connected in parallel with a reverse-connected fast recovery diode, which has the function of protection and freewheeling. For a 24 V motor, the VDS of the FET requires at least 40 V, and the drain current must be high enough to cope with the motor starting current. The starting current can be further reduced due to the soft acceleration mechanism implemented in the software (a small increase to the required speed).
2.3 Current detection circuit
Use a 0.01 Ω current detection resistor or a serpentine ground wire, and all the currents passing through the motor and MOSFET pass through it and flow to the ground. As shown in Figure 5, the total current passing through the motor flows to the ground through this small resistance resistor. The resistance of this current detection resistor is very small, but if the current is large enough, a small voltage will be generated at both ends. The first-order low-pass filter circuit formed by RC can filter out some occasional instantaneous high-frequency components. Its cut-off frequency can be calculated by the specific value of RC. Finally, it can be connected to the ADC channel of STM32 for current acquisition.
2.4 Motor Torque
For the motor, the robot arm is under load during operation, so there must be enough torque to ensure the normal operation of the arm. Like speed control, the torque is also determined by the current through the stator coil. The maximum torque and the angle between the stator and rotor magnetic fields should be maintained at 90°. Trapezoidal commutation is shown in Figure 6. The control resolution is 60°, and the angle between the stator and rotor magnetic fields is in the range of -30° to +30°, which will produce torque pulsation.
The RC low-pass filter in the current detection process can filter out the high-frequency instantaneous pulses flowing into the motor and improve the motor torque characteristics. When changing the direction of operation, in order to obtain a relatively large torque, the direction of operation is changed directly, and the robot arm direction is changed by running-stopping-reverse running. This can prevent the robot arm from shaking when turning, and also prevent the starting current from being too large when starting again, which is prone to stalling and damage to the hardware circuit and motor.
3 Software Design
3.1 μC/OS—II Operating System
In order to make the software architecture more stable and clear, a curable, customizable, preemptive multi-tasking real-time operating system μC/OS-II is used. It is a preemptive real-time kernel based on priority scheduling, and provides the most basic system services on top of this kernel, such as semaphores, mailboxes, message queues, memory management, interrupt management, etc.
On the μC/OS-II embedded operating system, the priority of the Hall signal capture interrupt, host computer communication interrupt, ADC acquisition interrupt, and PID speed regulation interrupt in the brushless DC motor is allocated, and the software operation is made more modular by creating tasks such as the direction of operation, start, stop, host computer communication, and PID regulation of the medical rehabilitation arm. Information is transmitted between tasks through mailboxes, message queues, etc., and corresponding tasks can be suspended and started mutually, so that tasks can work in coordination and the software architecture is clearer.
3.2 Motor speed measurement and six-step commutation
The actual speed of the brushless DC motor can be obtained by measuring the Hall sensor signal. During the rotation of the motor, three periodic signals as shown in Figure 7 can be obtained through three Hall sensors distributed 120 degrees in the motor.
Each time the motor rotates one circle, each Hall sensor generates a 2-cycle square wave signal, and its cycle is inversely proportional to the motor speed. Its structure is more convenient and flexible than adding an encoder to the periphery.
The timer of the STM32 microcontroller has a port for detecting Hall signals. The timer performs XOR processing on the three Hall signals detected. When it can capture the rising edge, it triggers an interrupt request. The time required to generate this interrupt is recorded in the interrupt, and the timer is cleared. The control process operation is shown in Figure 8. The average value is calculated through several interrupt times, and the obtained time average value is converted into the speed value of the motor. The motor 6-step commutation timing is performed by the high and low level values of the three Zhai Er sensors detected, which can make the brushless DC motor operate according to the timing requirements.
3.3 Motor PID Algorithm
Since both the human arm and the robot arm structure have weight, they will be affected when the motor is running, causing the motor speed to change continuously, which is not conducive to the stable operation of the robot arm. Therefore, it is necessary to perform a double closed-loop PID operation on the measured speed value and the set speed value to keep the motor running speed at the set speed value. As shown in Figure 9, the PID algorithm of the motor is implemented by changing the duty cycle of the phase voltage pulse width modulation (PWM) wave. By increasing or decreasing the duty cycle, part of the current will flow through the stator coil in each commutation step, which will affect the stator magnetic field and magnetic flux density, thereby changing the force between the rotor and the stator.
By obtaining the difference between the set value of the brushless DC motor speed (set by the host computer) and the actual detected motor speed value, PID adjustment is performed through the speed PID control loop and the current PID control loop to change the duty cycle of the PWM wave of the STM32 output drive motor operation signal, so that the robot arm can run smoothly and stably.
4 PID model design
The real-time target system XPC_Target based on the RTW framework developed by MathWorks is used for modeling, which provides a low-cost, high-performance system that can be easily used in real time. The host + target machine technology is adopted, that is, the "dual machine" mode. The host and target machines can be different types of computers, and the two communicate through Ethernet. The implementation model is shown in Figure 10.
According to the working principle, its implementation is divided into the following steps:
(1) Use a USB drive to create a DOS target boot disk
There are three modes of boot disk: FDD, HDD and ZIP. You can choose the mode supported by the target machine during the production process. You can make the target boot disk by selecting the embedded option of XPC_Target. By calling and starting the real-time kernel of XPC_Target through a USB flash drive, you can automatically run the target application every time the system starts.
(2) Simulink model establishment
By adding various driver modules on the host machine's Simulink, the PID models of the current loop and speed loop in the motor speed regulation process and the serial communication module of the lower machine are established. Then, the RTW code generator and C compiler are used to generate executable code for real-time operation on the target machine.
(3) Signal acquisition process
The signal data of the target application is stored in the RAM of the target machine through the XPC_Target real-time kernel, and the signal is monitored, recorded, tracked, and drawn on the display interface of the target machine. When the lower computer sends the speed measurement value to the executable code generated by the PID model established in Simulink running on the target machine through the serial port, the speed is adjusted through the executable code program, and the adjusted data is sent to the lower computer through the target machine, thereby changing the PWM wave duty cycle of the drive motor operation signal. When its speed measurement value can stabilize to the speed setting value, the PID parameters set in Simulink are the PID parameter values required for speed adjustment. Otherwise, the PID parameter model established in Simulink needs to be changed.
Conclusion
This paper proposes a control system for a medical rehabilitation robot arm based on an STM32 microcontroller . At present, the prototype of this system has been clinically tested and has achieved good experimental results. The robot arm in the experiment has three degrees of freedom and can realize the training of shoulder joints, elbow joints, etc. By using the IR2130 gate driver chip, the board size, system stability and design flexibility are improved. The PID parameter model is designed on Simulink, and the brushless DC motor is driven by the STM32 microcontroller driver board. At the end, the trainer's arm is driven to train on fixed trajectories in the horizontal and vertical planes respectively, and the collected running trajectory, speed image, and the pre-set arm running trajectory and speed image are compared and observed. The robot arm runs smoothly and the PID parameters are stable, which further enhances the stability and flexibility of the system.
Previous article:Design of a fall alarm based on inertial sensing technology
Next article:Fluke SigmaPace 1000 External Pacemaker Analyzer is here to protect you
Recommended ReadingLatest update time:2024-11-23 10:31
- Popular Resources
- Popular amplifiers
- Chen Han from Rouling Technology: Bringing small, flexible brain-computer interface sleep devices to every household
- Li Xiaojian of Weiling Medical: Brain-computer interface technology is opening a new era of integration of consciousness and AI
- Geng Dong of Jingyu Medical: Brain-computer interface DBS treatment technology has achieved domestic substitution
- Wang Changming from Capital Medical University: Digital therapy for epilepsy has entered the use stage
- Shi Chunbo of Qianqiu Intelligent: Using digital therapy to illuminate the light of children with autism
- Feng Shang, Digital Medicine Intelligence: ADHD digital therapy is providing more effective and convenient services for children with ADHD
- Ultrasound patch can continuously and noninvasively monitor blood pressure
- High-speed 3D bioprinter is available, using sound waves to accurately build cell structures in seconds
- [“Source” Observation Series] Application of Keithley in Particle Beam Detection Based on Perovskite System
- Intel promotes AI with multi-dimensional efforts in technology, application, and ecology
- ChinaJoy Qualcomm Snapdragon Theme Pavilion takes you to experience the new changes in digital entertainment in the 5G era
- Infineon's latest generation IGBT technology platform enables precise control of speed and position
- Two test methods for LED lighting life
- Don't Let Lightning Induced Surges Scare You
- Application of brushless motor controller ML4425/4426
- Easy identification of LED power supply quality
- World's first integrated photovoltaic solar system completed in Israel
- Sliding window mean filter for avr microcontroller AD conversion
- What does call mean in the detailed explanation of ABB robot programming instructions?
- STMicroelectronics discloses its 2027-2028 financial model and path to achieve its 2030 goals
- 2024 China Automotive Charging and Battery Swapping Ecosystem Conference held in Taiyuan
- State-owned enterprises team up to invest in solid-state battery giant
- The evolution of electronic and electrical architecture is accelerating
- The first! National Automotive Chip Quality Inspection Center established
- BYD releases self-developed automotive chip using 4nm process, with a running score of up to 1.15 million
- GEODNET launches GEO-PULSE, a car GPS navigation device
- Should Chinese car companies develop their own high-computing chips?
- Infineon and Siemens combine embedded automotive software platform with microcontrollers to provide the necessary functions for next-generation SDVs
- Continental launches invisible biometric sensor display to monitor passengers' vital signs
- Introduction to the classification and manufacturing methods of PCB copper-clad laminates
- Notes and additional information about Espressif development boards
- Learn LLC switching power supply calculation from senior engineers
- Problems that should be paid attention to in the development and design of TMS320C2XX
- EEWORLD Oscilloscope Questionnaire Prize Survey
- Goodbye 2018, hello 2019
- STM32 related altium library files (F0, F1, F2, F3, F4, etc.)
- "Me and Intel SoC FPGA" + ARM hardcore development that is difficult to understand
- Practical capacitor voltage step-down circuit
- Today's award-winning live broadcast: 5G and edge computing development and technology applications