Share this

A general-purpose stepper motor controller based on the MSP430F149 microcontroller

2026-04-06 06:38:33 · · #1
Abstract : This paper mainly introduces a general-purpose stepper motor controller implemented based on the MSP430F149 microcontroller. This controller can simultaneously control multiple stepper motors to operate in a curve-like manner, including acceleration/deceleration, positioning, and commutation functions. The paper focuses on the design scheme and implementation method of the stepper motor's acceleration/deceleration curve. Keywords: MSP430F149, microcontroller, stepper motor, general controller Abstract: This paper introduces the design of a step-motor controller based on the MSP430F149. The controller can control multiple step-motor systems simultaneously, enabling multi-curve motor operation including speed-up, speed-down, and changes in orientation and direction. It mainly discusses the design method for fulfilling the speed control curve. Keywords: MSP430F149, single chip, step-motor, general controller 1. Introduction Stepper motor-based control systems generally require a dedicated driver power supply in addition to the stepper motor itself. The driver power supply only handles the power drive; users cannot control the entire control system to operate in the predetermined, desired state. Therefore, the driver power supply must be controlled, requiring further development by the user. In view of this, a general-purpose stepper motor controller based on the MSP430F149 microcontroller was designed, which can meet the requirements of most control applications. The main functions of the controller are: ① It can control multiple stepper motor drive systems; currently, it can control 3 systems simultaneously. ② It has flexible operating modes, can run according to a set curve, with a maximum of 8 curve segments; it can run according to externally detected control signals; it can run according to the simulation adjustment and testing function; 2. System Design 2.1 System Structure This controller mainly realizes the operation control of multiple stepper motors on multiple curve segments. The system structure is shown in Figure 1. [align=center][img=]http://www.mcu99.com/Article/UploadFile/200612/20061203124245647.gif[/img] Figure 1 System Structure Block Diagram[/align] 2.2 Microprocessor Selection This design uses the MSP430F149 microcontroller from TI. The purpose is to utilize its rich interface resources and powerful timer functions. The performance characteristics of the MSP430F149 are as follows: ① Six 8-bit parallel interfaces; capable of handling all signal inputs and outputs of the system without hardware expansion. Each line of the P1 and P2 8-bit parallel ports has interrupt functionality, greatly simplifying the keyboard's hardware and software design. ② 12-bit A/D converter (ADC); enabling analog setting functions. ③ Powerful timer functions; TIMER-A3 and TIMER-B7 are 16-bit timers with 3 and 7 capture/compare registers respectively, meeting the requirements for system speed setting and curve timing. ④ LCD driver module; ⑤ Built-in 2KB RAM and 60KB FLASH; The abundant resources provided by the MSP430F149 require minimal work for peripheral hardware expansion, simplifying the design process and resulting in a small, highly reliable controller. 2.3 Stepper Motor Starting and Acceleration/Deceleration Control Scheme The maximum starting frequency (jump frequency) of a stepper motor is generally 0.1 kHz to 3-4 kHz, while the maximum operating frequency can reach N * 10^2 kHz. Starting directly at a frequency exceeding the maximum starting frequency will result in "step loss" or even failure to start. An ideal starting curve should follow an exponential starting pattern. However, in practical applications, the starting segment can be handled using a linear fitting method, i.e., the "stepped acceleration method." This can be handled in two ways: ① If the jump frequency is known, start in segments according to the jump frequency, with the number of segments n = f/fq. ② If the jump frequency is unknown, fit the frequency segment to the given starting frequency, with the increment of each segment (hereinafter referred to as the step frequency) Δf = f/8, i.e., use 8 segments for fitting. During operation control, the initial speed (frequency) is divided into n segments as step frequencies. The speed is continuously increased to the required speed using a "step-up speed-up method," then locked and operated according to a preset curve. See Figure 2. [align=center]Figure 2 Step-up Speed-up Start[/align] Using a microcontroller to implement acceleration/deceleration control of a stepper motor essentially involves controlling the frequency of pulses. During acceleration, the pulse frequency increases; during deceleration, the opposite occurs. If a timer interrupt is used to control the motor speed, acceleration/deceleration control involves continuously changing the initial value of the timer. If the speed increases linearly from V1 to V2, it accelerates/decelerates according to a given slope; if it changes abruptly, it is handled using the "step-up speed-up method." Two issues need to be addressed in this process: ① The speed conversion time should be as short as possible. To shorten the speed conversion time, a data table can be created. By combining the frequency of each curve segment and the step frequencies between segments, a continuous data table can be established, which can then be converted into a timer initial value table through a conversion program. By calling the corresponding timer initial values ​​at different stages, the motor's operation is controlled. The calculation of the initial value of the timer is implemented outside the timer interrupt and does not occupy the interrupt time, ensuring the high-speed operation of the motor. ② Ensure the accuracy of speed control; to accurately reach another speed from one speed, a verification mechanism must be established to prevent exceeding or failing to reach the required speed. 2.4 Commutation problem of stepper motor When commutating the stepper motor, it is necessary to commutate only after the motor has slowed down and stopped or has slowed down to within the jump frequency range, so as to avoid generating a large impact and damaging the motor. The commutation signal must be issued after the last CP pulse of the previous direction ends and before the first CP pulse of the next direction. As shown in Figure 3. The design of the CP pulse mainly requires that it has a certain pulse width (generally not less than 5μs), uniformity of pulse sequence, and high and low level mode. The forward and reverse switching at a certain high speed actually includes three processes: deceleration → commutation → acceleration. 2.5 Conversion between speed and timer initial value The speed control of this system is accomplished by generating CP pulses through timer. There is a certain relationship between the set speed and the initial value of the timer that generates the CP pulse. The MSP430F149 timer has multiple working modes. In this design, the timer works in continuous mode. In continuous mode, the timer starts counting from its current value and restarts from "0" after reaching 0FFFFH. In this mode, the current value of the timer is compared with the comparison register CCRX. If they are equal, an interrupt is generated. The interrupt service routine adds the time of the next event to the comparison register CCRX, as shown in Figure 4. This results in continuous timing intervals, generating an interrupt request at each timing interval. Initial timing value = required timing value / counting cycle; for stepper motors, the speed value is often given in frequency form, such as operating at 20kHz. Therefore, the above formula can be converted to: Initial timing value = counting frequency / speed value. (Where the counting frequency is the system clock frequency) 3. Conclusion This controller can realize the operation control of stepper motors under multiple set curves. It features simple hardware, small size, and high reliability. It has been applied to the wiring control part of a wire production line and has achieved satisfactory results. This project was funded by the North China University of Technology Research Foundation. References: 1. Hu Dake. MSP430 Series FLASH Ultra-Low Power 16-bit Microcontroller. Beijing University of Aeronautics and Astronautics Press, 2001. 2. Li Rending. Microcomputer Control of Motors. Machinery Industry Press, 1999. 3. Chen Libi. Stepper Motors and Their Applications. Shanghai Science and Technology Press, 1985. 4. MSP430 Assembler, Linker, and Librarian Programming Guide, Texas Instruments Corporation. About the Authors: Li Yinghong, female, born in April 1968, lecturer in Automation at North China University of Technology, graduated from Beijing Institute of Technology in 1992 with a master's degree. She has many years of experience in teaching and researching motors and microcontrollers. Guo Dong, male, born in March 1980. Graduated from North China University of Technology in July 2002, currently pursuing a master's degree in Systems Engineering at Beijing University of Science and Technology. Passionate about microcontroller development, proficient in MCS51, MCS96, and MSP430F149 microcontrollers, with extensive practical development experience. Contact numbers: 010-82385738 (H), 13161001674
Read next

CATDOLL Airi Soft Silicone Head

You can choose the skin tone, eye color, and wig, or upgrade to implanted hair. Soft silicone heads come with a functio...

Articles 2026-02-22