Design of a robotic arm control system based on motion control chip
2026-04-06 07:22:00··#1
Introduction Planar articulated robotic arms are among the most widely used types of robotic arms, applicable to both practical production and educational experiments and scientific research. In practical production, they can meet the requirements of frequently changing assembly tasks; in educational experiments, they allow for a direct understanding of robot structure and motion principles. Therefore, the development, design, and research of planar articulated robotic arms have the broadest practical significance and application prospects. The LM629, manufactured by National Semiconductor, is a programmable fully digital motion control chip. It features 32-bit position, velocity, and acceleration registers, a built-in PID algorithm with modifiable parameters, and supports real-time reading and setting of motion parameters such as velocity, acceleration, and position. Its built-in ladder diagram generator automatically generates velocity curves for smooth acceleration and deceleration. It supports 4x frequency input from incremental photoelectric encoders; the chip's main frequency is 6MHz and 8MHz. Therefore, this paper uses the LM629 and PIC16F877 to construct the servo control system for the robotic arm. 1. Robotic Arm Structure Figure 1 shows a photograph of the planar articulated robotic arm designed in this paper. It mainly consists of three rotary joints (controlling the rotation of the upper and lower arms and the gripping and opening/closing of the hand) and one locating joint (controlling wrist extension and retraction). Figure 2 shows a simplified model of the robotic arm. Each joint uses a DC motor as the drive device. Incremental photoelectric encoders are also installed on the rotary joints of the upper and lower arms to provide the feedback signals required for semi-closed-loop control. The motion control of the DC motors uses a self-developed multi-joint control card based on LM629 and PIC16F877, and software that meets the motion control requirements has been developed to achieve speed, position, and four-joint linkage control of the robotic arm. Since the control systems of the four joint motors of the robotic arm are basically similar, the following section will use a single joint motor as an example to introduce the design process of the planar articulated robotic arm's control system. Figure 1. Photograph of the actual robotic arm. Figure 2. Simplified model of the robotic arm. Note: 1—Body; 2—Large arm motor; 3—Photoelectric encoder; 4—Large arm; 5—Forearm motor; 6—Synchronous belt; 7—Photoelectric encoder; 8—Forearm; 9—Wrist lifting motor; 10—Hand gripper motor; 11—Hand gripper. 2. Control System Design 2.1 Working Principle of the Control System A single-joint DC motor servo drive system based on the LM629 chip and PIC16F877 microcontroller is shown in Figure 3. Figure 3. Schematic diagram of the control system. 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 to the LM629 through the data lines, sets PID adjustment parameters, 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 drives the DC motor after power amplification. The incremental photoelectric encoder provides the feedback signals (A, B, IN) required for semi-closed-loop control. The ladder diagram generator calculates the motion trajectory to be controlled in position or speed modes. The PIC16F877 provides acceleration, speed, and target position values to the LM629. These values are used to calculate new commands and position setpoints in each sampling cycle, serving as the command 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 command value and the feedback value serves as the input to the digital PID correction stage. Through PID calculation, the LM629 outputs pulse width modulation (PWMM) and direction (PWMS) signals to control the power chip L298N, thereby driving the motor to the specified position. The LM629 controls both position and speed simultaneously. 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 represents 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 transmitter and receiver 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 amplifier module, a position detection module, and a communication module. (1) Motion and Power Amplification Module The core chip of the motion module is LM629. The 8-bit data ports D0"D7 of the LM629 are connected to the RD0"RD7 ports of the PIC microcontroller. RC0"RC3 are connected to the CS, RD, WR, and PS pins of the LM629 respectively, used for chip select and data flow control. The LM629 receives position, velocity, or acceleration data from the microcontroller, processes it through its internal ladder diagram generator and PID controller, and outputs pulse width modulation (PWM) and direction signals via the PWMM and PWMS pins. The power amplifier module mainly consists of the L298N chip and a current discharge circuit. The L298N is a bipolar H-bridge power amplifier circuit, connected to the LM629 output signals PWMM and PWMS through a logic gate circuit to control the forward, reverse, and stop of the DC motor. An optocoupler 4N25 is added between the LM629 and L298N chips for electrical isolation, protecting the microcontroller and motion chip and reducing strong electrical interference. Since the DC motor is an inductive load, a power diode DIN5391 is selected to form a current discharge circuit to protect the L298N power chip. (2) Position Detection Module The position detection module in Figure 4 synthesizes the single-ended differential signal. It primarily detects the position of each joint of the motor shaft by using an incremental photoelectric encoder connected to the motor shaft. The circuit shown in Figure 4 synthesizes the differential signals (A, A-, B, B-, IN) output by the incremental photoelectric encoder. The single-ended signals A, B, and IN are synthesized by 75175 (only one signal synthesis is shown in Figure 4). The synthesized single-ended signals A, B, and IN are connected to pins A, B, and IN of LM629, respectively. 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 of the incremental code disk feedback is multiplied by 4 to improve the resolution. Each time the logic state of A and B changes, the position register of 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. 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. Using the rich resources and good user interface of the PC, the parameter input and display of the control system are 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 controller compensates the closed-loop system based on the input command and feedback information. Equation (1) represents the control signal output by the LM629. In the programming process, the incremental PID algorithm is usually used. The communication module establishes communication between the microcontroller and the PC. On the PC side, the serial communication program and parameter input interface are written using Visual C++. On the PIC16F877 side, the communication program is written in assembly language to realize bidirectional communication between the PC and the microcontroller. Figure 5 shows the flow of the main program and the interrupt subroutine. Figure 5 Flow of the communication program between the PC and the PIC16F877 3. 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 implementing a robot control system solely using a microcontroller, this method offers advantages such as simple hardware circuit structure, high reliability, low cost, low CPU load on the microcontroller, and good real-time control. This self-developed and manufactured control circuit board has a wide range of applications and achieves excellent results in mobile robots.