Share this

Design and Implementation of Embedded Stepper Motor Control System

2026-04-06 05:41:53 · · #1
Abstract: The working principle of stepper motor is introduced, and an embedded design method for stepper motor is proposed. An advanced ARM controller is adopted to realize the control method combining software and hardware. The software replaces the pulse distributor to achieve the best control of stepper motor. Keywords: stepper motor; embedded; ARM controller 0. Introduction Embedded system is an application-centered, computer technology-based, and software and hardware-customizable dedicated computer system suitable for application systems with strict requirements on function, reliability, cost, size, power consumption, etc. [1]. Since the birth of the world's first microprocessor designed for embedded applications in the 1970s, it has developed for decades. Today, embedded system has become one of the most growing branches in the electronic information industry. With the development of microelectronics technology, the application of embedded control system in intelligent and automated industrial production is becoming more and more popular. In particular, with the large-scale application of emerging products such as mobile phones, PADs, GSPs, and set-top boxes, the market for embedded systems is increasing at a rate of 30% per year. The design of embedded systems has also become an increasingly important issue for software and hardware engineers. Stepper motors are commonly used actuators in industrial control, offering advantages such as flexible control and low cost, making them widely adopted in many devices and equipment. An embedded stepper motor controller integrates a microprocessor into the motor controller, enabling it to provide corresponding control logic based on the set number of phases, number of steps, and the number of steps taken by a single trigger pulse. 1. Working Principle of Stepper Motors A stepper motor is an electromechanical component that converts electrical pulse signals into angular or linear displacement; it is essentially a single-phase or multi-phase synchronous motor. Currently, there are three common types of stepper motors: reactive stepper motors (VR), permanent magnet stepper motors (PM), and hybrid stepper motors (HB). Taking a reactive three-phase stepper motor as an example, its working principle is explained: the stator core has six identical large teeth, with an included angle of 60° between adjacent teeth. Each large tooth has a coil, and two radially opposite coils are connected in series to form a winding. The inner surface of each large tooth also has several evenly distributed small teeth. The rotor is a cylindrical iron core with small teeth evenly distributed circumferentially on its outer surface. The tooth pitch of the rotor teeth is the same as that of the stator. The design should ensure the rotor tooth count is divisible by 2. When a winding is energized and the rotor can rotate freely, the small teeth under the two large teeth of that phase will attract nearby rotor teeth, causing the motor to rotate until the rotor teeth align with the stator teeth of that phase. Meanwhile, the small teeth under the large teeth of the other two phases will be offset from the rotor teeth by 1/3 of the tooth pitch, creating a "tooth misalignment," thus forming an electromagnetic attraction that keeps the motor rotating continuously. Permanent magnet stepper motors and hybrid stepper motors require winding currents to flow in both forward and reverse directions; therefore, the drive circuit is generally designed for bipolar drive. 2. Corresponding Hardware and Software Configuration Hardware Environment: Primarily includes an ARM embedded development board; a JTAG emulator for ARM7TDMI; and a Pentium 100 or higher PC. Software Environment: PC operating system Windows 98 or later, ARM SDT2.51 or ASD1.2 integrated development environment, emulator driver. 3. Implementation of Stepper Motor on the Development Board The stepper motor used on the development board is a four-phase stepper motor with a rotor tooth count of 64. The system uses four I/O channels for parallel control. The ARM controller directly sends multi-phase pulse signals, which are amplified and then enter the windings of each phase of the stepper motor. This eliminates the need for a pulse distributor, and its function can be implemented purely in software. The connection method is shown in Figure 1: [align=center] Figure 1 Connection of a four-phase stepper motor on the development board[/align] There are three control methods for the four-phase stepper motor: four-phase single four-step, four-phase single, double eight-step, and four-phase double four-step. The formula for calculating the step angle is: where m is the number of phases, C is 1 for four-phase single four-step and four-phase double four-step control methods, C is 2 for four-phase single and double eight-step control methods, and Zk is the rotor tooth count. We use a four-phase single/double eight-step control method, so the step angle should be 360°/512/8. The UP-NETARM300 development platform uses the high four bits of EXI/O to control the four phases of the four-phase stepper motor. According to the four-phase single/double eight-step control method, the control sequence for forward rotation is A →AB →B →BC →C →CD →D →DA. The values ​​of the high four bits of EXI/O are shown in Table 1. Table 1: Values ​​of the high four bits of EXI/O when the motor rotates forward. To reverse the rotation, simply provide the control signals in the reverse order. 4. Implementing Stepper Motor Control Using ARM Assembly Language After understanding the working principle of the stepper motor, the program manipulates the high four bits of the 74HC573 to complete the pulse distribution for the stepper motor. To call an assembly program from a C program, two things need to be done: First, declare the external function using the `extern` keyword in the C program, which means declaring the assembly subroutine to be called. Second, declare the assembly subroutine to be called from C using the `export` pseudo-instruction. After using the `export` declaration, other programs can call this assembly program. For example: 4.1 Calling an assembly program in C #include extern void strcopy(char *d,const char *s); int main() { const char *srcstr=”First string-source”; char dststr[]=”Second string - destinnation”; printf(“Before copying:\n”); printf(“ %s\n %s\n”,srcstr,dststr); strcopy(dststr,srcstr); printf(“After copying:\n”); printf(“ %s\n %s\n”,srcstr,dststr); return (0); } 4.2 Assembly language string copying subroutine AREA Scopy, CODE, READONLY EXPORT strcopy ; This line ensures that other programs can call this program Strcopy LDRB r2, [r1],#1 ; After loading bytes, increment the address by 1 STRB r2, [r1], #1 ; After saving the byte, increment the address by 1. CMP r2, #0 ; Compare whether r2 is zero. BNE Strcopy ; If r2 is not equal to zero, jump. MOV pc, 1r ; Return to END. 4.3 Schematic Diagram Figure 74 HC573 Control Principle 4.4 The program used is as follows: AREA STEP, CODE, READONLY EXPORT STEPCTROL STEPCTROL START MOV R0, #0 ADR R2, TABLE ; Store the table header address in R2. LOOP LDR R5,=0x0a000000herb; bank5, put the address to be written into R5. LDRB R1,[R2], #1 ; Note that here, the data (one byte) in R2 is first sent into R1, and then the address represented by the content of R2 is incremented by 1. STRB R1, [R5] ; Send the data in R1 into the address represented by the data in R5. MOV R1, #0 ;From this sentence to DELAYOVER, there is a two-level nested loop with delay. REPEAT ADD R1,R1,#1 ;Increment the value in R1 by 1 and put it back into R1. CMP R1, #400 ;Compare [R1] and 400. BNE NEXT1 ;If the above comparison result is not equal, jump to B. DELAYOVER NEXT1 MOV R3, #2 NEXT2 ADD R3, R3, #2 CMP R3, #40 BNE NEXT2 ;Compare the data in R3 with 40. If they are not equal, jump to B. REPEAT DELAYOVER ADD R0, R0, #1 ;Control the loop to run eight times. CMP R0, #8 ;Compare 8 with the number in R0. BNE loop ;If the above comparison result is not equal, jump to loop, otherwise execute the next statement. B. START TABLE DCB ox10, ox30, ox20, ox60, ox40, oxc0, ox80, 5. Conclusion Embedded stepper motor controllers offer advantages such as low cost, ease of application, and strong versatility, making them highly valuable for widespread adoption. This paper describes the implementation of four I/O channel output control for an ARM processor using assembly language, achieving ring pulse distribution for stepper motor control. Embedded technology can significantly reduce system size and weight. In harsh environments, ARM-based systems can improve system reliability and stability. The author's innovation lies in the application of an ARM-based embedded system in a stepper motor controller, implementing ring pulse distribution for stepper motor control, suitable for harsh environments. References: [1] Pan Jijun. Experimental analysis of embedded system based on ARM[J]. Microcomputer Information, 2006, 2-2: 129-131, 66 [2] Wayne Wolf. Principles of embedded computer system design. Translated by Sun Yunfang et al. Beijing: Machinery Industry Press[M], 2002 [3] Embedded system design and example development experimental textbook 1. Wei Hongxing, Zhou Yimin. Beijing: Tsinghua University Press[M], 2005.9 [4] Li Zhongjie. Application technology of stepper motor[M]. Beijing: Machinery Industry Press, 1988. [5] Wind River System Inc. VxWorks NetWork Programmer's Guide [Z] [6] Liu Baoyan et al. Stepper motor and its drive control system[M]. Harbin: Harbin Institute of Technology Press, 1997.
Read next

CATDOLL 146CM Tami TPE

Height: 146cm A-cup Weight: 26kg Shoulder Width: 32cm Bust/Waist/Hip: 64/54/74cm Oral Depth: 3-5cm Vaginal Depth: 3-15c...

Articles 2026-02-22