Controlling 3 Stepper Motors with the AccelStepper Library for Arduino

แชร์
ฝัง
  • เผยแพร่เมื่อ 10 พ.ค. 2024
  • In this video, I demonstrate how to simultaneously control three stepper motors with the Arduino Uno and the Accel Stepper Library with discrete examples.
    Check out this Reference Desk Mat for Arduino:
    amzn.to/3vO6QBl
    Video Timestamps:
    0:00 - Introduction
    0:25 - Installing the library
    0:45 - Parts needed
    1:02 - Wiring the circuit
    1:48 - Moving a single motor to a specific position (blocking)
    4:16 - Sequentially three motors to specific positions (blocking)
    4:57 - Simultaneously moving three motors to specific positions
    7:18 - Simultaneously moving three motors at a constant speed
    8:10 - Simultaneously moving three motors to a position at a constant speed
    9:09 - Using potentiometers to simultaneously control the speed of three motors
    10:20 - Using potentiometers to simultaneously control the position of three motors
    👉Subscribe for more robotics and engineering tips:
    / @theboredrobotllc
    Share this video with a friend:
    • Controlling 3 Stepper ...
    Website:
    www.theboredrobot.com/
    Parts needed for this example:
    Arduino Uno - amzn.to/3pGK6Am
    Stepper Motors - amzn.to/3qtbr9A
    Stepper Motor Drivers - amzn.to/3QpceTP
    Power Supply - amzn.to/3DKs2sF
    Connect:
    Instagram - /theboredrobot
    Twitter - @theboredrobot
    Facebook - / theboredrobot
    Pinterest - /TheBoredRobot
    Disclaimer: This video contains affiliate links, meaning that if you make a purchase from one of the product links, I'll receive a small commission.
  • วิทยาศาสตร์และเทคโนโลยี

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

  • @mattinkel7342
    @mattinkel7342 3 หลายเดือนก่อน +11

    That was brilliantly demonstrated and one of the clearest code descriptions I've seen on this subject.

    • @TheBoredRobotLLC
      @TheBoredRobotLLC  3 หลายเดือนก่อน +1

      Thanks! I'm glad you liked it.

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

      Lcd

  • @KW-ei3pi
    @KW-ei3pi 8 หลายเดือนก่อน +5

    Very nicely done. Thank you. I'm glad that you noted that the documentation for the Accelstepper library "can be difficult to follow". This is true, even with some experience with Arduino. Another TH-cam creator just say's "Read the documentation" when asked a question. Thanks again. I will look at your other videos.

  • @drinski6720
    @drinski6720 5 หลายเดือนก่อน +1

    The best demonstration of Accel Stepper Library. Thank you!

  • @GlipValor
    @GlipValor 8 หลายเดือนก่อน +6

    Just a comment to promote this content. Clean and detailed

    • @TheBoredRobotLLC
      @TheBoredRobotLLC  8 หลายเดือนก่อน +2

      Thank you! Much appreciated.

  • @electronics.unmessed
    @electronics.unmessed 6 หลายเดือนก่อน

    Pretty comprehensive - like it - thanks for sharing!

  • @timblewden5399
    @timblewden5399 9 หลายเดือนก่อน +2

    excellent video cheers

  • @skaespearesboys5999
    @skaespearesboys5999 12 วันที่ผ่านมา

    This made much more sense of the Accel Stepper Library. Thank you

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

    Yes, very well done. Clear, simple, and thorough. Quite excellent.

  • @johnnicol5009
    @johnnicol5009 6 หลายเดือนก่อน

    Nice tutorial. Clear and well explained.

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

    Thank you, I am working on a new product with the same setup but using the ESP32.

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

      Good luck! I hope this video helps move the project along.

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

    Thank you sooo much! I've been confused by the AccelStepper library and this helped me understand it much better. If you're a bonehead like me, **double-check** your Dir and Pul wires. I had them crossed and it was still "kinda" working, but the step counts were off.
    Next for my project will be an attempt to add G-code conversion. Hopefully I can find a Library for that as well. But, if not I think I I'll try write it myself using these commands!
    Thanks again! great work!

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

      Thanks! Good luck on your next project.

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

    Clearly explained .👏👏

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

    Excellent video. Thanks much.

  • @alkimadsiz4867
    @alkimadsiz4867 8 วันที่ผ่านมา

    Very helpful video thanks

  • @gregortrierscheid1025
    @gregortrierscheid1025 3 หลายเดือนก่อน

    Excellent!

  • @guillemfuste3839
    @guillemfuste3839 23 วันที่ผ่านมา

    Omg that could have been so useful 5 years ago on my highschool project

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

    is it possible to move two steppers at the same way as you explained with runToNewPosition, like a program structure?

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

      Yes, you can either set up additional variables and objects and run the motors in parallel. Or you can try simply running the motor controller leads to the same pins on the Arduino.

  • @Ockhamcool
    @Ockhamcool 26 วันที่ผ่านมา

    Thanks for this helpful video. Makes sense, and explained at a good pace. QUESTION: Do you have a video to show simple contact closure switch/motor control integration? (i.e. simple code for stopping and starting individual motors with a simple switch) Thank you!

    • @TheBoredRobotLLC
      @TheBoredRobotLLC  21 วันที่ผ่านมา

      Sorry, I haven't created a video like this.

  • @chirots
    @chirots 6 หลายเดือนก่อน

    Mainly I use PLC for most projects either big or small, because it is much easier. Often I watch arduino projects and admire people for all programing skills. Personally I hardly use Arduino, because my C language is below average and I prefer using python and micropython for pi and Pico. I can write classes in python, but impossible to do in C.
    You explained really well.

  • @GPTBot1123
    @GPTBot1123 8 หลายเดือนก่อน +1

    Wow. Actually doing a very similar project right now. Arduino, steppers, plus a little Python just for fun. Using python to pair the Arduino outputs to keyboard/mouse inputs using serial communication.

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

      Nice! That sounds like a fun project.

    • @isabelwilliams8072
      @isabelwilliams8072 6 หลายเดือนก่อน +1

      I’m doing that but for homework ;-;

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

    Hi, thank you for this informative video.
    I would like to know if I have to use a TB6600 driver with a NEMA 17 motor, will the code be the same for constant speed?

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

      For the most part, the code should be the same. You'll need to verify your pin assignments.

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

    Hey man! Your explanation was clear and helpfull! I've been trying to use this same library to control 2 Nema 17 motors, on my line follower robot. But when add the code to read some IR sensors, it start's to stop the nema motors. After a quick search for similar problems on the internet, I've found that i can't have functions with that library that take to much time. I'm currently using an Arduino Uno, what if I move to a fast MCU, do you think it can solve this problem? I'm open to other alternatives!

    • @TheBoredRobotLLC
      @TheBoredRobotLLC  26 วันที่ผ่านมา

      Using the non-blocking AccelStepper commands help with speed. Perhaps the faster version of the Arduino can help as well.

  • @ahmadqadi2127
    @ahmadqadi2127 5 หลายเดือนก่อน

    Thanks for the video ,,, how do you know the acceleration for stepper ?

    • @TheBoredRobotLLC
      @TheBoredRobotLLC  5 หลายเดือนก่อน +1

      The value you choose for setAcceleration() is in units of steps per second squared.

  • @user-bk3zj2wd4d
    @user-bk3zj2wd4d 7 วันที่ผ่านมา

    It would be nice if you could be more specific about the parts you used, such as the potentiometer

    • @TheBoredRobotLLC
      @TheBoredRobotLLC  4 วันที่ผ่านมา

      The main parts are in the description. Any hobby level pot will do for this example. In the video, I used the ones from the Arduino starter kit.

  • @chris-hs
    @chris-hs 6 หลายเดือนก่อน

    Hello! What if I want to move 3 steppers simultaneously, but have other moves it should do after while still having these three simultaneously moving?

    • @TheBoredRobotLLC
      @TheBoredRobotLLC  6 หลายเดือนก่อน

      If I understand the question, you have three motors that will move in exactly the same fashion. Then you'll have additional motors moving in a different way from these three. If this is the case, the first three motors can have the same direction and step pins on the Arduino. Then the other motors can be wired independently.

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

    any ideas why when i do the first example the stepper is very jittery and vibrates. but when i do other example it moves very smooth and silently. no hardware is changed in between tests.

    • @TheBoredRobotLLC
      @TheBoredRobotLLC  7 หลายเดือนก่อน +1

      It's hard to answer this without more information. If I was running into this issue, I would first play around with speed and acceleration values to see if that changes anything. I've also run into jittery motion when the potentiometer on speed controller was set too low.

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

      @@TheBoredRobotLLC it was the speed. when too low it jitters, when higher its smoother. thanks

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

      @@TaitumLaroque I'm glad you figured it out.

  • @user-gb5jc9ik1b
    @user-gb5jc9ik1b 6 หลายเดือนก่อน

    if i call set speed to a positive value in one loop and do another loop and set it at a negitive value the rotation moves in the same direction and doesnt change directions like your example. Any ideas on why the direction doesnt change when i change the setSpeed?

    • @TheBoredRobotLLC
      @TheBoredRobotLLC  6 หลายเดือนก่อน

      You don't change direction by changing the value to negative. You need to change direction by flipping the value of the direction pin.

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

    Thank you for the video friend, it really helped me out! I seem to be running into a bit of a problem though, the acceleration at the beginning causes low speeds which in return compromises the accuracy of the rotation. I give it the 200 steps 360 degrees command but each time it is off by a few steps. I wanted to use the setSpeed() with the stepper1.runToPosition command but cant get it to work, it just assumes acceleration is equal to 1. Might I ask for assistance ? :)

    • @TheBoredRobotLLC
      @TheBoredRobotLLC  2 หลายเดือนก่อน +1

      You can reach out here if you want to dive deeper into the specifics of your code:
      theboredrobot.com/pages/contact

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

      thanks for the response@@TheBoredRobotLLC

  • @greenenko
    @greenenko 6 หลายเดือนก่อน

    Hi! What if i have something else besides of stepper.runSpeed in the loop? For example pid control. And it blocks correct steppings, how to deal with it?

    • @TheBoredRobotLLC
      @TheBoredRobotLLC  6 หลายเดือนก่อน

      I would suggest using the non blocking commands in the case where you want to implement feedback control.

  • @kifahzaidan4505
    @kifahzaidan4505 4 หลายเดือนก่อน

    Hi,
    I really appreciate your efforts and the knowledge you have shared. I am seeking help with developing a code and schematic diagram for a project that involves preset positions using push buttons, an encoder, a linear actuator, and either a DC or stepper motor, to be controlled by an Arduino Mega or UNO. The main goal is to enable the actuator to stop at specific positions selected by the user, which can be easily recalled at any time. I understand that this is quite a complicated task, but any assistance you could provide would be greatly appreciated.
    Regards

    • @TheBoredRobotLLC
      @TheBoredRobotLLC  4 หลายเดือนก่อน

      Sure, I would be happy to help. I do offer consulting/tutoring services. Feel free to contact me here and we can open up that discussion.
      theboredrobot.com/pages/contact

  • @TheBhaskarsingh
    @TheBhaskarsingh 5 หลายเดือนก่อน

    Which capacitor i shall use and can I use 4 stepper motor

    • @TheBoredRobotLLC
      @TheBoredRobotLLC  5 หลายเดือนก่อน

      That depends on the motors you're using. Here's a good resource that I found that may help with the question:
      resources.pcb.cadence.com/blog/2022-what-size-capacitor-should-i-use

  • @lorenzodalvise9367
    @lorenzodalvise9367 4 หลายเดือนก่อน

    How can I make the stepper motor stop jumping between values when controlled with a potentiometer?

    • @TheBoredRobotLLC
      @TheBoredRobotLLC  4 หลายเดือนก่อน

      You would have to implement a smoothing or filtering function on either the signal being read the for the pot, or the value being sent to the motor driver.

  • @AB_Pyrotechnic
    @AB_Pyrotechnic 4 หลายเดือนก่อน

    preface: sorry for being an Arduino noob.
    I am controlling a motor(s) with constant speed. Is it possible to control the acceleration of the motor to its running speed? I cant seem to figure it out and I have been trying for HOURS.

    • @TheBoredRobotLLC
      @TheBoredRobotLLC  4 หลายเดือนก่อน

      Yes you can control the acceleration using the setAcceleration() command. The value of the acceleration goes inside of the parenthesis.

    • @AB_Pyrotechnic
      @AB_Pyrotechnic 4 หลายเดือนก่อน

      @@TheBoredRobotLLC Every time I try that it doesnt do anything. it just goes to its set rpm instantly.

  • @thelegendplz6136
    @thelegendplz6136 5 หลายเดือนก่อน

    What application did you use to create your circuit diagram?

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

    After I've grasped all the concepts involved in doing this, how hard would it be to implement stepper motor control over ethernet on a client?

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

      To be honest. I've never done anything like that before. It would involve a bit of research on my end.

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

      @@TheBoredRobotLLC Thanks for the response.
      I've been at it for a few days and have made some progress!
      Here is what I currently have working.
      I have a client PC on the network running a python script with Pygame Library, Requests library, and time.
      I'm able to send button presses from my controller via http to the Arduino which has an ethernet shield, running Ethernet library & accelstepper library.
      I got the motor to respond to button presses. Now I just have to learn how to control it better.
      The end goal is to be able to control a camera slider via http requests and gamepad.

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

    Is there any open source code for Arduino to open and close a house window with a stepper motor actuator 10 or more times in a day; code that one can edited the hours to open and close a house window? Maybe someone made a library to do this. I can not find anything.

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

      I'm not aware of any open source code that does specifically this task. Maybe there are projects that do pieces of it.

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

      @@TheBoredRobotLLC Thanks for the reply. I am beginning to think this type of operation is a bit much for the Arduino boards. I just found out telescope trackers do not use Arduino boards.

  • @ganeshreddy6965
    @ganeshreddy6965 4 หลายเดือนก่อน

    hello Sir i am just beginning my project and i am new with Arduino i have used same code but my driver is TB6600 but it did not work can please help me in coding .

    • @TheBoredRobotLLC
      @TheBoredRobotLLC  3 หลายเดือนก่อน

      That's a pretty broad question. That driver should work pretty much the same. You just need to makes sure you're pin assignments are correct.

  • @queenidog1
    @queenidog1 12 วันที่ผ่านมา

    Very good video. Where's the code?

    • @TheBoredRobotLLC
      @TheBoredRobotLLC  11 วันที่ผ่านมา

      github.com/TheBoredRobot/TH-cam-Code

  • @ksssilver
    @ksssilver 3 หลายเดือนก่อน

    wonderfull. thank you very much.

    • @TheBoredRobotLLC
      @TheBoredRobotLLC  3 หลายเดือนก่อน

      Thank you. I hope it helped!