Design of a three-axis rotary table controller based on PC/104 and stepper motors
2026-04-06 04:47:46··#1
Abstract: This paper describes the design and implementation of a three-axis rotary table controller based on PC/104 and stepper motors. The controller uses PC/104 as the central processing unit, offering good system compatibility, strong expandability, and a short software development cycle. A 48-channel high-drive digital output board (HSM-3221/3222) is used as the I/O board for interface circuit design. Most logic is implemented within the PC/104, resulting in high reliability and strong anti-interference capability. Stepper motor control is primarily achieved through software control, which is simple, convenient, and resource-saving. Keywords: Stepper motor; PC/104; Rotary table controller 1 Introduction Stepper motors are widely used in electromechanical equipment. Stepper motor servo systems, consisting of control and drive devices, are widely used in economical CNC machine tools, robots, industrial process control, and instrumentation. In the past, stepper motor control and drive circuits designed purely by circuits often had complex circuit structures, used many components, were costly, and had poor versatility. Employing microcomputing technology and software programming methods can avoid complex circuit designs, reduce component costs, and make stepper motor control more versatile and flexible. Our controller design uses a PC/104 as the stepper motor control system to effectively control the direction, speed, and angle of a three-axis rotary table. Therefore, based on the actual application, we focused our main efforts on the design of the control software. 2. System Hardware Implementation The embedded PC/104 computer is a new type of computer that has emerged in recent years. Due to its ease of use, it is increasingly being used in various control systems. It integrates a computer into a small circuit board module, including a CPU, memory, two RS-232 serial ports, and one parallel I/O bus; it supports CRT/LCD display to show the system's operating status in real time; it has hard disk and floppy drive interfaces; it has a certain capacity Flash disk to store control software and related data; and it allows for easy high-level language programming. Due to its high integration, the hardware design of the control system is greatly simplified, and its reliability is improved; it is equipped with an operating system, which facilitates software development; it has a fast processing speed, and the real-time performance of the control system is significantly better than that of traditional microprocessors; in addition, it can be easily expanded with different interface boards such as A/D, D/A, I/O, and Timer according to system needs, and has good expandability. The system uses PC/I/O, and the circuit is simple, reliable, and compact. For the control of different models of stepper motors, no hardware circuit changes are required; multiple controls can be achieved by modifying the software, which is flexible, convenient, versatile, low-cost, and has a wide range of applications. In the interface circuit, we use a 48-channel high-drive digital output board (HSM-3221/3222) as the I/O circuit. The HSM-3221/3222 board is a 48-channel high-drive digital output board based on the PC/104 bus. Its maximum output current reaches 250mA. These 48 digital I/O channels can be divided into two groups of 24 digital I/O channels, each group further divided into three 8-bit interfaces. The core chip of this board is the 82C55A. The difference between the HSM-3222 and HSM-3221 is that the HSM-3222 has pull-up resistors at its output terminals, and the resistors can be selected according to actual needs (e.g., 5.6K, 10K, etc.). Its software development method is flexible and convenient, and system modifications are quick and easy, thus reducing design risks. This controller is implemented through an open-loop circuit, therefore the system hardware is relatively simple, and its overall structure is shown in Figure 1. The entire system consists of a PC/104 bus, a display, a keyboard, the HSM-3221/3222, and stepper motors and their drivers. [align=center]Figure 1 System Overall Structure Diagram[/align] The microcomputer is connected via a PC/104 standard interface and interface circuit. The interface board consists of HSM-3221/3222 and necessary peripheral circuits. It receives action commands from the CPU and converts these commands into corresponding pulse and direction signals. These signals are then used to control the stepper motors via stepper motor drivers, thereby completing the task of rotating the three-axis rotary table to the required angle. Here, we choose DOS 6.22 as the computer operating system and Turbo C 2.0 as the software development environment, both of which occupy relatively little storage space. The system control is primarily software-based. In this control method, the microcomputer only needs to send pulse count and pulse direction commands to the interface circuit, which then forwards them to the stepper motor drivers to control the motion of multiple stepper motors. This achieves the control of the three axes of the three-axis rotary table. 3 System Software Implementation Since this controller primarily uses software control, this part is the focus of this design. The advantage of software control is that it is easy to modify and problems are easier to find and resolve. Therefore, it has high application prospects. The system software flow is shown in Figure 2. The entire program mainly consists of three parts: controlling the unidirectional rotation of the stepper motor, reciprocating rotation, and zeroing to control the turntable's operation. During initialization, the required rotation angle and speed of the turntable are input via the keyboard, and then the rotation mode of the turntable is still controlled by the keyboard. It is worth noting that in the reciprocating motion, "take the original pulse number * 2" because the reciprocating motion refers to the back-and-forth movement between the positive and negative values of the angle input during initialization. [align=center]Figure 2 System Software Flowchart[/align] The following is the main part of the source program written in TurboC2.0 under DOS environment: Taking one axis as an example, the program is as follows: /*————————Calculate the number of step pulses:——————-*/ phy_num=(phy_yz-phy_dq)*113; if(phy_num<0) { phy_right=0; phy_num= - phy_num; } else phy_right=1; /*————————-Number of pulses sent:————————-*/ for(;;) { if(phy_num>0) { if(phy_right==1) phy|=0x02; else phy&=0xfd; phy|=0x01; outportb(base+0,phy); } delay(phy_sl); if(phy_num>0) { phy&=0xfe; outportb(base+0,phy); phy_num——; if(phy_right==1) phy_dq=phy_dq+1.0/113; else phy_dq=phy_dq-1.0/113; } /*——————————-Press any key to pause————————————-*/ if(kbhit()) break; /*————————Count to zero, stop working————————-*/ if(phy_num==0) break; } After running, it was determined that this controller works well and meets the design requirements. 4 Conclusion This paper introduces a three-axis rotary table controller that uses PC/104 and HSM-3221/3222 as the core design interface circuit and stepper motor. The system structure is small and compact, the performance is stable and reliable, the control is simple and efficient, and the human-machine interface is user-friendly. This controller is used in the motion control system of a three-axis rotary table and the effect is good. References: [1] Chen Yun, et al. Hardware and software implementation of stepper motor controller based on ISA bus. Combined machine tool and automated machining technology, 2002 (7). [2] Huo Yinghui, Chen Yuxiang. Microcomputer and single-chip microcomputer control of stepper motor [J]. Electrical Engineering, 2003 (3). [3] Yang Shuguo, et al. Computer control and motion planning of multiple stepper motors [J]. Journal of Harbin University of Science and Technology, 2000 (3). [4] Hou Shuming. HSM-3221/3222 instruction manual. Download design data of three-axis rotary table controller based on PC/104 and stepper motor.