This post was last edited by Maker_kun on 2024-7-21 21:59
Driving effect:
Materials used in this review: STM32H5 development board, H-bridge L298N module, micro stepper motor
Stepper Motor Principle
There are many types of stepper motors, which can be divided into many types according to different classification standards. The following are several common classification methods and their corresponding stepper motor types:
-
Classification by rotor structure :
- Variable Reluctance (VR) stepper motor : Its rotor is made of soft magnetic material, has no winding, and both the stator and rotor adopt a tooth structure. It has the characteristics of low cost, small step angle but poor dynamic performance.
- Permanent Magnet Stepper Motor (PM) : Its rotor is made of permanent magnet material, with large output torque, but the step angle is generally large.
- Hybrid Stepping Motor (HS) : It combines the advantages of reactive and permanent magnet types. It is usually divided into two-phase, three-phase and five-phase, and has good overall performance.
-
Classification by stator winding :
- Single-phase stepper motor : usually has only one winding and is suitable for simple applications.
- Two-phase stepper motor : There are two independent windings, the driving method is complex, and the design is more complicated without a microcontroller.
- Three-phase stepper motor : has three independent windings, small step angle, often used in applications requiring high-precision control.
- Four-phase stepper motor : has four independent windings, high cost and complex structure, mainly used for special purposes.
- Five-phase stepper motor : has five independent windings, smaller step angle, higher accuracy, but also higher cost and complexity.
-
Classification by working principle :
- Electromagnetic stepper motor : uses electromagnetic force to directly drive the rotor to rotate.
- Piezoelectric stepper motor : uses the piezoelectric effect to convert electrical signals into mechanical motion.
- Rolling cut stepper motor : The stepping motion is achieved through rolling cutter cutting.
- Mechanical harmonic stepper motor : uses the principle of mechanical harmonics for stepping control.
-
Classification by output torque and power :
- Control stepper motor : The output torque is small, usually in the N·cm level, suitable for the workbench of small precision machine tools, etc.
- Power stepper motor : The output torque is large, usually in the N·m level, and can directly drive larger loads such as machine tool workbenches.
-
Classification by excitation phase number :
- Three-phase stepper motor : The number of main poles of the stator coil is a multiple of three, such as 3, 6, 9, 12, etc.
- Four-phase stepper motor : The number of main poles of the stator coil is a multiple of four, such as 4, 8, 12, etc.
- Five-phase stepper motor : The number of main poles of the stator coil is a multiple of five, such as 5, 10, 15, etc.
Exploded view of stepper motor:
Permanent magnet stepper motor:
Simple schematic diagram:
Actual structure diagram:
Disassembling the micro stepper motor:
The hardware circuit can be controlled by H-bridge circuit
The micro stepper motors used in this project are:
OPPO K3 lifting front camera lifting stepper motor module, internal resistance 14.5Ω, weight 3.6g, deceleration stroke about 10mm
Start building the software driver:
After consulting the schematic diagram, it is determined that PA8, PB10, PB4, and PB5 are driven by A1, A1, B1, and B2 respectively.
Software configuration STM32H5 related pins:
Build configuration:
Macro definition pin name and function:
Main program main drives micro stepper motor code: forward motion, reverse motion
while (1)
{
int t=1;
int i=0;
for(i=0;i<330;i++)//正向移动
{
A1(1);A2(0);B1(0);B2(0); HAL_Delay(t);
A1(1);A2(0);B1(1);B2(0); HAL_Delay(t);
A1(0);A2(0);B1(1);B2(0); HAL_Delay(t);
A1(0);A2(1);B1(1);B2(0); HAL_Delay(t);
A1(0);A2(1);B1(0);B2(0); HAL_Delay(t);
A1(0);A2(1);B1(0);B2(1); HAL_Delay(t);
A1(0);A2(0);B1(0);B2(1); HAL_Delay(t);
A1(1);A2(0);B1(0);B2(1); HAL_Delay(t);
LED0_TOGGLE();
}
for(i=0;i<330;i++)//逆向移动
{
A1(1);A2(0);B1(0);B2(1); HAL_Delay(t);
A1(0);A2(0);B1(0);B2(1); HAL_Delay(t);
A1(0);A2(1);B1(0);B2(1); HAL_Delay(t);
A1(0);A2(1);B1(0);B2(0); HAL_Delay(t);
A1(0);A2(1);B1(1);B2(0); HAL_Delay(t);
A1(0);A2(0);B1(1);B2(0); HAL_Delay(t);
A1(1);A2(0);B1(1);B2(0); HAL_Delay(t);
A1(1);A2(0);B1(0);B2(0); HAL_Delay(t);
LED0_TOGGLE();
}
Relevant attachments:
References:
https://www.bilibili.com/video/BV1nA4m1A7Ke/?spm_id_from=333.337.search-card.all.click
https://mbd.baidu.com/newspage/data/videolanding?nid=sv_10160840858512304975&sourceFrom=share
https://www.bilibili.com/video/BV1Vr421W75a/?spm_id_from=333.999.0.0&vd_source=23409a47a6116408c30d6bca673c6a2b