Stepper motors are brush less dc motors. They have coils and permanent magnets which rotate the shaft.There are generally two types of stepper motors categorized on their coil configurations uni polar and bi polar. Uni polar motors have a common signal wire whose signal remains fixed all the time. Bipolar motors are independent from common wire. I am not going to dive deep in the stepper motors difference. Just wrote above the major difference between the two stepper motors.
I am going to interface the stepper motor with stm32 microcontroller. My main task is to teach you people how to interface, program and control the stepper motor with stm32f103 microcontroller using stm32cubemx code configurator.
- Stepper motor NEMA 17
- Stm32f103c8t6 microcontroller
- A4988 stepper motor driver
A4988 stepper motor driver
I am going to drive the motor in Full step mode. For full step mode you need to make the A4988 stepper motor driver mode pins low. The motor drive mode pins Ms1, Ms2 and Ms3 are untouched. They remained open and works for me. Although it worked for me but i recommend to connect the Ms1,Ms2 and Ms3 to ground for full step mode. Next the Step pin of motor driver is connected to Port-A pin# 4 of stm32f103 microcontroller. Direction pin is connected to Port-A pin#3 of stm32 microcontroller. Circuit diagram of the project is given below.
HAL_GPIO_WritePin(GPIOA, DIR_Pin, GPIO_PIN_SET);//Clock wise rotation