硬件部分
通过给安装在定子的轮毂上的四个电磁铁依次通电
通过齿轮结构的传动
来带动中间的永磁体转子来转动


低精度,小功率,低功转化率的驱动方法

较高精度,较大功率,高功转化率的驱动方法
电机的几线几相这里及其分类就不做赘述了
说一下电机使用的注意事项

- 电压控制 与 单相不可长时间通电
- 专业的驱动型片和驱动程序,可以让步进电机做到十分精准的地步,(当然步进电机本身也要有足够精准的工艺),可以确定向360/256°的256个方向指定转动并朝向(换个思路,三相或六相电机就可完成360/360°的个方向转向)
- 步进电机的
扭矩 l = f r
与电流直接相关(电流控制力的大小)
速度 v = w r t = w r (1/Fs)
与电机的通电频率有关
软件部分
void STEP_MOTOR_Init(void){
//step_motor initialize
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB | RCC_APB2Periph_GPIOC | RCC_APB2Periph_GPIOD, ENABLE);
RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE);//the clock that's specially prepared for the multiplexed GPIO_Pin (the original is for JTAG)
GPIO_InitTypeDef GPIO_InitStructure;//3 enum variables respectively control the pin, mode and crystal speed
GPIO_InitStructure.GPIO_Pin = STEP_MOTOR_A | STEP_MOTOR_B | STEP_MOTOR_C | STEP_MOTOR_D;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_SPEED_50MHz;
//there's some prepared_presentation for motor(not in variable, but some funtions are prepared)
GPIO_Init (STEP_MOTOR_PORT, &GPIO_InitStructure);
//firstly disable JTAG to change the flection of the pins , remap means re-define(configuration)
GPIO_PinRemapConfig(GPIO_Remap_SWJ_Disable, ENABLE);
//turn off the power to preven the motor to constantly consume the power and being to hot
STEP_MOTOR_OFF();
}
void STEP_MOTOR_OFF (void){
//turn the motor off
GPIO_ResetBits(STEP_MOTOR_PORT,STEP_MOTOR_A | STEP_MOTOR_B | STEP_MOTOR_C | STEP_MOTOR_D);//reset all the pins
}
对角双电机间歇往返程序
void STEP_MOTOR_4S (u8 speed){
//µç»ú¹Ì¶¨Î»ÖÃ
GPIO_ResetBits(STEP_MOTOR_PORT,STEP_MOTOR_A| STEP_MOTOR_C); //¸÷½Ó¿ÚÖÃ0
GPIO_SetBits(STEP_MOTOR_PORT,STEP_MOTOR_B | STEP_MOTOR_D); //¸÷½Ó¿ÚÖÃ1
delay_ms(speed); //ÑÓʱ
GPIO_ResetBits(STEP_MOTOR_PORT,STEP_MOTOR_A | STEP_MOTOR_B

本文介绍了步进电机的基本驱动原理及不同驱动模式下的程序实现。涵盖了电机初始化配置、电机关闭状态设置,以及多种模式(如对角双电机、相邻双电机等)的驱动程序示例。探讨了如何通过调整电流和频率来改变电机的扭矩和速度。
最低0.47元/天 解锁文章
3342

被折叠的 条评论
为什么被折叠?



