Shop OBEX P1 Docs P2 Docs Learn Events
Stepper motor ramping pulses with Propeller — Parallax Forums

Stepper motor ramping pulses with Propeller

OzStampOzStamp Posts: 377
edited 2006-10-24 22:47 in Propeller 1
Hi to all

Been experimenting a little with the Propeller.
Objective to ramp pulses to a stepper amplifier.
The stepper amplifier used is a LAM Technology type DS1044 this is a
Micro stepper driver unit ( DIN rail mount) and capable of micro stepping
up to 25600 steps per rev.
We have several projects that require all sort of positioning .. ramping + registration mark control
as used in the packaging type industries.

Attached to this post a couple of small mpegs ( zipped) that show you how well the
Propeller can handle the ramping all in SPIN and running pretty quick as well.
The DS1044 LAM Technology drive is set up for 800 Pulses per rev and it is supersmooth.
The pulses from the Propeller (3.3VDC) work okay on this stepper driver as well.
So a direct connection is possible.

Need to get the code across to this PC but can post it if anybody is interested in seeing it.
Back to work more experimenting to do ..

Cheers to all the wonderfull post we see everyday ..
Ronald Nollet·· Australia

Comments

  • OzStampOzStamp Posts: 377
    edited 2006-10-24 06:38
    Hi All.

    Attached the code fragment that ramps the pulse to pin4
    on the Propeller.

    Cheers
    Ronald Nollet·· Australia
  • OzStampOzStamp Posts: 377
    edited 2006-10-24 12:13
    Hi All

    Re stepper motor controls..

    Added some more stuff . Now ramping up and ramping down (acc + de acc) the motor slows down nice and smooth ..notice this when looking at the movie how·smooth it stops..Sofar all is done in Spin but can see that to achive higher stepping rates and do some other stuff.... that we·may have to resort to using assembly for some stuff needed..

    Attached the program in Spin format and a short movie.

    The algorithm for the ramping needs further fine tuning but the·basics are there.·Love that case statement it is awesome this chip .. the motor is controlled by a micro stepper amplifier pulses straight from the Propeller the motor moves about 5 revs per second and as you can see it stops dead on accurate not missing a step ...800 pulses per rev (micro stepping the motor for smoothness..)

    Enjoy and if anybody has some suggestions or idea's·please drop a line

    Ronald Nollet·· Australia
  • Graham StablerGraham Stabler Posts: 2,507
    edited 2006-10-24 12:35
    Are you ramping the step frequency linearly or just dropping the time between pulses linearly?

    Graham
  • OzStampOzStamp Posts: 377
    edited 2006-10-24 21:15
    Hi Graham the code is below ( without the VAR's)
    The high time (1 of pin 4) is kept constant ( min pulse input time required by the stepper amp) and we delay the next pulse determined by a look up table ... ie mutiple case statenents..( we decrease the delay to ramp up and we increase the delay to slow down)
    Just playing to get to a proper algo at the momet,works well it has been runiing 8 hrs now not missing a pulse..
    PLC type devices ( as used in Factory automation) use a 10 step ramp + ramp down profile.My approach is slightly differnet.


    PUB Flashes
    cntr := 0
    M := 100_000 'delay in clk ticks used in waitcnt..
    First := M
    rotations := 5
    steps_rev := 800
    steps := rotations * steps_rev

    dira~~ 'Set I/O Pins to output direction
    dira[noparse][[/noparse]19..23]~~ 'pins 19..23 to outputs as well
    repeat
    repeat steps 'positioning loop enter 800 steps per rev
    cntr := cntr + 1
    outa := 1 'set pin 4 high
    waitcnt(Pulse_width + cnt )'wait ( for min pulse width)
    outa := 0 'pin 4 now low
    waitcnt(M + cnt) 'space wait (determines ramp speed)
    case cntr 'start of look up table for ramp
    1..100 : M := 100_000 'ramping up delay..
    101..200 : M := 70_000 'decrease delay..
    201..300 : M := 40_000 'etc etc..
    301..900 : M := 10_000
    901..(steps -1000) : M := 500 + Minimum 'make sure min pulse width
    (steps - 1000)..(steps-900) : M :=10_000 'ramping down..
    (steps - 899).. (steps-600) : M :=20_000
    (steps - 599).. (steps-300) : M :=30_000
    (steps - 299).. (steps-100) : M :=40_000
    (steps - 99) .. (steps-50) : M :=50_000
    (steps - 49 ).. (steps) : M :=70_000 'ramping down stopping

    repeat 2 'just a flash of leds on pins 19..23
    waitcnt (20_000_000 +cnt) 'pause
    ! outa [noparse][[/noparse]19..23] 'toggle
    M := First
    cntr := 0 'this was probably missing from the org file posted


    Ronald Nollet Australia
  • Graham StablerGraham Stabler Posts: 2,507
    edited 2006-10-24 22:47
    I was just trying to work out if you were taking into account that the frequency is 1/T so ramping T up by the same amount each time gives you a sort of exponential speed increase rather than a linear one. It looks like your "look up table" is taking that into account to some extent.

    Graham
Sign In or Register to comment.