Design of a robotic arm control system based on a motion control chip
2026-04-06 06:14:33··#1
Abstract : In view of the characteristics of the linkage of each joint of the planar articulated manipulator, a low-level control system based on PIC16F877 microcontroller and motion chip LM629 was developed. By using an integrated motion chip such as LM629, the hardware circuit structure of the entire control system is simplified, and the reliability and control accuracy of the system are improved. Keywords : manipulator, PIC microcontroller, LM629, L298N controller Introduction Planar articulated manipulators are one of the most widely used types of manipulators. They can be used in actual production, as well as in teaching experiments and scientific research. In actual production, they can meet the requirements of frequent changes in assembly operations; in teaching experiments, they can enable people to intuitively understand the structure and motion principle of the robot [1]. Therefore, the development, design and research of planar articulated manipulators have the broadest practical significance and application prospects. The LM629 is a programmable all-digital motion control chip produced by National Semiconductor [2]. It has a 32-bit position, speed and acceleration register, a built-in PID algorithm, and its parameters can be modified. It supports real-time reading and setting of motion parameters such as speed, acceleration and position. The built-in ladder diagram generator can automatically generate speed curves and smoothly accelerate and decelerate. It supports 4 times the frequency input of incremental photoelectric encoder. The main frequency of the chip is 6MHz and 8MHz. Therefore, this paper uses LM629 and PIC16F877 to form the servo control system of the manipulator. 1 Manipulator Structure The actual photo of the planar joint manipulator designed in this paper is shown in Figure 1. It mainly includes three rotary joints (which control the rotation of the upper arm and lower arm and the opening and closing of the hand) and one moving joint (which controls the extension and retraction of the wrist). Figure 2 is a simplified model of the manipulator. Each joint uses a DC motor as the drive device. Incremental photoelectric encoders are also installed on the rotary joints of the upper arm and lower arm to provide feedback signals required for semi-closed-loop control. The motion control of the DC motor adopts a self-developed multi-joint control card based on LM629 and PIC16F877, and software that meets the motion control requirements has been programmed to realize the speed, position, and four-joint linkage control of the robot. Since the control systems of the four joint motors of the robot are basically similar, the following text will take a single joint motor as an example to introduce the control system design process of the planar joint robot. (This project was funded by the Science and Technology Commission of Shijingshan District, Beijing, and won the first prize in the 3rd "Keyuan Cup" College Student Science and Technology Activity jointly organized by the Science and Technology Commission of Shijingshan District and North China University of Technology.) Figure 1 Photograph of the robot 2 Control System Design 2.1 Working Principle of the Control System The single-joint DC motor servo drive system based on the LM629 chip and PIC16F877 microcontroller is shown in Figure 3. The motion chip LM629 is connected to the I/O port of the microcontroller PIC16F877 through 8 data lines and 6 control lines. The microcontroller sends position or speed commands and sets PID control parameters to the LM629 via a data line, and reads speed, acceleration, and other values from the LM629. The pulse width modulation amplitude signal and direction signal output by the LM629 directly drive the L298N, which, after power amplification, drives the DC motor. The incremental photoelectric encoder provides the feedback signals (A, B, IN) required for semi-closed-loop control, and the ladder diagram generator calculates the motion trajectory to be controlled in position or speed mode. The PIC16F877 provides the LM629 with acceleration, speed, and target position values. In each sampling cycle, these values are used to calculate new commands and position setpoints, which are then used as instruction values. The incremental photoelectric encoder detects the actual position of the motor, and its output signal is decoded after being quadrupled by the LM629 to form the position feedback value. The difference between the instruction value and the feedback value serves as the input to the digital PID correction stage. Through PID calculation by the digital regulator, the LM629 outputs a pulse width modulation signal (PWMM) and a direction signal (PWMS) to control the power chip L298N, thereby driving the motor to the specified position. While performing position control, the LM629 also controls the speed. After receiving the position signal from the host, the LM629 generates acceleration, constant speed, and deceleration speed curves according to the ladder diagram. The area enclosed by the curve and the horizontal axis of the coordinate is the specified position. The proportional, integral, and derivative coefficients in the PID algorithm sometimes need to be modified, so they are stored in the E2PROM of the microcontroller. The microcontroller and the PC communicate serially through the wireless transmission and reception modules. 2.2 Hardware Design of Control System The hardware structure of the control system of the planar articulated manipulator studied in this paper mainly includes a motion module, a power amplification module, a position detection module, and a communication module. (1) Motion and Power Amplification Module The motion and power amplification module is shown in Figure 4. The core chip of the motion module is the LM629. The 8-bit data ports D0 to D7 of the LM629 are connected to the RD0 to RD7 ports of the PIC microcontroller, and RC0 to RC3 are connected to the CS, RD, WR, and PS of the LM629 respectively, for controlling chip selection, data flow, etc. The LM629 receives position, speed or acceleration data from the microcontroller, and outputs pulse width modulation signal and direction signal through the internal ladder diagram generator and PID regulator. The output is provided by the pins PWMM and PWMS. The power amplifier module is mainly composed of the L298N chip and the current discharge circuit. The L298N is a bipolar H-bridge power amplifier circuit, which is connected to the output signals PWMM and PWMS of the LM629 through a logic gate circuit to control the forward, reverse and stop of the DC motor. An optocoupler 4N25 is added between the chips LM629 and L298N for electrical isolation, to protect the microcontroller and motion chip and reduce strong electrical interference. Since the DC motor is an inductive load, the power diode DIN5391 is selected to form the current discharge circuit to protect the power chip L298N. (2) Position detection module [3] The position detection module mainly detects and obtains the position of the motor shaft of each joint by detecting the incremental photoelectric encoder connected to the motor shaft. The circuit shown in Figure 5 synthesizes the differential signals (A+, A-, B+, B-, IN+, IN-) output by the incremental photoelectric encoder into single-ended signals A, B, and IN using a 75175 (only one signal synthesis is shown in Figure 5). The synthesized single-ended signals A, B, and IN are connected to pins A, B, and IN of the LM629, respectively. Using differential signal transmission can effectively solve the problems of interference and long-distance transmission. In order to further eliminate interference, a filter capacitor is added to each line at the input end, and a resistor for line impedance matching is connected between the two differential signal lines. The pulse signal fed back by the incremental code disk is frequency multiplied by 4, which improves the resolution. Each time the logic state of A and B changes, the position register of the LM629 is incremented (decremented) by 1. When A, B, and IN of the code disk are all low, an Index signal is generated and sent to the register to record the absolute position of the motor. (3) Communication Module The communication module mainly solves the human-machine interface problem [4]. In the control system designed in this paper, no display module and keyboard input module are designed. However, in practical applications, it is often necessary to input some parameters, such as PID parameters. Utilizing the rich resources and good user interface of the PC, the parameter input and display of the control system can be solved through serial port communication. 2.3 Software Design of the Control System The software part of the control system mainly includes an initialization module, a motion control module, a position detection module, and a communication module. The microcontroller determines the speed, acceleration, and position of each joint of the robot arm based on the information obtained by the position detection module, and transmits this information to the LM629. The speed curve is generated by the speed ladder diagram, and position control is performed. The PID regulator compensates the closed-loop system based on the input command and feedback information. Equation (1) represents the control signal output by the LM629. [align=center] [/align] The communication module establishes communication between the microcontroller and the PC. On the PC side, a serial communication program and parameter input interface are written using Visual C++. On the PIC16F877 side, a communication program is written in assembly language to realize bidirectional communication between the PC and the microcontroller. Figure 6 shows the flow of the main program and the interrupt subroutine. Conclusion This paper introduces the design method of a position servo control board for a planar articulated robot. The LM629 and PIC16F877 are used to construct the servo system for each joint of the robot. Compared with using a single-chip microcomputer to implement the robot control system, this method has advantages such as simple hardware circuit structure, high reliability, low cost, low CPU burden on the single-chip microcomputer, and good real-time control. This self-developed and manufactured control circuit board has a wide range of applications and achieves good results in mobile robots. References 1 Liu Min, You Bo, Xu Yanhe. Development of control system for planar articulated assembly robot. Heilongjiang Electric Power, 2004, 26(3): 190-193 2 LM628/629 programming guide. National semiconductor application note 693, 1999 3 Sun Disheng, Lou Xizhong. Design and application of position servo control board. Manufacturing Automation, 2001, 23(4): 34-37 4 Li Xuehai. Practical tutorial on PIC microcontrollers - advanced level. Beijing: Beijing University of Aeronautics and Astronautics Press, 2002