Stepper Motor MicroStepping? Things to keep in mind when doing it…

แชร์
ฝัง

ความคิดเห็น • 63

  • @radifuddinahmed6650
    @radifuddinahmed6650 2 ปีที่แล้ว

    In depth and accurate presentation. Please keep up the good work

  • @enaudeni
    @enaudeni 4 ปีที่แล้ว +5

    Many thanks for the tutorials, they are always interesting and helpful. You are far better than many other of the TH-camrs around Arduino etc... Keep it up, it is most appreciated! Thanks!

    • @BrainybitsCanada
      @BrainybitsCanada  4 ปีที่แล้ว

      Like I said in the video, comments like yours really keeps me going. Thanks you so much and wishing a safe and great holidays to you and your family.

  • @SkottTomas
    @SkottTomas 4 ปีที่แล้ว

    Great video once again. I find your tutorials very informative and easy to follow - Grat job and happy Holidays!

  • @lenin972
    @lenin972 3 ปีที่แล้ว

    Very informative and well made. Thank you!
    You got me rethinking the code for my telescope controller. I'm using a Teensy 4.0, which is a tiny bit faster the the UNO. Right now it is set up to give me a motion resolution which is twice that of the optics, but maybe more will be better. I'll need to experiment a little and compare the results.

  • @evgenypavlovskiy3945
    @evgenypavlovskiy3945 3 ปีที่แล้ว +16

    Nice video, thank you. I noticed that your code uses runSpeedToPosition(), so it seems that you're not using AccelStepper's acceleration/deceleration capabilities, basically the main selling point of this library. For using them, one should use either run(), runToPosition() or runToNewPosition(). With runSpeedToPosition(), one should be able to run quite a bit faster than 4000 PPS (although above certain speeds, the stepper should be accelerated gradually, rather than trying to go "from zero to hero" abruptly). The delay-based stepping has a drawback that it blocks the loop for the minimum pulse duration time (16-48 clock cycles), during that time your program can't do anything useful. As the pulse rate is increased, the amount of time spent sleeping inside the delays grows larger and larger, leaving less and less time to run any other code you have.
    I want to clarify that Arduino Uno runs at 16 MHz, and is capable of generating much more than 4000 pulses per second. The mentioned 4000 PPS limitation comes from the AccelStepper library. The library's basic operation is based on setting the output pulse pin high, delay for minimum pulse duration microseconds (1-3 depending on the driver), then setting the pin low again. Stepping like that via this library's runSpeed() or runSpeedToPosition(), or manually, you could easily output quite a few pulses per second.
    However, if one uses AccelStepper's acceleration/deceleration features, for each single step it does quite a bit of calculations to compute the new speed, including floating-point multiplications and divisions - very slow operations on an Arduino. This reduces the max possible pulse rate probably by a couple of orders of magnitude. The AccelStepper library is based on equations from an article "Generate stepper-motor speed profiles in real time" by David Austin - I couldn't find the source code, but the article says it uses 24.8 fixed-point math (and an 8-bit PIC microcontroller), unlike the AccelStepper.
    For a much more optimized code, see AN_8017 from Atmel/Microchip - www.microchip.com/wwwAppNotes/AppNotes.aspx?appnote=en591185
    It uses only integer math (including a neat integer sqrt implementation), and a timer interrupt (using the 16-bit Timer1) to manage the stepper's movement - leaving you free to do whatever you want in the main loop (no need to call run()). According to the application note, "the timer interrupt performs calculations during acceleration and deceleration and approximately 200us are used in one timer interrupt. When running at constant speed less time is need and approximately 35us is sufficient. The maximum output speed is then limited by acceleration/deceleration calculations. For a stepper motor with 400 steps per round maximum output speed is: 78,5 rad/sec (750 rpm)". The demo code is for an ATmega48 running on 3,68MHz - an Uno is 4.3 time faster, so you could use 1/8 microstep (1600 steps per revolution) and still run a (single) stepper up to 750 rpm.
    Having said that, AccelStepper provides a simple and easy-to use API, and is good for beginners. It is slow, but if it's good enough for a particular application, why not?
    The reason I posted all this is that I don't like it when people make general statements like "This 8-bit microcontroller is too underpowered to do task X at speed Y". A typical Arduino project (and many of the libraries) don't care much about doing things in a performant way, instead priority is given to other considerations, such as simple-looking code that is easy to write and read, being beginner-friendly, etc. This is great for learning to program and to tinker with electronics! But when one starts to push the boundaries of what an 8-bit 16MHz Arduino can do with these libraries and programming attitude, there are two choices - get a bigger and faster MCU (e.g. STM32, ESP32) or go deeper and learn to program your Arduino in a more direct, low-level way, learn to optimize your code. It's likely you will be able to do the same things as you were doing before, but 10, 100 or even 1000 times faster.

    • @taufikmahmud1566
      @taufikmahmud1566 3 ปีที่แล้ว

      yes I agree with you

    • @h7opolo
      @h7opolo 8 หลายเดือนก่อน

      the fact the video uploader hasn't responded to you shows how complacent and incompetent he is.

  • @doubleHLabs
    @doubleHLabs 3 ปีที่แล้ว

    nice, needed a quick refresh on microstepping

  • @adrianharrison5208
    @adrianharrison5208 4 ปีที่แล้ว

    thanks for the video it has helped with my understanding with my cnc

  • @coloradoken3926
    @coloradoken3926 3 ปีที่แล้ว +3

    May I suggest using tone() command for generating a pulse step? I have been using it for several years in the Arduiono environment and have had good luck. I drive small pumps and run them from 1-500 RPM using 16 microsteps = 53Hz to 26.5kHz. Of course, this does limit further use of the timer associated with the tone() command. Not a problem for me because I am only interested in stop/start, direction and speed when running the pump.

  • @wallybe2946
    @wallybe2946 4 ปีที่แล้ว +2

    Thank-you for your time and effort, awesome tutorial Merry Christmas/Happy New Year

    • @BrainybitsCanada
      @BrainybitsCanada  4 ปีที่แล้ว +2

      Same to you and your family, be safe and have fun! Thanks for watching and see you next year!

  • @sameerk12982
    @sameerk12982 4 ปีที่แล้ว

    Hello from India...thank you for the great video...appreciated....looking forward for more.

  • @classicrc3575
    @classicrc3575 3 ปีที่แล้ว

    Great video. Is there a wiring schematic for this setup?

  • @jackevans2386
    @jackevans2386 ปีที่แล้ว +2

    07:14 The big tradeoff is NOT the microcontroller. The tradeoff is your Arduino software.
    If you were to write your code in Microchip's Studio 7 in either ASM or even C, you could have as many steps per second as the stepper motor could handle.

  • @joramkalfa9521
    @joramkalfa9521 3 ปีที่แล้ว

    Thanks for the video. Very informative. I wondering how slow can a stepper motor turn without being "jerky".
    I'm in the middle of building a barber pole and I'm having trouble getting the pole to turn slowly without being "jerky".
    Is this a lost cause? Thanks again!

  • @ed-jf3xh
    @ed-jf3xh 4 ปีที่แล้ว +7

    Torque is also affected during micro stepping. Smaller steps, less torque.

    • @wadib3eed7
      @wadib3eed7 3 ปีที่แล้ว

      Why torque goes less as small steps ? it that because of less current goes to the windings ?

    • @ed-jf3xh
      @ed-jf3xh 3 ปีที่แล้ว

      @@wadib3eed7 You have a fixed number of magnets. Full step, greatest torque, is stepping from magnet to magnet. When you start making the steps smaller it's because you are magnetizing off center windings. This probably explains it better;
      www.linearmotiontips.com/microstepping-basics/

  • @Don_Meggi
    @Don_Meggi 4 ปีที่แล้ว

    Nice video - Merry Christmas and a Happy New Year

    • @BrainybitsCanada
      @BrainybitsCanada  4 ปีที่แล้ว

      Same to you and your family Don. All the best and see you in the next year!

  • @danielesilvaggi
    @danielesilvaggi 4 ปีที่แล้ว

    Just getting into the arduino and I want to learn all about it but I was supposed to retire this year but the company I work for decide not to give buyouts till contract time so my time is tight. I love the videos on the stepper motors as I want to build a camera slider. Thank you

    • @BrainybitsCanada
      @BrainybitsCanada  4 ปีที่แล้ว +1

      Thanks for taking the time to leave a comment, check out my channel, I've built a camera slider no long ago and I have quite a few more on controlling stepper motors. Good luck with your future projects and thanks for watching!

  • @Ayush-tl8se
    @Ayush-tl8se 4 ปีที่แล้ว

    Awesome video and very clear information.

    • @BrainybitsCanada
      @BrainybitsCanada  4 ปีที่แล้ว +1

      Thanks for watching and Happy Holidays, see you in the next year!

  • @justinssleeyt
    @justinssleeyt 2 ปีที่แล้ว

    Great video, thanks!

  • @chaithanyaprasadch3474
    @chaithanyaprasadch3474 3 ปีที่แล้ว

    Thanks for the tutorial, can u help me with controlling stepper motor with bi dectional switch

  • @saeedehsani1732
    @saeedehsani1732 2 ปีที่แล้ว

    I really enjoyed watching and learning here. and as is obviously you have so many projects done and gathered experiences from them. so please help me if you have time for this:
    I have three stepper motors which are 3 phase - 3 wired - 4 a . I know some drivers like leadshine HY-DIV268N-5A but they all are more than my budget !
    once Itried that with a driver and when I addjusted the sw setting to micro step mode 2A or 2B it worked very nice , smooth and with high torque but the direction was random!! some correct and some not!
    do you know how could I drive these nice steppers?!

  • @kraken3d718
    @kraken3d718 4 ปีที่แล้ว

    Merry Christmas - and thanks for all the great content in your videos. I always have issues with the easy driver and them getting really hot almost instantly. I have tried to use them several times just messing around with them. Maybe my steppers are to much of a load with a standard Nema 17. However they still get to hot with some of the Nema 14 / Nema 15 size motors. That why I just moved to the TMC drivers and using that with the Nano. Have to make my own make shift PCB but they seem to work well in my application. Guess I will have to try one last time with the easy drivers :(

    • @BrainybitsCanada
      @BrainybitsCanada  4 ปีที่แล้ว +1

      I hear you, the EasyDriver can get pretty hot but it is made to run hot. Adding a small heatsink will help. I've been using the EasyDriver for a while, at the time it was a good option, but there's better option out there now. In the next year I'll start using those to see how they compare. Thanks for watching and Happy Holidays!

  • @the4hunters
    @the4hunters 3 ปีที่แล้ว

    Brilliant! Subbed

  • @altamiradorable
    @altamiradorable 4 ปีที่แล้ว +2

    Merci Yvan ! ;)

  • @JM_Tushe
    @JM_Tushe 2 ปีที่แล้ว +1

    What about torque? How is it affected? And do they need more current when using micro stepping?

  • @mehmetaligorur4183
    @mehmetaligorur4183 ปีที่แล้ว

    Where are you mate? I hope that everything is perfectly fine and you are away just because you wanted to.
    Missed the way you thought things. Hope we gonna see you around again. Cheers!

  • @Thermo88
    @Thermo88 2 ปีที่แล้ว

    how can i control the direction of stepper using external signals such that when the first signal is high and the second is low turn in clockwise , when change states turn in the anticlockwise and when the two are low stop the motor
    please would you help me with the code to do so?

  • @chanchalsakarde2768
    @chanchalsakarde2768 2 หลายเดือนก่อน

    lets say in your circle u have 400 locations as 400 teeths on it, each location identified as numeric location id, so how can we move to pointer to series of location given... for example starts from 0 to 10 then move to 34 -> 200 -> 90 -> 275 -> 345 and so on .. how to do these series moves one after other

  • @webslinger2011
    @webslinger2011 4 ปีที่แล้ว +1

    Merry Christmas!

    • @BrainybitsCanada
      @BrainybitsCanada  4 ปีที่แล้ว

      Same to you and your family, thanks for watching and see you next year!

  • @alvarobyrne
    @alvarobyrne 3 ปีที่แล้ว

    Nice! TY YT! Wouldn't you want to include thisone in your stepper motors tutorials playlist?

    • @BrainybitsCanada
      @BrainybitsCanada  3 ปีที่แล้ว

      I'm always forgetting to add new videos to playlists. Thank you for reminding me and for watching!

  • @Bianchi77
    @Bianchi77 ปีที่แล้ว

    Nice video, thanks :)

  • @TheHectorOg
    @TheHectorOg 4 ปีที่แล้ว

    Nice content.

  • @whitefields5595
    @whitefields5595 4 ปีที่แล้ว +2

    Ivan, thanks for this. How is the torque affected when microstepping. I presume as the signal is ‘shared’ across coils the torque is reduced?

    • @BrainybitsCanada
      @BrainybitsCanada  4 ปีที่แล้ว +2

      This is a tricky one, depending on a lot of variables, voltage, stepper motor, etc.. but in most cases you can expect around less than 10% loss in torque when micro stepping, but again this is not consistent. I will try to make a test bench of this to see what I come up with in the next year :) Thanks for watching and happy holidays!

    • @an_R_key
      @an_R_key 4 ปีที่แล้ว

      @@BrainybitsCanada +1 for this test. Also, thanks for uploads. Very interesting stuff. Learning a lot.

    • @barenekid9695
      @barenekid9695 4 ปีที่แล้ว +1

      Torque losses are proportional to the number of micro steps attempted + the speed of rotation used.. at 256 steps there ain't much left.
      Also the precision falls off just as proportionally, as Interpolation can only go so far in dividing up the magnetic poles ..cleanly . (as if :-)
      Short answer: Micro stepping our Cheap Ass Chinoiserie steppers is often Pointless even counterproductive.
      There are Far better ways to genuine precision with Torque ..such as Gasp! reduction gearing

  • @wadib3eed7
    @wadib3eed7 3 ปีที่แล้ว

    which better case for using some steps ? 1/2 or 1/8 or 1/32 .... ?

  • @ortizgab
    @ortizgab 3 ปีที่แล้ว

    Hi there! I followed your project to automate an old slider and "almost" works perfectly ... The electronics work very well but the video picks up a shake when I use high focal lengths. I'm using vibration dampeners.
    Any suggestion?

    • @ortizgab
      @ortizgab 3 ปีที่แล้ว

      *UPDATE* I just found the TMC2208 to be much quieter. Could you help me make the connection by replacing the EASY
      DRIVER for this?

  • @thanasisathanasi4965
    @thanasisathanasi4965 4 ปีที่แล้ว +2

    What about torque! Also can you move by a single microstep? Nobody tells us !!!

  • @electro7939
    @electro7939 ปีที่แล้ว

    Amazing

  • @fatihmeral9863
    @fatihmeral9863 7 หลายเดือนก่อน

    what happens to torkue when microstepping

  • @Emptiness-
    @Emptiness- 4 ปีที่แล้ว

    Did you need an external power source for the motor?

    • @Emptiness-
      @Emptiness- 4 ปีที่แล้ว +1

      I made myself useful and read on your website that you used a 24V 5A source. I am currently power my stepper motor with the 5V usb cable to the pc so I could not get higher speeds than 70 rpm. At higher speeds the motor would just skip.

  • @vzr314
    @vzr314 3 ปีที่แล้ว +1

    Not a single word about vref and max current settings in microsteping mode :(

  • @vzr314
    @vzr314 3 ปีที่แล้ว +1

    The thing that limits your speed is not microcontroller but your code. You shuld use stepper motor based on interrupts and avoid delay() in main loop. Instead, you said that Arduino Uno is bottleneck...

  • @paulocella9745
    @paulocella9745 3 ปีที่แล้ว

    Gooooood!!

  • @qozia1370
    @qozia1370 8 หลายเดือนก่อน

    lol 16 mhz! go with an esp32

  • @ibrahimabdeen105
    @ibrahimabdeen105 3 ปีที่แล้ว

    Please I need code of arduino which used for drawing full wave rectifier diode

  • @h7opolo
    @h7opolo 8 หลายเดือนก่อน

    3:25 wow, mispronunciation of the word "variables." well, this video would be unfit for youtube if it were perfect, eh.
    4:16 mispronunciation of the word "orientation." please tell me English is not your native language.