Connect with us

[Need help] Stepper motor control

Discussion in 'Sensors and Actuators' started by alpha91, Feb 7, 2016.

Scroll to continue with content
  1. alpha91

    alpha91

    1
    0
    Feb 7, 2016
    Hi all, i am learning to control stepper motor by using ULN2003a chip together with PIC 16f628a with a stepper motor.
    But unfortunately it is not working. I am able to feel the motor is vibrating but the shaft is not rotating.

    My code is as below:

    void main()
    {
    CMCON = 0x07; // To turn off comparators
    TRISB = 0; // PORT B as output port
    PORTB = 0x0F;
    do
    {
    PORTB = 0b00000011;
    Delay_ms(500);
    PORTB = 0b00000110;
    Delay_ms(500);
    PORTB = 0b00001100;
    Delay_ms(500);
    PORTB = 0b00001001;
    Delay_ms(500);
    }while(1);
    }


    The motor i that i am using
    [​IMG]

    The ULN2003a module
    [​IMG]

    Does anyone here can let me know what is wrong? Thanks
     
  2. Sadlercomfort

    Sadlercomfort Ash

    424
    53
    Feb 9, 2013
    Hello there,

    Can you describe how the PIC is interfaced with the controller?

    Which portb pins are connected to 1N1:4??
     
  3. BobK

    BobK

    7,682
    1,685
    Jan 5, 2010
    It is likely you are not sequencing the phases correctly. Swap the leads of one of the two coils and it should work.

    Bob
     
    Sadlercomfort likes this.
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-