You are reading a single comment by @allObjects and its replies. Click here to read the full conversation.
  • A while ago I did some coding for stepper motors - last but not lease because I could not find a reason why @fobus ' code as posted should not work. Now - a few days ago - I reclaimed the main stepper motor from a throw away OKI OL800 laser printer for a project and put it to test.

    To observe 'long' term behavior, I run it now since several days 24/7 placed next to my pc and I can hear the hum by the resonating table top.

    BUT: Once in a while, about every 6 hours - it could also be 3 hours - it 'coughs up' *badly, as if the interval is not behaving right - for about a quarter to a second - is if stepped with improper sequence or too fast. After the hick-up, things just continue as nothing has happened.

    The code is very simple - in a nutshell the essentials:

    var st = 0; // step
    var sts = [0b1001,0b0101,0b0110,0b1010]; // steps (pin outputs)
    var stPs = [C6,C7,C8,C9]; // pins
    var stp = function() { digitalWrite(stPs, sts[st = ++st % 4]); }; // stepping
    var stI = setInterval(stp,3); // every 3ms next step
    

    @Gordon, could you see any interrupt set timing issues that would lead to such behavior?

    A bit more information:

    The complete code is published in the above mentioned post, with adaption to the 2-phase 4-wire stepper and use of a L298N drive (vs. a 5-wire stepper and simple ULN2003APG driver).

    The forward and backwards steps are replaced by below ones with stepping modulo adjusted to 4 (vs 8).

    var stFW = [0b1001,0b0101,0b0110,0b1010];
    var stBW = [0b1010,0b0110,0b0101,0b1001];
    

    Since this stepper is much larger, the maximum speed I can run is r(3); (vs r(1);).

About

Avatar for allObjects @allObjects started