Shop OBEX P1 Docs P2 Docs Learn Events
P2 Taqoz V2.8: Linear Movement of 4 Step Motors — Parallax Forums

P2 Taqoz V2.8: Linear Movement of 4 Step Motors

Hi,
perhaps this might be interesting, if you want up to 4 axis of step motors moving in parallel. It is intended to be used with step drivers, which need a direction and a step signal like A4988 or (better) TMC2209 as described here: https://forums.parallax.com/discussion/176017/tmc2209-cnc-shield-p2-a-nice-combination-to-control-step-motors#latest
This driver uses local variables as described here: https://forums.parallax.com/discussion/174970/p2-taqoz-v2-8-lutlongs-value-type-variables-locals-now-faster#latest

The driver is coded in Forth, no assembler, and capable of 18_000 clocks per step = 200_000_000/18_000 = 11_000 steps per second for each of the 4 motors in parallel. Linear movement of 4 axis in parallel is done like this:

  • The axis with the maximum of steps in that movement is found as the leading axis. It gets assigned the fixed step-time.
  • For each of the other axis, which have lower distance to travel, their time per step is precalculated in a way, that they will arrive at the same time.
  • To achieve acceleration and deceleration nearby the start and the destination, a factor for the step time is calculated and applied for each axis.

Acceleration/deceleration is defined by 2 constants
accel# is (not exactly) the number of steps until full speed is reached.
minDist# defines the speed at start.

In my setup right now a minimum of 12_000 clocks per step would be possible, before some resonance is starting at one axis. So this driver leaves some sort of safety factor for the speed....

Have fun!
Christof

Comments

  • Christof Eb.Christof Eb. Posts: 1,194
    edited 2024-11-06 09:11

    Hm,
    thanks Smartpin possibilities it was easy to improve possible speed by factor 1.7 . Peter's Taqoz even has commands to output pulses!
    (stepPins is a table for the pin numbers, I is an index for the axis)

    So instead of toggle (t) the pin for each step

    stepPins I+ @  pin 
    t 
    

    it is now a pulse for each step

    stepPins I+ @  pin 
    1_000 100 HILO 1 PULSES 
    

    Resolution is reduced from 3200 per revolution to 1600, which is still plenty and not louder, because of the 256 microsteps interpolation of TMC2209.
    Now speed is limited by mechanical resonance in my setup.
    I think, this is a nice example, why I like to stay with the "weird" language Forth: It is fast enough to do such driver without need of assembler, while it is interactive like Lua or Micropython. Those are more convenient for the programmer, but their lack of speed is a high price to pay....

  • MicksterMickster Posts: 2,692

    I would go with a motor + cheap AE encoder; no chance of losing steps and no performance limitations. For me, no feedback = no control :)

  • @Mickster said:
    I would go with a motor + cheap AE encoder; no chance of losing steps and no performance limitations. For me, no feedback = no control :)

    Hi Craig,
    I totally agree, that feedback would be nice. Alas, my actual project is a fun project, which already costs.... It is also a shame, that you cannot easily find cheap step motors with axles on both sides, which would be good for hand-turning or to attach an encoder.
    Temic claims that the TMC2209 https://www.analog.com/media/en/technical-documentation/data-sheets/tmc2209_datasheet_rev1.09.pdf can measure load and detect and signal stalling after calibration. Perhaps I should try to learn how this works, because I have been gradually loosing steps on the vertical axis.
    Christof

  • ErNaErNa Posts: 1,752
    edited 2024-11-08 16:11

    I know it works, but there might be some issues with individual motors, while all steppers are created equal, some are more equal (inspired by "animal farm")

  • @ErNa said:
    I know it works, but there might be some issues with individual motors, while all steppers are created equal, some are more equal (inspired by "animal farm")

    Hi ErNa,
    when I first read your hint I thought it was strange.
    Now after 2 full days trying lots of things, I finally really swapped the motor of the vertical axis. And this solved the issue!
    The motor with the losses has a lower cogging torque (Einrasten ohne Strom). I don't understand what happens because the holding current was never shut off during measurements. Without holding current, the axis really sank down.
    So thanks for the "strange" hint!
    puzzled Christof

Sign In or Register to comment.