Step motor control


Closed Thread
Results 1 to 23 of 23

Hybrid View

  1. #1
    Join Date
    May 2010
    Posts
    43


    Did you find this post helpful? Yes | No

    Default Re: Step motor control

    Thks,all for help!!!
    I tired testing all code,I hope I do something!
    Just one question,
    Is possible make some code in picbasic,

    When I start step motor,to start every time to one position,
    example:

    If step motor work some,go to left,go to right,.......
    and I stop power,and turn again,is possible,motor back in some start position,and continue work some function!

    Last edited by dragan77; - 6th September 2011 at 03:20.

  2. #2
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default Re: Step motor control

    Check this thread http://www.picbasic.co.uk/forum/showthread.php?t=12248 perhaps you will Find what you need!

    Cheers

    Al.
    All progress began with an idea

  3. #3
    Join Date
    May 2010
    Posts
    43


    Did you find this post helpful? Yes | No

    Default Re: Step motor control

    This code work very nice!
    Is very precision!
    I testing yes-today!

    Code:
    Delay VAR BYTE
    i VAR WORD
    
    TRISB = 0  ' All outputs.
    
    Delay = 10   ' ~100steps / second
    
    For i = 1 to 1000    '1000 steps forward.
      PORTB = %00000001
      Pause Delay
      PORTB = %00000010
      Pause Delay
      PORTB = %00000100
      Pause Delay
      PORTB = %00001000
      Pause Delay
    NEXT
    
    Pause 2500
    
    For i = 1 to 1000    '1000 steps reverse.
      PORTB = %00001000
      Pause Delay
      PORTB = %00000100
      Pause Delay
      PORTB = %00000010
      Pause Delay
      PORTB = %00000001
      Pause Delay
    NEXT
    But I don't now what is happens,
    work well 5-6 min,and in the moment stop,like some reset happened,I don't now ,
    and start over again,I don't why!

  4. #4
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,624


    Did you find this post helpful? Yes | No

    Default Re: Step motor control

    Hi,
    If it looks like a reset it probably is. There's no bypass capacitor in the schematic, if you don't have that in your circuit make sure you add one. 0.1uf right across the Vdd/Vss pins.

  5. #5
    Join Date
    May 2010
    Posts
    43


    Did you find this post helpful? Yes | No

    Smile Re: Step motor control

    Thks man!
    I make this, you mean across + an -,from power!
    I see that many time in shema,why is that nessery?


    Now I testing this code:
    Code:
    Delay VAR BYTE
    i VAR WORD
    
    TRISB = 0           ' All outputs.
    
    Delay = 8           
    pause 1000
    For i = 1 to 512    '512 steps forward.
      PORTB =9
      Pause Delay
      PORTB =3
      Pause Delay
      PORTB =6
      Pause Delay
      PORTB =12
      Pause Delay
      
    NEXT
    pause 2500
    
    
    For i = 1 to 256    '256 steps reverse.
      PORTB =12
      Pause Delay
      PORTB =6
      Pause Delay
      PORTB =3
      Pause Delay
      PORTB =9
      Pause Delay
    NEXT
    Pause 2500
    
    For i = 1 to 256    '256 steps reverse.
      PORTB =12
      Pause Delay
      PORTB =6
      Pause Delay
      PORTB =3
      Pause Delay
      PORTB =9
      Pause Delay
    NEXT
    Pause 1500
    For now, working 2 hour fine,is precison,and dont have some reset,we will se for now!

    And one more question,is possible make some code for picbasic for this:

    If step motor work some,go to left,go to right,.......
    and I stop power,and turn again,is possible,motor back in some start position,(some zero posicion),and continue work same function,before stoping!
    Last edited by dragan77; - 6th September 2011 at 17:42.

  6. #6
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,624


    Did you find this post helpful? Yes | No

    Default Re: Step motor control

    Yes, between pin 14 and 5 on the PIC as close to the chip as possible.
    It's needed because as the current thru the circuit fluctuates (rises and falls) quickly (which it does in digital circuits, not to mention motor control and other "high power" circuits) the resistance and inductance of the wires and/or PCB traces that "feeds" the chip makes the voltage at the chip unstable.

    If you look at ANY profesional PCB/circuit you'll see a bypass capacitor right next to EVERY chip for this particular reason.

  7. #7
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,624


    Did you find this post helpful? Yes | No

    Default Re: Step motor control

    You will need some kind of reference switch on the shaft (microswitch, hall, proximity, whatever) to detect when the shaft is the "home position". Then, at startup, take a step check the input, and keep doing that in a loop until the switch is detected.

  8. #8
    Join Date
    May 2010
    Posts
    43


    Did you find this post helpful? Yes | No

    Default Re: Step motor control

    I wrong for last questin,I mean:
    And one more question,is possible make some code for picbasic for this:

    If step motor work some,go to left,go to right,.......
    and I stop power,and turn again,is possible,motor back in some start position,(some zero posicion),and continue work same function,FROM START CODE!

  9. #9
    Join Date
    May 2010
    Posts
    43


    Did you find this post helpful? Yes | No

    Default Re: Step motor control

    THANKS,I mean only some switch can make this,I think in write code not impossible,Thks anyway!

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts