Abstract: This paper focuses on the design of a stepper motor control system based on STM32 microcontrollers. With the increasing integration of high-tech products into daily life, stepper motor control systems have undergone significant changes. The maturation and practical application of technologies such as microcontrollers and C programming languages have provided new research directions and significance for stepper motor control systems. This paper describes a stepper motor control system based on STM32 PWM microstepping technology, consisting of an STM32 microprocessor, a stepper motor, an LCD display, and a keyboard. The system uses an STM32 microprocessor as its core and is programmed in the MDK environment. Based on keyboard input, the STM32 generates periodic PWM signals, which control the speed and direction of the stepper motor. The data is displayed on the LCD. Results show that the system is simple in structure, reliable in operation, and highly accurate.
With the rapid development of power electronics, microelectronics, control theory, and permanent magnet materials, stepper motors have experienced rapid growth. In modern industrial production, production machinery is generally driven by electric motors. With modernization and the continuous improvement of industrial automation, various control motors are increasingly widely used in automatic control systems. To improve productivity and ensure product quality, many production machines require stepper motors to operate at different speeds. This necessitates methods to change the speed of the machine, i.e., speed regulation of the stepper motor. The motor speed must not only be adjustable but also have a wide adjustment range, a smooth process, and a simple and economical adjustment method. Stepper motors possess unique advantages in all these aspects, leading to their widespread application. This paper, focusing on the excellent characteristics of stepper motors such as large starting torque, small size, light weight, easy torque and speed control, and high efficiency, designs a stepper motor control system based on automatic control principles and using PWM microstepping control to achieve more precise and rapid control of the stepper motor.
1.1 Background of the Topic
The STM32 series of 32-bit flash microcontrollers utilizes the groundbreaking Cortex-M3 core from ARM, specifically designed to meet the demands of embedded systems that combine high performance, low power consumption, real-time applications, and competitive pricing. The enhanced system architecture of the Cortex-M3 greatly benefits the STM32; the Thumb-2® instruction set delivers higher instruction efficiency and stronger performance; and the tightly coupled nested vector interrupt controller provides faster response to interrupt events than ever before; all while maintaining industry-leading power consumption levels. The STM32 series offers MCU users unprecedented freedom, providing a new 32-bit product option that combines high performance, real-time capabilities, low power consumption, and low voltage, while maintaining high integration and ease of development. The richer integrated resources, user-friendly architecture, and low power consumption, coupled with a competitive price, make upgrading from 16-bit to 32-bit easy.
In industrial production, stepper motors are frequently used. In motor control systems with less stringent position control requirements, such as drive control systems, traditional motors like stepper motors still offer significant advantages. However, precise and rapid control requires a more complex control system. A stepper motor is an actuator that converts electrical pulses into angular displacement. When a stepper driver receives a pulse signal, it drives the stepper motor to rotate a fixed angle (called the "step angle") in a set direction. Its rotation occurs in fixed angular increments. The amount of angular displacement can be controlled by controlling the number of pulses, thus achieving accurate positioning. Simultaneously, the speed and acceleration of the motor can be controlled by controlling the pulse frequency, thus achieving speed regulation. Stepper motors can be controlled with greater precision through microstepping. The basic concept of microstepping is that by driving the stepper motor with a microstepping driver, the step angle is reduced. When the driver operates in 10-microstep mode, its step angle is only one-tenth of the 'motor's inherent step angle'. That is, when the driver operates in full-step mode without microstepping, the motor rotates 1.8° for each step pulse issued by the control system; while when the microstepping driver operates in 10-microstep mode, the motor only rotates 0.18°. The microstepping function is entirely generated by the driver through precise control of the motor's phase current and is independent of the motor itself.
Microstepping technology for stepper motors is essentially an electronic damping technology. Its main purpose is to improve the operating accuracy of the motor and achieve high-precision microstepping of the step angle. Secondly, a secondary function of microstepping technology is to reduce or eliminate low-frequency vibrations in stepper motors. Low-frequency oscillations are an inherent characteristic of stepper motors (especially reactive motors), and microstepping is the only way to eliminate them. If the stepper motor sometimes needs to operate in the resonance zone (such as traversing an arc), selecting a microstepping driver is the only option.
The main advantages of microstepping the driver are: complete elimination of low-frequency oscillations in the motor; increased output torque of the motor, especially for three-phase reactive motors, where the torque is increased by about 30-40% compared to non-microstepping; and improved motor resolution, which is self-evident due to the reduction of step angle and the improvement of step uniformity.
1.2 Research Objectives and Significance
STM32 is a rapidly developing processor with excellent application prospects. Its application in stepper motor speed control has significant value. Digital motor drive technology, represented by pulse width modulation (PWM), is also developing rapidly, and applying computers to this field can fully leverage their advantages in digital control. The development of microelectronics and computer technology has laid a solid foundation for the development and application of computer control technology. It can be said that an instrument without a microprocessor cannot be called an instrument, and a control system without a microcomputer cannot be considered a modern industrial control system. With the emergence of microcomputers, very large-scale integrated circuits, new power electronic switching devices and sensors, and the in-depth development of automatic control theory, power electronics technology, and computer control technology, electrical drive devices are being updated and upgraded rapidly, and DC drive systems are also constantly being updated and developed.
Stepper motors are commonly used power supply components and play an important role in daily life. They are among the most common types of motors and are widely used in various fields. Researching the speed control of stepper motors is of great significance. Studying control methods for DC motors is also important for improving control accuracy and saving energy. This solution uses an STM32 microcontroller as the control core to realize the speed and forward/reverse rotation adjustment functions of a common stepper motor, providing a foundation for further research and optimization of stepper motor control methods.
1.3 Project Tasks and Requirements
The STM32 microcontroller enables precise control of the stepper motor, allowing users to control forward rotation, reverse rotation, acceleration, and deceleration via buttons. This information is then displayed on a TFT color LCD screen.
1.4 Analysis and Implementation of the Project Content
This design is a stepper motor control system implemented using STM32 as the core. Based on the design objectives, the hardware components required for this design are the SPGT62C19B motor control module and the programming of the entire control system.
First, based on factors such as the overall cost and control accuracy indicators, the required stepper motor is selected.
Secondly, due to cost and structural complexity, this design uses an A/D converter instead of a keyboard input to convert the analog voltage signal into a digital signal and display it on an LCD.
Next, design the SPGT62C19B motor control module and complete the hardware setup.
Finally, the overall hardware and software were integrated and tested to meet the task requirements.
1.5 Introduction to the Project Paper Arrangement
This paper mainly focuses on the design of a stepper motor control system based on STM32. It introduces the design concept, circuit principles of the main modules, program structure, and test results of the entire control system. The design is divided into two main parts: software and hardware. The project design can be further divided into three parts:
The first part is the hardware design, including the circuit design of the main modules and the selection of components. The specific hardware circuit consists of two main modules: the SPGT62C19B motor control module (stepper motor driver module) and the STM32 development board. After successfully testing each chip in each module, the corresponding entire module circuit was soldered. Each part was debugged individually. After each part was successfully debugged, the entire hardware circuit was connected and debugged. Errors encountered during the process were analyzed and corrected, and finally, a conclusion was drawn.
The second part is software design. The software is written in C language. The main design philosophy is top-down, modular design. Each sub-module is designed and debugged one by one. Finally, the entire program is adjusted to determine whether it meets the expected requirements and draw conclusions.
The third part, assuming successful debugging of both hardware and software modules, involves hardware and software integration debugging. This is the key to the entire control system design, as well as its focus and challenge.
This paper provides a detailed introduction to the design of a stepper motor control system, consisting of five chapters. Chapter 1 briefly introduces the research background, purpose, significance, and overall task requirements of the project. Chapter 2 provides an overview of the overall scheme for this project. Chapter 3 details the hardware design of the stepper motor control system, including the design of the SPGT62C19B motor control module circuit. Chapter 4 elaborates on the software design of the stepper motor control system, including the design of subroutines such as PWM microstepping. Chapter 5 provides a detailed analysis and explanation of the results of hardware debugging, software debugging, and overall system integration debugging.