imcc 发表于 2011-8-29 17:46:39

28BYJ-48步进电机的问题

stm32 加 28BYJ-48步进电机的问题
有没有歌高手能提供28BYJ-48步进电机的八节拍的相序,网上看了很多都不对,电机抖得厉害,转得也很慢,纠结啊。

lanzhengjun 发表于 2011-8-29 19:30:12

你用什么电路驱动的2BYJ-48的?

ITOP 发表于 2011-8-29 19:37:57

看来楼主直接用STM32驱动的

myqiang1990 发表于 2011-8-29 19:50:16

注意启动频率、、太快当然抖!。。转得慢,是因为它是减速步进电机。。。(ULN2003驱动。。。)


unchar flash ForWard[]={0x01,0x03,0x02,0x06,0x04,0x0c,0x08,0x09};//正转
unchar flash Back[]={0x08,0x0c,0x04,0x06,0x02,0x03,0x01,0x09};//反转
/*************************************************************************
*函数描述:void ForWardFun(char angle)
*参数入口:
         angle:转的角度
*参数出口:
*函数说明: 正转
*************************************************************************/
void ForWardFun(char angle)
{
   unchar i=0;
   for(;angle>0;angle--)
    {
      for(i=0;i<8;i++)
       STEPPORT=ForWard;
       delay_ms(50);
    }
}

imcc 发表于 2011-8-29 20:12:17

回复【2楼】ITOP
-----------------------------------------------------------------------

我不是用stm32直接驱动的


http://cache.amobbs.com/bbs_upload782111/files_45/ourdev_672296JBFZWR.jpg
(原文件名:NF2E2816N80{)G)T}Q%7~B0.jpg)

用的是298芯片驱动的

imcc 发表于 2011-8-29 20:20:44

回复【3楼】myqiang1990小松鼠
-----------------------------------------------------------------------

启动频率大概多少啊

void power_engin(void)
{
    u16 delay_nus = 20;

        //1000        1
        GPIO_SetBits(GPIOE, GPIO_Pin_10);
        GPIO_ResetBits(GPIOE, GPIO_Pin_11);
        GPIO_ResetBits(GPIOE, GPIO_Pin_12);
        GPIO_ResetBits(GPIOE, GPIO_Pin_13);
        delay_ms(delay_nus);
       
        //1100        2
        GPIO_SetBits(GPIOE, GPIO_Pin_10);
        GPIO_SetBits(GPIOE, GPIO_Pin_11);
        GPIO_ResetBits(GPIOE, GPIO_Pin_12);
        GPIO_ResetBits(GPIOE, GPIO_Pin_13);
        delay_ms(delay_nus);
       
        //0100        3
        GPIO_ResetBits(GPIOE, GPIO_Pin_10);
        GPIO_SetBits(GPIOE, GPIO_Pin_11);
        GPIO_ResetBits(GPIOE, GPIO_Pin_12);
        GPIO_ResetBits(GPIOE, GPIO_Pin_13);
        delay_ms(delay_nus);
       
        //0110        4
        GPIO_ResetBits(GPIOE, GPIO_Pin_10);
        GPIO_SetBits(GPIOE, GPIO_Pin_11);
        GPIO_SetBits(GPIOE, GPIO_Pin_12);
        GPIO_ResetBits(GPIOE, GPIO_Pin_13);
        delay_ms(delay_nus);
       
        //0010        5
        GPIO_ResetBits(GPIOE, GPIO_Pin_10);
        GPIO_ResetBits(GPIOE, GPIO_Pin_11);
        GPIO_SetBits(GPIOE, GPIO_Pin_12);
        GPIO_ResetBits(GPIOE, GPIO_Pin_13);
        delay_ms(delay_nus);
       
        //0011        6
        GPIO_ResetBits(GPIOE, GPIO_Pin_10);
        GPIO_ResetBits(GPIOE, GPIO_Pin_11);
        GPIO_SetBits(GPIOE, GPIO_Pin_12);
        GPIO_SetBits(GPIOE, GPIO_Pin_13);
        delay_ms(delay_nus);               
       
        //0001        7
        GPIO_ResetBits(GPIOE, GPIO_Pin_10);
        GPIO_ResetBits(GPIOE, GPIO_Pin_11);
        GPIO_ResetBits(GPIOE, GPIO_Pin_12);
        GPIO_SetBits(GPIOE, GPIO_Pin_13);
        delay_ms(delay_nus);
       
        //1001        8
        GPIO_SetBits(GPIOE, GPIO_Pin_10);
        GPIO_ResetBits(GPIOE, GPIO_Pin_11);
        GPIO_ResetBits(GPIOE, GPIO_Pin_12);
        GPIO_SetBits(GPIOE, GPIO_Pin_13);
        delay_ms(delay_nus);
}
这个延时20ms都能感觉到一抖一抖的 延时太短抖得厉害

lanzhengjun 发表于 2011-8-29 21:00:07

我今天调试步进电机遇到了跟一样的问题,我的电机刚开始也是很抖,我单片机的电源和驱动板没有有一套电源,共地后就解决了,抖动,但是现在电机的转速提不上来

imcc 发表于 2011-8-29 21:16:09

我的stm32跟电机共地了,正常的应该是电机转的时候你给它阻力它不会停下

lyzh 发表于 2011-8-29 23:25:23

脉冲频率高了就会抖。

hpyanghua 发表于 2011-8-30 09:18:48

这个完全就是脉冲频率过高引起的!! 电机特性里有要求!! delay_ms(T=600-800); 运行正常!!

imcc 发表于 2011-8-30 09:57:20

stm32 延时10ms还抖,延时低于1.5ms就不能转了
页: [1]
查看完整版本: 28BYJ-48步进电机的问题