Тёмный

Raspberry Pi Stepper Motor Tutorial 

rdagger68
Подписаться 24 тыс.
Просмотров 492 тыс.
50% 1

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...

Опубликовано:

 

8 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 399   
@boatalarm5920
@boatalarm5920 4 года назад
OMG... This guy KNOWS HOW TO MAKE A GREAT TUTORIAL! Fast, concise and NO music!!! FIVE STARS!!!!!
@VincentFischer
@VincentFischer 3 года назад
Who doesn't like some loud energetic dubstep when you try to memorize stuff
@codingwithbarnes2619
@codingwithbarnes2619 3 года назад
Yag
@jozefsoucik3115
@jozefsoucik3115 6 дней назад
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 7 лет назад
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 6 лет назад
This is far and away the best tutorial on this! Thank you so much for being so clear and concise.
@furman87
@furman87 6 лет назад
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 5 лет назад
May be, but I can not understand the language of this video. For me it is therefore useless.
@bobluby2962
@bobluby2962 3 года назад
Thk u
@almostcool9216
@almostcool9216 3 года назад
I also agree A+++ on raspberry code explain and wiring info
@akshayd211
@akshayd211 5 лет назад
I am 100% sure that this is the best video tutorial on this topic in the WORLD.
@pranavsreedhar1402
@pranavsreedhar1402 3 года назад
This is so informative that it should reach every stepper motor enthusiast out there....
@JimEckhardt
@JimEckhardt Год назад
Best stepper vid I've come across yet! So many useful little nuggets in there.
@FabricioRWitt
@FabricioRWitt 8 месяцев назад
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!
@tomd7841
@tomd7841 3 года назад
One of the clearest tutorials I've ever seen. Great work. Thanks very much!
@johnrobie9694
@johnrobie9694 4 года назад
A lot of clever little tricks sprinkled throughout this video. Thanks!
@y2ksw1
@y2ksw1 3 года назад
This is the best tutorial I have ever seen!
@sandro-nd6ir
@sandro-nd6ir 2 года назад
This is simply one of the best tutorials I have ever seen. Thank you so much :)
@chop661
@chop661 4 года назад
Perfect explanation, concise, to the point and well presented. Thank you!
@graceyee9067
@graceyee9067 3 года назад
Wow, this is the most concise and informative tutorial I've ever watched, thank you for taking the time to make it!
@aaronacj
@aaronacj 5 лет назад
Why can't every tutorial video be this good?
@eajinarc4425
@eajinarc4425 4 года назад
After watching this video... Me: "OK, I got it, let's try it" My Raspberry Pi: "No, you didn't"
@gizehtriana9569
@gizehtriana9569 4 года назад
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 3 года назад
For real cuz . exactly how I feel Xd
@dannyarroway4187
@dannyarroway4187 2 года назад
Excellent tutorial! Clear and concise! bravo!
@aaronjs99
@aaronjs99 6 лет назад
Hey... Gotta say that this video was worth watching!!!
@ThomasAndersonbsf
@ThomasAndersonbsf 6 лет назад
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.
@kylevasulka8568
@kylevasulka8568 Год назад
Wow. Such a clear explanation 👏 excellent job!
@arbjful
@arbjful Год назад
Nanotec makes some really great stepper motors and drivers, we use these a lot for our industrial applications
@georgkettele6911
@georgkettele6911 2 года назад
Best tutorial ever!
@QuarrySteam
@QuarrySteam 3 года назад
Brilliant tutorial, to the point and no waffling. Really useful thanks very much
@ghost2coast296
@ghost2coast296 5 лет назад
thank you! I really like how you took the time to walk through all the code and explain it to us
@vladimirpotapov7050
@vladimirpotapov7050 2 года назад
Nice tutorial, thank you a lot !
@drm42
@drm42 6 лет назад
Awesome tutorial with a great amount of details shared. Thank you!
@newideas3249
@newideas3249 Год назад
EXcellent video, just what I needed 😄
@balajitj
@balajitj 6 лет назад
Excellent tutorial, explanations are just crisp and clear.
@claudiusbambeck
@claudiusbambeck Год назад
This helped me a lot! Thank you
@tomrouillard3908
@tomrouillard3908 6 лет назад
Excellent job - hugely informative and useful. Thank you.
@subodhawanasundera3957
@subodhawanasundera3957 6 лет назад
Great tutorial, very clear explanations. Easy to understand & well structured. Thanks heaps!
@heyisforhumans
@heyisforhumans Год назад
Excellent video!
@KingGrio
@KingGrio Год назад
This is an awesome tutorial
@blackmennewstyle
@blackmennewstyle 4 года назад
By far one of the best tutorial about the Raspberry Pi and Stepper motor i have seen
@jashan9845
@jashan9845 Год назад
This was super helpful!! Thank you
@zosxavius
@zosxavius 7 лет назад
This was exactly what I needed to see. Thank you so very much!
@parameciumcheese
@parameciumcheese 6 лет назад
Fantastic video! Thanks for taking the time to make this. Answered all my questions and more.
@stephmo371
@stephmo371 3 года назад
This has been so helpful. Thank you for this
@mo_adventures
@mo_adventures 5 лет назад
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 5 лет назад
me too! I'm really good at blinking a lot
@DenfordBerriman
@DenfordBerriman 7 лет назад
Great tip using the LED to figure out the pairs. I had headers wired the wrong way till I tried this. Thanks.
@TheHoinoel
@TheHoinoel 3 года назад
Wow this is really dense. Great tutorial, thank you :)
@magna59
@magna59 6 лет назад
Great work & nice to see something without having to listen through background music .
@johnerickson6765
@johnerickson6765 5 лет назад
Excellent tutorial. Would also like to see one with C++ control.
@rongrongwu
@rongrongwu 3 года назад
Very good video, very helpful! Thanks you.
@aboudezoa
@aboudezoa 2 года назад
Very well explained
@maiodab670
@maiodab670 6 месяцев назад
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 6 месяцев назад
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 6 месяцев назад
@@rdagger Thanks a lot, I have solved my problem .
@PhG1961
@PhG1961 2 года назад
Great video !!
@allaryyan6608
@allaryyan6608 6 лет назад
thank you for this tutorial! your effort is deeply appreciated.
@Daniel.DAgostino
@Daniel.DAgostino 3 года назад
Wonderful video. Engaging and informative.
@Lortagreb
@Lortagreb 3 года назад
IT WORKS thank you.
@venkateshyadla9503
@venkateshyadla9503 5 лет назад
THAnk you boss... thanks for deep explanantion..
@anactualmechanic2058
@anactualmechanic2058 6 лет назад
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!
@robsciuk729
@robsciuk729 6 лет назад
Timely, succinct and complete ... *THANKS*
@boredbritgamercouk
@boredbritgamercouk 4 года назад
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 :)
@angelplack76
@angelplack76 3 года назад
Hi guy thanks for your explain is vero complete congratulations
@RixtronixLAB
@RixtronixLAB 2 года назад
Nice info, thanks :)
@AliSaldin
@AliSaldin 7 лет назад
every time you upload amazing video thank you for your affairs
@michaelmckiernan4061
@michaelmckiernan4061 6 лет назад
Very Good.You have solved many questions. The BIG AH HUrH. THANK YOU.
@remcovanwoerkom2016
@remcovanwoerkom2016 5 лет назад
very clear, thank you
@kentharris7427
@kentharris7427 2 года назад
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.
@BLau-oi4zc
@BLau-oi4zc 4 года назад
It worked! Thank you very much!!
@gregpetryk1696
@gregpetryk1696 Год назад
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.
@traceyparker7772
@traceyparker7772 5 лет назад
Very informative video. I hope you keep it up.
@pgtips4240
@pgtips4240 2 года назад
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.
@herantd
@herantd 3 года назад
If you have A4988 it needs to be wired a bit differently
@georgejbaker
@georgejbaker 6 лет назад
Amazing video, very informative
@larbigueraiche6721
@larbigueraiche6721 5 лет назад
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 5 лет назад
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.
@AeroLens_by_SP
@AeroLens_by_SP 3 года назад
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
@ColeLashley
@ColeLashley 3 года назад
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 3 года назад
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
@waaniesimon758
@waaniesimon758 4 года назад
Brilliant. very informative
@brighambaker3381
@brighambaker3381 5 лет назад
Awesome video! Thank you!!
@ronpearson1912
@ronpearson1912 4 месяца назад
I wonder if its possible to integrate PID control in this as well
@Migueldeservantes
@Migueldeservantes 3 года назад
can I setup a set of If then commands to follow up with an small toy machine?? like an small excavator???
@sphereintelligence
@sphereintelligence 4 года назад
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.
@davidcross3075
@davidcross3075 5 лет назад
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 5 лет назад
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 5 лет назад
@@rdagger thanks for the head start... i'll be giving this a try soon.
@djtyros
@djtyros 2 года назад
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 :)
@NothingMuchhere2see
@NothingMuchhere2see 3 года назад
can you make a video on how to control a motor using serial communication with modbus rtu rs485 usb converter and python
@asefron8159
@asefron8159 2 года назад
Hey, in the last code even the loop is infinite my step motor stop after accelerated a few seconds later.
@mostafasohrabi5634
@mostafasohrabi5634 2 года назад
exellent
@HillWillE
@HillWillE 6 лет назад
You are a genius. you should be woking for space x
@Bidouillerfr
@Bidouillerfr 3 года назад
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 ?
@rajwaghmare8547
@rajwaghmare8547 5 лет назад
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
@VinayKumar-kv4yu
@VinayKumar-kv4yu 6 лет назад
excellent tutorial..
@Crooks103
@Crooks103 6 лет назад
Great explanation
@parleckius
@parleckius 7 лет назад
Liked, subscribed and favorited! This is awsome!
@KangJangkrik
@KangJangkrik 2 года назад
Is it a good idea to connect STEP pin to hardware PWM pin on RPi? Thanks!
@cscnacht9292
@cscnacht9292 5 лет назад
Sir, please make a video that control stepper motor using LCD touch screens.
@philiplubduck6107
@philiplubduck6107 4 года назад
did you ever find a way to use the touch screen for stepper motors? I want to do the same but with up and down arrow to lower and raise rpm rate and maybe another set of arrows with time setting then a simple play/stop button to start and stop the program
@ozr2222
@ozr2222 3 года назад
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?
@icecreamtruckog3667
@icecreamtruckog3667 5 лет назад
Nice job.
@barirwin8559
@barirwin8559 5 лет назад
top class knowledge
@tischregal9678
@tischregal9678 Год назад
I'm trying it with a 9V battery but I can't get it to move sadly
@MrZhefish
@MrZhefish 4 года назад
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.
@amiaynarayan516
@amiaynarayan516 5 лет назад
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
@1Sweet__
@1Sweet__ 6 лет назад
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 6 лет назад
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.
@sridharg6618
@sridharg6618 5 лет назад
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 5 лет назад
Yes.
@sridharg6618
@sridharg6618 5 лет назад
@@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 5 лет назад
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 5 лет назад
@@rdagger thank you. Will take a look
@dadasstobadass4536
@dadasstobadass4536 7 лет назад
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 7 лет назад
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: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-wJgyszOSoQU.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.
@abpccpba
@abpccpba 7 лет назад
Excellent Thank You
@Ma_X64
@Ma_X64 Год назад
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 Год назад
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 Год назад
@@rdagger Okay then.
@tischregal9678
@tischregal9678 Год назад
@@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 Год назад
@@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 Год назад
@@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?
@mehmetberberci3575
@mehmetberberci3575 4 года назад
thank you
@grahamb007
@grahamb007 2 года назад
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 2 года назад
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.
Далее
Raspberry Pi Motor Control & RPM Measurement Tutorial
18:43
Stepper Motor Control with the Raspberry Pi
9:40
Просмотров 254 тыс.
POV: Your kids ask to play the claw machine
00:20
Просмотров 9 млн
Мама знает где все документы
00:21
What Makes TMC2208 Stepper Motor Drivers Silent?
9:07
Просмотров 300 тыс.
How Stepper Motors Work - Electric motor
14:01
Просмотров 1 млн
Big Stepper Motors with Arduino
29:43
Просмотров 1,2 млн
Controlling Large Stepper Motor With Raspberry Pi
38:39
Raspberry Pi Servo Motor Control
17:36
Просмотров 388 тыс.
Raspberry Pi CNC Controller
15:34
Просмотров 106 тыс.
Raspberry Pi Pico Stepper Motors via PIO
25:17
Просмотров 60 тыс.
Driving DC Motors with Microcontrollers
1:04:32
Просмотров 647 тыс.
POV: Your kids ask to play the claw machine
00:20
Просмотров 9 млн