Raspberry Pi Stepper Motor Tutorial

Sdílet
Vložit
  • čas přidán 6. 09. 2024
  • This tutorial demonstrates how to control bi-polar stepper motors on a Raspberry Pi in Python using a DRV-8825 stepper motor driver.
    Notes, schematics, code, updates and other resources are available on my website: www.rototron.in...

Komentáře • 399

  • @boatalarm5920
    @boatalarm5920 Před 4 lety +89

    OMG... This guy KNOWS HOW TO MAKE A GREAT TUTORIAL! Fast, concise and NO music!!! FIVE STARS!!!!!

  • @jozefsoucik3115
    @jozefsoucik3115 Před 4 dny +1

    comparing your explanation and knowledge compared to tons of india tech guy....it cannot be compared in any way....fulll explanation in all aspects..thanx for that

  • @thebunyip
    @thebunyip Před 7 lety +35

    You do a fantastic job of presenting a complex (probably not for you) system. I am an old school mainframe programmer from the 60's-70's. I have two Raspberry Pi's and am programming the hell out of them but you put my playing to shame. Kudos and love your tutorials

  • @neoc03
    @neoc03 Před 6 lety +69

    This is far and away the best tutorial on this! Thank you so much for being so clear and concise.

    • @furman87
      @furman87 Před 6 lety +2

      Agreed. I learned more about stepper motors and how to control them in this tutorial than anywhere else I looked. After mocking up something on a breadboard and getting it working, I transferred that onto a Raspberry Pi HAT breadboard and it works fantastically

    • @eilunhtau
      @eilunhtau Před 5 lety

      May be, but I can not understand the language of this video. For me it is therefore useless.

    • @bobluby2962
      @bobluby2962 Před 3 lety

      Thk u

    • @almostcool9216
      @almostcool9216 Před 3 lety

      I also agree A+++ on raspberry code explain and wiring info

  • @akshayd211
    @akshayd211 Před 5 lety +3

    I am 100% sure that this is the best video tutorial on this topic in the WORLD.

  • @pranavsreedhar1402
    @pranavsreedhar1402 Před 3 lety +2

    This is so informative that it should reach every stepper motor enthusiast out there....

  • @tomd7841
    @tomd7841 Před 3 lety +4

    One of the clearest tutorials I've ever seen. Great work. Thanks very much!

  • @FabricioRWitt
    @FabricioRWitt Před 8 měsíci +2

    This is an exceptionally excellent tutorial and class. Thank you so much for sharing your knowledge! I'm currently studying stepper motors for usage on precision peristaltic pumps for prototyping a dosing machine. Thank you once more, you're great!

  • @JimEckhardt
    @JimEckhardt Před rokem +2

    Best stepper vid I've come across yet! So many useful little nuggets in there.

  • @johnrobie9694
    @johnrobie9694 Před 4 lety +3

    A lot of clever little tricks sprinkled throughout this video. Thanks!

  • @chop661
    @chop661 Před 4 lety +14

    Perfect explanation, concise, to the point and well presented. Thank you!

  • @sandro-nd6ir
    @sandro-nd6ir Před 2 lety +3

    This is simply one of the best tutorials I have ever seen. Thank you so much :)

  • @graceyee9067
    @graceyee9067 Před 3 lety +4

    Wow, this is the most concise and informative tutorial I've ever watched, thank you for taking the time to make it!

  • @y2ksw1
    @y2ksw1 Před 3 lety +2

    This is the best tutorial I have ever seen!

  • @aaronacj
    @aaronacj Před 5 lety +2

    Why can't every tutorial video be this good?

  • @ThomasAndersonbsf
    @ThomasAndersonbsf Před 6 lety +1

    thank you for this work as it did open some aspects of the PI to me, but also covered the method of telling what your stepper driver is doing, so that you can set it ahead of time to around what you need with a lot less fidgeting to get the output for a given motor, (if you know the values it is supposed to receive) to get it set up, the first time. Again thank you.

  • @arbjful
    @arbjful Před rokem

    Nanotec makes some really great stepper motors and drivers, we use these a lot for our industrial applications

  • @aaronjs99
    @aaronjs99 Před 6 lety +7

    Hey... Gotta say that this video was worth watching!!!

  • @ghost2coast296
    @ghost2coast296 Před 5 lety +3

    thank you! I really like how you took the time to walk through all the code and explain it to us

  • @blackmennewstyle
    @blackmennewstyle Před 4 lety

    By far one of the best tutorial about the Raspberry Pi and Stepper motor i have seen

  • @QuarrySteam
    @QuarrySteam Před 3 lety +1

    Brilliant tutorial, to the point and no waffling. Really useful thanks very much

  • @dannyarroway4187
    @dannyarroway4187 Před 2 lety +2

    Excellent tutorial! Clear and concise! bravo!

  • @drm42
    @drm42 Před 6 lety +4

    Awesome tutorial with a great amount of details shared. Thank you!

  • @balajitj
    @balajitj Před 6 lety +1

    Excellent tutorial, explanations are just crisp and clear.

  • @eajinarc4425
    @eajinarc4425 Před 4 lety +48

    After watching this video...
    Me: "OK, I got it, let's try it"
    My Raspberry Pi: "No, you didn't"

    • @gizehtriana9569
      @gizehtriana9569 Před 4 lety

      same to me but maybe its the version that we use... depend on version tha for i in range( in my case) is different to python 2.7

    • @baresrs7367
      @baresrs7367 Před 3 lety

      For real cuz . exactly how I feel Xd

  • @maiodab670
    @maiodab670 Před 6 měsíci +1

    Hi I starting my small project with stepper motor and I found your solution for controlling it , I am very impressive of you work , The last part using hardware_PWM is great and doing exactly what I need , but one thing :) how to change the direction instead slowing down. I mean the motor will do one ramp on CW direction then another ramp but on CCW direction .

    • @rdagger
      @rdagger  Před 6 měsíci +1

      I'm not sure I understand your question. It has been a long time since I used this library, but you should be able to set the direction using pi.write(DIR, 0) or pi.write(DIR, 1).

    • @maiodab670
      @maiodab670 Před 6 měsíci

      @@rdagger Thanks a lot, I have solved my problem .

  • @subodhawanasundera3957
    @subodhawanasundera3957 Před 6 lety +2

    Great tutorial, very clear explanations. Easy to understand & well structured. Thanks heaps!

  • @kylevasulka8568
    @kylevasulka8568 Před rokem +2

    Wow. Such a clear explanation 👏 excellent job!

  • @georgkettele6911
    @georgkettele6911 Před 2 lety

    Best tutorial ever!

  • @magna59
    @magna59 Před 6 lety

    Great work & nice to see something without having to listen through background music .

  • @tomrouillard3908
    @tomrouillard3908 Před 6 lety +4

    Excellent job - hugely informative and useful. Thank you.

  • @zosxavius
    @zosxavius Před 7 lety +2

    This was exactly what I needed to see. Thank you so very much!

  • @DenfordBerriman
    @DenfordBerriman Před 7 lety

    Great tip using the LED to figure out the pairs. I had headers wired the wrong way till I tried this. Thanks.

  • @parameciumcheese
    @parameciumcheese Před 6 lety +4

    Fantastic video! Thanks for taking the time to make this. Answered all my questions and more.

  • @mo_adventures
    @mo_adventures Před 5 lety

    You are a hero! Thanks a lot for explaining this to us this clearly! I needed someone to explain this to me like I'm braindead!

    • @barirwin8559
      @barirwin8559 Před 5 lety

      me too! I'm really good at blinking a lot

  • @johnerickson6765
    @johnerickson6765 Před 5 lety +1

    Excellent tutorial. Would also like to see one with C++ control.

  • @kentharris7427
    @kentharris7427 Před 2 lety

    I am wanting to use a Raspberry Pi Pico to run a NEMA 34 stepper motor. IMO using a raspberry pi to run a stepper motor is like driving an 18 wheeler to the store to buy milk and eggs. Granted the Pico was released after this video was made. The problem with the Arduino is the frequency is not high enough to run the NEMA 34 at maximum speed. I am going to experiment with the DRV-8825 Controller since it takes up less Real Estate then a standard Stepper Controller.

  • @boredbritgamercouk
    @boredbritgamercouk Před 4 lety +3

    Hi, firstly this code (including the micro-steps) all worked great for me. I was just wondering if you could further customise the code to allow manual control of the motor (ie typing a positive or negative value into terminal so motor moves clockwise or anti-clockwise a number of steps) and then controlling multiple motors at once? I'd love to run up to 4 motors and I think this is such a solid base setup for code but looking for some help! Thanks :)

  • @allaryyan6608
    @allaryyan6608 Před 6 lety +1

    thank you for this tutorial! your effort is deeply appreciated.

  • @anactualmechanic2058
    @anactualmechanic2058 Před 6 lety

    This is an awesome video. I have been struggling to use a RPI with a serial port HAT to control bipolar stepper motors using old Shopbot control boards and the Shopbot DOS program through an emulator. It works, but the DOS emulation is not powerful enough to run the motors at full speed. It looks like I need to try a DRV-8825 and learn some Python. Thank you!

  • @vladimirpotapov7050
    @vladimirpotapov7050 Před 2 lety +1

    Nice tutorial, thank you a lot !

  • @djtyros
    @djtyros Před 2 lety

    HELP PLEASE. Yes I love the presentation as everyone else has mentioned. However, I'm at a loss here... I've hooked everything us as seen, and my motor wont move at all. There's no resistance either, just as though the power is off completely...
    So It's a sl42sth34-1334a stepper motor I 'borrowed' from my Flyingbear 3d printer.
    The stepper driver is a generic pololu ripped from a ramps board (i tried two, same issue)
    When measuring the v.ref pot, I'm getting a range from 0.00v to 0.20v (on both drivers)
    The driver is green, with a small square chip. The text on the chip is: 4988ET A1640 990L
    Tested motor with the LED coil test, both coils are generating power, and lighting the led.
    The cap i'm using is 24v 100uF
    The External PSU is 12v
    If you have any suggestions, please let me know. Thank you :)

  • @stephmo371
    @stephmo371 Před 3 lety +1

    This has been so helpful. Thank you for this

  • @newideas3249
    @newideas3249 Před rokem +1

    EXcellent video, just what I needed 😄

  • @miebmieb6543
    @miebmieb6543 Před 3 lety +1

    This video will help me so much, Thank you!

  • @AeroLens_by_SP
    @AeroLens_by_SP Před 3 lety

    Great Video,
    I need to move my stepper motor as a function of sine wave
    lets say for time in incrementing from 0to 100s
    y=amplitude*sin(2*pi*frequency*t)
    so displacement of stepper motor should as per change in y
    could you help me in that

  • @gregpetryk1696
    @gregpetryk1696 Před rokem

    I followed this to the letter looking for answers why my stepper motor does not turn smoothly, but is very erratic and jumps in both directions. I've been hoping to find out why I'm having this problem.

  • @KingGrio
    @KingGrio Před rokem +1

    This is an awesome tutorial

  • @heyisforhumans
    @heyisforhumans Před rokem +1

    Excellent video!

  • @Migueldeservantes
    @Migueldeservantes Před 3 lety

    can I setup a set of If then commands to follow up with an small toy machine?? like an small excavator???

  • @TheHoinoel
    @TheHoinoel Před 3 lety +1

    Wow this is really dense. Great tutorial, thank you :)

  • @sphereintelligence
    @sphereintelligence Před 4 lety

    First example which actually made my motor run using Python on the Raspberry, a lot of other tuts did not make my motor run. I used Livecode too, which also works, but the graphic interface interferes with the motor strangely. With the GPIO i got errors like: please use GPIO.setmode(GPIO.BCM) which i did, so i don't understand this error, also it also run only CW and not CCW, could see the motor react on it and stalled.

  • @pgtips4240
    @pgtips4240 Před 2 lety

    Hi, this video is a bit over my head. Can you recommend a video that explains all the things you are doing and why? Thanks.

  • @larbigueraiche6721
    @larbigueraiche6721 Před 5 lety

    This is the best tutorial I have seen. However, could you tell me please how the code becomes if we want adjust the speed of a stepper motor by selecting a specific frequency (example :1010 Hz) using hardware_PWM(18, frequency, duty cycle) and then rotate the motor with a specific angle at that speed ?

    • @rdagger
      @rdagger  Před 5 lety

      To accurately control both frequency and steps, I think you would need to use the PiGPIO _generate_ramp()_ method. I’m not sure if it supports the hardware PWM which would afford more precise frequency control. It might automatically switch to hardware if you use GPIO 18. You would have to hook up a scope to determine if you are getting the correct frequency. You could also ask Joan the creator of PiGPIO. She is very good about responding to questions and she might have additional recommendations.

  • @rongrongwu
    @rongrongwu Před 3 lety +1

    Very good video, very helpful! Thanks you.

  • @robsciuk729
    @robsciuk729 Před 6 lety

    Timely, succinct and complete ... *THANKS*

  • @NothingMuchhere2see
    @NothingMuchhere2see Před 3 lety

    can you make a video on how to control a motor using serial communication with modbus rtu rs485 usb converter and python

  • @Daniel.DAgostino
    @Daniel.DAgostino Před 3 lety +1

    Wonderful video. Engaging and informative.

  • @davidcross3075
    @davidcross3075 Před 5 lety

    First off thank you for such a clear and detailed explanation of this process. I have been successful in performing your steps. My application has a need for switch controlled movement with a pair of momentary buttons. ex. button 1 press moves ccw until released and a press of button 2 moves cw until released. Any guidance for this capability would be appreciated. I don't want to have to change over to an Arduino solution if i don't have to. My application is for a Z-axis bed for a laser engraver that will be controlled separately. Again thanks for your videos..

    • @rdagger
      @rdagger  Před 5 lety

      My example with the toggle switch would work. You just need to change the main loop to something like:
      dc = 128
      if pi.read(SWITCH1) == 0:
      pi.write(DIR, 0)
      elif pi.read(SWITCH2) == 0:
      pi.write(DIR, 1)
      else:
      dc = 0
      pi.set_PWM_dutycycle(STEP, dc)
      sleep(.1)

    • @davidcross3075
      @davidcross3075 Před 5 lety

      @@rdagger thanks for the head start... i'll be giving this a try soon.

  • @venkateshyadla9503
    @venkateshyadla9503 Před 5 lety +2

    THAnk you boss... thanks for deep explanantion..

  • @herantd
    @herantd Před 3 lety

    If you have A4988 it needs to be wired a bit differently

  • @AliSaldin
    @AliSaldin Před 7 lety

    every time you upload amazing video thank you for your affairs

  • @jashan9845
    @jashan9845 Před rokem +1

    This was super helpful!! Thank you

  • @Lortagreb
    @Lortagreb Před 3 lety +1

    IT WORKS thank you.

  • @angelplack76
    @angelplack76 Před 3 lety

    Hi guy thanks for your explain is vero complete congratulations

  • @ronpearson1912
    @ronpearson1912 Před 4 měsíci

    I wonder if its possible to integrate PID control in this as well

  • @asefron8159
    @asefron8159 Před 2 lety

    Hey, in the last code even the loop is infinite my step motor stop after accelerated a few seconds later.

  • @ColeLashley
    @ColeLashley Před 3 lety +1

    Hello, I am a software engineer looking to make a cnc machine and I'm a bit confused on some of the electrical engineering aspects of this. Could you explain how I could use a capacitor to ensure that my power supply is safe if I am soldering directly and not using a breadboard?
    Thanks!

    • @rdagger
      @rdagger  Před 3 lety

      The capacitor is to protect the DRV8825 board from LC voltage spikes. You should put a minimum 47 µF electrolytic capacitor rated for at least 50 V across motor power (VMOT) and ground somewhere close to the DRV8825 board. Please see the Pololu Robotics DRB8825 product page for more details: www.pololu.com/product/2133

  • @michaelmckiernan4061
    @michaelmckiernan4061 Před 6 lety

    Very Good.You have solved many questions. The BIG AH HUrH. THANK YOU.

  • @aboudezoa
    @aboudezoa Před 2 lety +1

    Very well explained

  • @grahamb007
    @grahamb007 Před 2 lety

    One other question... What is supplying power to the 3.3V rail on the breadboard. Is it coming from the raspberry pi? The breadboard I purchased came with a generic power supply circuit board with pins aligned to supply 3.3V and ground to the outer rails of the breadboard. Could that be used with this type of setup or is it obsolete since we're using the raspberry pi? Thanks again

    • @rdagger
      @rdagger  Před 2 lety

      The 3.3 V power is coming from the Pi. At 5:54 I connect a 3.3 V pin from the Pi to supply logic power to breadboard's power rails. You can use your breadboard's power supply assuming it is 3.3 V. However, you still need to connect a ground from the Pi to the breadboard's ground rails to establish a common ground because voltage is relative. I would not use the breadboard's power supply because it adds another potential failure point, and it doesn't provide any benefit other than saving 1 wire.

  • @rajwaghmare8547
    @rajwaghmare8547 Před 5 lety

    Hello, what would be the ideal voltage of drv 8825 driver if usinf a nema stepper with 1.5A current at 12V. I want to make a button presser to press button of 1.6N in a full step mode but its skipping a step while pressing a button thus not presing it all the time

  • @PhG1961
    @PhG1961 Před 2 lety +1

    Great video !!

  • @KangJangkrik
    @KangJangkrik Před 2 lety

    Is it a good idea to connect STEP pin to hardware PWM pin on RPi? Thanks!

  • @Bidouillerfr
    @Bidouillerfr Před 3 lety

    Hello, I am trying to do the same with a raspberry pi zero, a nema 17 stepper motor and an L9110S controller but without success, the motor vibrates and spins randomly. can you help me ?

  • @MrZhefish
    @MrZhefish Před 4 lety

    i wish there would be a implementation for gpio in ugs or bcnc or something, so you can actually use your rpi directly without having to connect a extral driver board. it's just a matter of programming, but nope.... non existing, or at least, not to be found.

  • @1Sweet__
    @1Sweet__ Před 6 lety

    Hello, very good tutorial, hepled me a lot! I just have one problem, I wanted to build a robot and use the stepper motor for the movement but your tutorial show the stepper driver still connected to a power supply, which is impossible for a robot. How can I bypass this problem?

    • @rdagger
      @rdagger  Před 6 lety

      A 12V battery should work similarly to a 12V bench power supply assuming the battery can provide the necessary current. Please note that stepper motors draw power continuously regardless of motion which may not be optimal for a battery powered application.

  • @mohameddrissi1075
    @mohameddrissi1075 Před 2 lety

    hey there , thank you for the tutorial , i have a problem in generate wave when i pass in steps a number bigger than 65535 (which indicates 16 bit) i get this error :
    "" ext.extend(x)
    ValueError: byte must be in range(0, 256)""
    is there a solution ?

    • @rdagger
      @rdagger  Před 2 lety +1

      I assume you are referring to the generate_ramp method. The list items (frequency/steps) are limited to 16-bit values but you can always add additional list items at the same frequency if you need more steps. Joan (creator of the pigpio library) wrote the original method. She might be able to recommend alternative approaches.

  • @Duriel1000
    @Duriel1000 Před 4 lety

    Is there anyway to code to get the stepper motor back to a "starting" point? Meaning, like a watch with arms, after runnning many different directions, is there a way to get the stepper motor back to 12 O'clock?

    • @rdagger
      @rdagger  Před 4 lety

      You could keep count of the number of steps or if you concerned about lost steps you could use a closed-loop stepper motor. Another simple option is to use a limit switch such as on a 3D printer.

  • @ozr2222
    @ozr2222 Před 3 lety

    hey my stepper motor only turns up to a certain speed, and decreasing the sleep delay further does not give me more rpm. can anybody explain?

  • @RixtronixLAB
    @RixtronixLAB Před 2 lety +1

    Nice info, thanks :)

  • @amiaynarayan516
    @amiaynarayan516 Před 5 lety

    I am using nema 17 and the torque reduced substantially compared to when I ran the stepper with 12V with arduino uno.... any help is appreciated

  • @KAFA2020
    @KAFA2020 Před 6 lety

    Dear respected sir, I'm very happy for your awesome video. I trying to control my CNC machine by Raspberry pi where I need to use 3 stepper motor. Please could you help me?

    • @rdagger
      @rdagger  Před 6 lety

      I don't have any experience using a Pi for CNC. I use Mach3 with a dedicated controller board for my CNC machine which uses Geckos. There are numerous examples of using the Pi for CNC such as:
      blog.protoneer.co.nz/raspberry-pi-cnc-board-hat
      github.com/Nikolay-Kha/PyCNC
      hackerspacepardubice.cz/cnc/

    • @KAFA2020
      @KAFA2020 Před 6 lety

      Thanks a lot for your information.
      You know arduino is much slower than Raspberry pi. Therefore, If I use Raspberry pi instead of arduino, Will it be much faster?

    • @rdagger
      @rdagger  Před 6 lety

      I don’t know. Perhaps it’s an ambiguous comparison because many solutions off-load the processing to external hardware. For example, the Protoneer Pi CNC hat uses an embedded Arduino for its micro-controller. Again, I haven’t done any CNC with the Pi.

  • @Ma_X64
    @Ma_X64 Před rokem

    You should know that electrolytic capacitors doesn't provide reliable protection against HF spikes and oscillations because of their parasitic inductance due to design nuances. So the right way is to use a low capacitance (about 100nF) ceramic or film capacitors in parallel to electrolytic and as near as possible to device itself.

    • @rdagger
      @rdagger  Před rokem

      The driver breakout board already provides low-ESR ceramic bypass capacitors. Both Pololu and the DRV8255 datasheet recommend adding an electrolytic bulk capacitor as shown in the video.

    • @Ma_X64
      @Ma_X64 Před rokem

      @@rdagger Okay then.

    • @tischregal9678
      @tischregal9678 Před rokem

      @@rdagger this is probably a silly question but would be a 16v 220µF Capacitor be enough, if I use a 9V alkaline battery as the source :P?

    • @rdagger
      @rdagger  Před rokem

      @@tischregal9678 A higher voltage cap would afford more protection against LC spikes. Pololu recommends a minimum of 50 V and minimum of 47 μF.

    • @tischregal9678
      @tischregal9678 Před rokem

      @@rdagger sry I'm a noob at this, but if I'm using a 9V battery as the source I would still need at least a 50v 47 ųF capacitor, correct?

  • @sridharg6618
    @sridharg6618 Před 5 lety

    Great video with clear explanation.
    I have one question. If we are going to create 3d printer setup can we use any six GPIO pins for step and direction(2 pins for each driver)..

    • @rdagger
      @rdagger  Před 5 lety +1

      Yes.

    • @sridharg6618
      @sridharg6618 Před 5 lety

      @@rdagger Hello sir, I Will try with the code which you shared for single motor. If i need to run 3 motors with 3d printer setup, do we have any reference code available. Appreciate your great help on this:)

    • @rdagger
      @rdagger  Před 5 lety

      I haven't tried it, but I think you should take a look at PyCNC. Otherwise it would be difficult to achieve the precise timing required for 3d printing. github.com/Nikolay-Kha/PyCNC

    • @sridharg6618
      @sridharg6618 Před 5 lety

      @@rdagger thank you. Will take a look

  • @ownage3523
    @ownage3523 Před rokem

    Hey great video! Would you have any advice on using the TB67S128FTG instead of the DRV8825? I love the wiring diagram you show with the RPi, motor driver, and stepper motor. However, I can't find a similar one for the TB67S128FTG.

    • @rdagger
      @rdagger  Před rokem

      Haven't used it but Pololu has some resources: www.pololu.com/product/2998/resources

  • @dadasstobadass4536
    @dadasstobadass4536 Před 7 lety +1

    We are looking to control two steppers with a raspberry pi and have them open and close doors on a building. Is it possible to use a single dial of some sort to control the opening and closing of the doors. As a matter of fact, the doors only have to open and close about 15-20 degrees . So, we want to be able to turn the dial and move both steppers (one to the right and one to the left) at the same time. Can this be done with raspberry pi?
    Can this be done by incorporating an arduino with the pi? We really need to use the pi

    • @rdagger
      @rdagger  Před 7 lety

      Yes, it could be done. The Raspberry Pi doesn’t have an analog input so you would need an analog to digital converter to connect the pot. I have a video on connecting ADC’s: czcams.com/video/wJgyszOSoQU/video.html
      Potentiometers often have jitter so you would need code to smooth out the rotation and prevent unwanted movement.
      Depending on the size and weight of the door, you might need an industrial stepper motor, driver and power supply. I don't think the 2A driver used in the video would work. There are more pitfalls as you scale up and you could be dealing with potentially dangerous voltages. I would use end-stops to limit the range of motion. I would also add sensors to detect if something or someone is blocking the path of the door. You could also go with a closed-loop system to accurately track the position of the door.
      Please check your local building and fire codes to ensure you comply with all safety ordinances.

  • @taylorhoward3624
    @taylorhoward3624 Před 6 lety

    I found this video to be incredibly helpful. I'm currently working on a project that requires me to drive 5 NEMA​ 17 motors. I was wondering if I would be able to use 5 of these drivers for this task. If so, would I just need to wire each driver to its own pin and then connect them all to the same 3.3 v and ground pins on the pi? Thanks for the help.

    • @rdagger
      @rdagger  Před 6 lety

      Yes in theory you should be able to control multiple stepper drivers depending on your timing requirements. At least 1 pin would be required per driver (2 if direction required.)

  • @michaelquinn1926
    @michaelquinn1926 Před 4 lety

    I try to use a4988 driver with expansion shield.. and this code is not working.. the motor is vibrating and it's even working without running the code

    • @rdagger
      @rdagger  Před 4 lety

      The A4988 uses a different Vref formula than the DRV8825 and is dependent on the value of the Rcs resistor which varies by board. Please check with the vendor of your driver board to ensure you are setting the current limit correctly. Also please make sure you don’t exceed the motor’s rated current per phase.

  • @Q24H
    @Q24H Před 7 lety +2

    Great tutorial, was just planning on playing with some stepper motors! For the current limiting calibration, if I'm using a 12V 0.4A Nema, I should set the Vref to 0.2v?

    • @rdagger
      @rdagger  Před 7 lety +3

      Yes, the maximum Vref would be 0.2V because Current Limit = Vref × 2
      Actually, if you are only running in *full step* mode the maximum Vref would be about 0.28V because there is an additional 71% limit.
      It's always a good idea to monitor the motor and driver temperature. I like to use a 5 second rule. If I can touch the motor and driver for at least 5 seconds without burning my fingers then the current is probably OK. Please note that the current can also be limited by the coil resistance. If your coil resistance is greater than 30 ohms then your current won't exceed 0.4A at 12V because of Ohm's law.

    • @Chevo210
      @Chevo210 Před 6 lety

      Thank you this fixed my problem!

  • @remcovanwoerkom2016
    @remcovanwoerkom2016 Před 5 lety +1

    very clear, thank you

  • @traceyparker7772
    @traceyparker7772 Před 5 lety

    Very informative video. I hope you keep it up.

  • @tischregal9678
    @tischregal9678 Před rokem

    I'm trying it with a 9V battery but I can't get it to move sadly

  • @MrSirPain
    @MrSirPain Před 2 lety

    OK, what is going on or did I do something wrong? I can not set the Vref because it is unstable. It jumps from .2 to over 2 volts!!! Yes, I know the Vref pot is very sensitive and a very tiny turn could cause a big voltage change. The motor I am using has 1.5A per coil. That means the Vref should be 750mV. I want to lower this down by 90% so I need Vref to be 675mV. Not only I have triple-check and had a friend also check my hookup, it is all correct. Please help 😀

    • @rdagger
      @rdagger  Před 2 lety

      My first guess would be wiring but you said you triple checked. It could be a bad pot on the board. I’d check all the solder connections on the board under strong magnification. I’d post your question to the Pololu forum because you may have received a defective board.

    • @MrSirPain
      @MrSirPain Před 2 lety

      Yes, I have been in contact with Pololu. The problem there is their driver is sold out so I bought it on eBay. I have one on back order so it's a waiting game. It might be that my screwdriver is not fitting the pot correctly, so I am wondering does anyone have a link to recommended one that will fit the pot better. Also, I am wondering do I need to connect to PI? Right now I do not have it connected to the Raspberry PI.

  • @marktumwesigye5262
    @marktumwesigye5262 Před 7 lety

    Great tutorial. I followed it to the dot. Unfortunately, I have failed to get my motor running. I am using a NEMA 17 motor with a rated current of 1.2A per phase, after some troubleshooting, I measured the GPIO output signal and it was 1.6V for the STEP pin, the DIR pin gives 3.3V. Im not sure if this could be the problem. If you have any pointers please help.

    • @rdagger
      @rdagger  Před 7 lety

      The voltages on the DIR and STEP pins are not the issue. The DIR pin would only change the direction of the motor. The STEP pin is being pulsed so a meter is not going to give you any meaningful numbers (you would need a scope to look at the waveform). As long as the pulses are not too fast, you should get movement. Did you set the current limit on the driver to 1.2A (a value of .6V on the Vref)? Is your motor power supply adequate? It's always possible that you got a bad DRV8825. Is the motor or the driver getting hot?

  • @HillWillE
    @HillWillE Před 6 lety

    You are a genius. you should be woking for space x

  • @michaelrenzetti3991
    @michaelrenzetti3991 Před 4 lety

    This might be a silly comment, but is it possible to use than one/two stepper motors(s)? I would like to potentially use 6, but I am not sure all that is possible on a raspberry pi and I might have to use a teensy or something?

    • @rdagger
      @rdagger  Před 4 lety

      The short answer is yes, but it depends on the type of precision and timing you need. For example CNC or 3D printing would probably not work without additional hardware. For 6 motors, it would probably be easier to use a separate board with a dedicated PWM driver chip. I haven’t tried it, but Adafruit makes a stackable hat that supports up to 64 stepper motors (2 steppers per board). Pololu’s Tic series also looks great.

  • @vincentma6792
    @vincentma6792 Před 11 měsíci

    What type of wires are you using for the connection? male to male or male to female?

    • @rdagger
      @rdagger  Před 11 měsíci

      Dupont jumper wires 24 AWG.

  • @shanedoherty6598
    @shanedoherty6598 Před 3 lety

    Why do you use 12V? I'm new to Raspberry Pi and stepper motor and couldn't find anything on why you used that voltage specifically

    • @rdagger
      @rdagger  Před 3 lety +1

      You should use the stepper motor datasheet to select the correct motor voltage. The DRV8825 supports voltages between 8.2 V and 45 V. It’s more important to set Vref correctly. The DRV8825 throttles current to the motor by pulsing the supply on and off very quickly. This decreases the input voltage. Generally speaking high voltages will allow the current to ramp up quicker which is better for quick step rates. However, lower voltages will allow you to maintain more precise lower level current required for microstepping.

    • @shanedoherty6598
      @shanedoherty6598 Před 3 lety

      @@rdagger Ah I see now, was getting overwhelmed with learning yesterday. Makes sense after giving it some time to sink in. Thanks!

  • @DoubleminecraftxX
    @DoubleminecraftxX Před 4 lety

    The M0, M1, and M2 pins of the driver only need to be connected if you want to use step modes other than full correct? I'm connecting many stepper motors to my microcontroller and for my application and am not going to have enough pins for my purpose. If I do not need the different modes, can I just leave be?

    • @rdagger
      @rdagger  Před 4 lety +1

      Yes, you can leave them disconnected for the default full step mode.

    • @DoubleminecraftxX
      @DoubleminecraftxX Před 4 lety

      @@rdagger Okay thank you for the quick reply

    • @DoubleminecraftxX
      @DoubleminecraftxX Před 4 lety

      @@rdagger My DRV8825 driver doesnt have a Vref via like you mentioned on yours. Any idea how I might be able to supplement this?

    • @rdagger
      @rdagger  Před 4 lety

      I don't know what board you have but you should be able to measure Vref on the metal screw of the pot.