+ Post New Thread
Results 1 to 8 of 8
  1. #1
    Full Member level 3
    Points: 2,135, Level: 10
    Achievements:
    7 years registered

    Join Date
    Sep 2011
    Posts
    165
    Helped
    1 / 1
    Points
    2,135
    Level
    10

    WTA Stepper Motor control with ULN 2003

    Hi all,

    Recently I am learning on how to control a stepper motor.
    The circuit working condition is as below:

    PIC 16F628a --> ULN 2003 --> 28BYJ-48 stepper

    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);
    }

    but i can feel that my motor is vibrating when i am holding it, but the shaft just dont rotate.
    May i know what is the problem?

    •   AltAdvertisement

        
       

  2. #2
    Advanced Member level 5
    Points: 25,337, Level: 38

    Join Date
    Dec 2010
    Location
    Southampton and holiday cottage in Wensleydale (UK)
    Posts
    4,863
    Helped
    1315 / 1315
    Points
    25,337
    Level
    38

    Re: WTA Stepper Motor control with ULN 2003

    Are you sure that the bit pattern is wired to the correct wires?
    Frank


    1 members found this post helpful.

    •   AltAdvertisement

        
       

  3. #3
    Advanced Member level 5
    Points: 17,232, Level: 31
    Achievements:
    7 years registered

    Join Date
    Nov 2012
    Posts
    3,148
    Helped
    777 / 777
    Points
    17,232
    Level
    31

    Re: WTA Stepper Motor control with ULN 2003

    You are sending two nibbles and the high nibble is zero. You need to send a sequence of bits 0011 0110 1100 1001 0011...

    Are you sure that you are doing that?


    1 members found this post helpful.

    •   AltAdvertisement

        
       

  4. #4
    Full Member level 3
    Points: 2,135, Level: 10
    Achievements:
    7 years registered

    Join Date
    Sep 2011
    Posts
    165
    Helped
    1 / 1
    Points
    2,135
    Level
    10

    Re: WTA Stepper Motor control with ULN 2003

    Quote Originally Posted by chuckey View Post
    Are you sure that the bit pattern is wired to the correct wires?
    Frank

    Quote Originally Posted by c_mitra View Post
    You are sending two nibbles and the high nibble is zero. You need to send a sequence of bits 0011 0110 1100 1001 0011...

    Are you sure that you are doing that?


    I am using this module to connect to my PIC
    RB0 --> 1N1
    RB1 --> 1N2
    RB2 --> 1N3
    RB3 --> 1N4



  5. #5
    Advanced Member level 5
    Points: 17,232, Level: 31
    Achievements:
    7 years registered

    Join Date
    Nov 2012
    Posts
    3,148
    Helped
    777 / 777
    Points
    17,232
    Level
    31

    Re: WTA Stepper Motor control with ULN 2003

    I see that the bit 0 is missing. You need to adjust for that.


    1 members found this post helpful.

    •   AltAdvertisement

        
       

  6. #6
    Full Member level 3
    Points: 2,135, Level: 10
    Achievements:
    7 years registered

    Join Date
    Sep 2011
    Posts
    165
    Helped
    1 / 1
    Points
    2,135
    Level
    10

    Re: WTA Stepper Motor control with ULN 2003

    Quote Originally Posted by c_mitra View Post
    I see that the bit 0 is missing. You need to adjust for that.
    Hi, sorry, i dont get what you mean.
    which bit 0 is missing?

    I can feel the vibration of the motor,it is same as the duration that i set.
    but just the shaft is not rotating. I am wondering what is happening.



  7. #7
    Advanced Member level 5
    Points: 17,232, Level: 31
    Achievements:
    7 years registered

    Join Date
    Nov 2012
    Posts
    3,148
    Helped
    777 / 777
    Points
    17,232
    Level
    31

    Re: WTA Stepper Motor control with ULN 2003

    If you see the PCB silkscreen, the MCU IO starts with IN1..IN7- that makes 7 bit input. Either the bit0 is missing or bit 8 is ignored. If bit 8 is ignored, it would not make any difference because bits 5-7 are not used by the controller. Normally bits are labelled from 0-7 (well, that is the most common; RB0...RB7) but you also must consider the endian-ness. The fact that the motor is vibrating clearly suggests that the sequence received is not correct. You also need to see the motor connections (try to reverse one of the A1-A2 OR B1-B2 connections).

    Also reduce the delay- 500ms is very long and just try 50ms or so.

    - - - Updated - - -

    I guess that ABCD are LEDs that are showing the pulses. In that case, INCREASE the delay to 1-2 sec and see whether the correct sequence is being output. If the correct sequences are coming, then decrease the delay and check the motor connections. I guess the centre pin is the ground- check with a multimeter. Also see that the pulses are being referred to the 'correct' ground. One wire from the PIC must connect to the ground in the board...


    1 members found this post helpful.

  8. #8
    Super Moderator
    Points: 77,800, Level: 68
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    15,765
    Helped
    3590 / 3590
    Points
    77,800
    Level
    68

    Re: WTA Stepper Motor control with ULN 2003

    Hi,

    I think the motor connection is wrong (it doesn't meet yout digital pattern)

    Now:
    IN1 and IN3 are for the same coil.
    And IN2 and IN4 for the other coil.

    You could change motor connection or digital pattern to solve the problem.

    Klaus



--[[ ]]--