Learn how to use stepper motors with the Arduino.
Full Article with Code at https://dbot.ws/stepper
Today we will be working with stepper motors, a versatile yet often misunderstood electromechanical component used in a variety of devices.
After examining how stepper motors work and what the difference is between a “Bipolar” and “Unipolar” stepper is I will show you how three methods of controlling a stepper motor with an Arduino:
1 - A common 28YBJ-48 Unipolar Stepper with a ULN2003 driver board. These inexpensive stepper and driver combinations are very common and are available on eBay, Amazon, and probably in your local electronics store. I’ll show you two different ways to use these with two different Arduino libraries.
2 - A NEMA 17 Bipolar stepper motor with an L298N dual H-Bridge driver board. We’ve used the L298N driver board in another video to control a pair of brushed DC motors but it also makes a good driver for a bipolar stepper motor.
3 - The same NEMA 17 Bipolar stepper motor controlled by an A4988 stepper driver. This common driver board is used in many 3D printers and CNC machines and simplifies the control of one or several stepper motors with an Arduino.
I’ll also discuss concepts like microstepping and I will show you how to understand some of the many parameters that are included on stepper motor specification sheets.
If you’d like to jump ahead to a particular section in the video here is the table of contents:
00:00 - Introduction
01:34 - Stepper Motor Theory
04:21 - Bipolar vs Unipolar Steppers
08:18 - Common Stepper Specifications
11:32 - NEMA motor sizes
13:41 - 28YBJ-48 Unipolar Stepper with ULN2003
28:16 - NEMA 17 Bipolar with L298N
36:41 - NEMA 17 Bipolar with A4988
As always you can get all of the code I use in this video by visiting the DroneBot Workshop website and looking at the article at https://dbot.ws/stepper. You’ll find code listings and hookup diagrams and well as a convenient ZIP file containing all of the Arduino sketches.
Hopefully, this video will inspire you to start using stepper motors in your own designs.
Now let's get stepping!
"Never trust a computer you can’t throw out a window." — Steve Wozniak
Hi every one,
I am not very good at using a forum. My question is how can I add a reverse switch to this sketch. Also how would I know if some one have replied and where can I see the response.
Thanks every one
As usual... another excellent lecture. One thing though, the professor didn't notice my raised hand. 🖐️ 😉
I'm starting my background understanding research for my project and have two three five(ok...) eight questions. They reproduce if I have too much time on my hands.
- (38:20) About the 100 μF capacitor. Is this used because of the A4988 specifically, or drivers in general, or something else in general?
- Can someone explain its purpose in air-head* terms?
- I'm going to be using TMC2209 Trinamic drivers. Do I need to use the capacitor?
- And if all drivers need it, why don't they just put it on the boards?
- If I use the Serial interface instead of the pulse method, does that make a difference?
- (46:30) About tuning the A4988 for maximum current capability of the stepper motor. BTW - When I needed to tune a couple of A4988's in the past, all I found were the voltage-calculate-trust method videos. This was a breath of fresh air that makes far more intuitive sense to me.
- I understand that the TMC2209 can adjust this maximum current setting via coding and the Serial interface. I also am lead to believe that I can get the current (time) value of the current (I=V/r) via coding and the Serial interface. Can I punt using the volt meter and do a set/read loop and calibrate it via the Sketch?
- Will the TMC2209 driver keep this setting non-volatile? Or... do I need to either store this setting OR perform the calibration on Sketch boot?
I think... that will cover the Inquisition... for now.
* derogatory term used on college engineering campus to identify Aerospace Engineers. I'm better now, my hair turned grey.
3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, WiFi Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266...
Even usable on ESP-01S - Quickest Start Guide
@azflyer Subscribe will get you an email notification
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.
As usual... another excellent lecture. One thing though, the professor didn't notice my raised hand. 🖐️ 😉
I'm starting my background understanding research for my project and have
twothreefive(ok...) eight questions. They reproduce if I have too much time on my hands.
If you take off your wrist watch you won't have time on your hands and more 🙂
- (38:20) About the 100 μF capacitor. Is this used because of the A4988 specifically, or drivers in general, or something else in general?
c) something in general
- Can someone explain its purpose in air-head* terms?
I'll try. Its purpose is to store some charge locally so that if whatever is driving the driver gets busy and voltage drops, the capacitor becomes a local supply to stabilize the power and keep the driver going.
- I'm going to be using TMC2209 Trinamic drivers. Do I need to use the capacitor?
It's safer to use one, but it depends on your circuit(s).
- And if all drivers need it, why don't they just put it on the boards?
Because the manufacturers have cut back on crystal balls for economic reasons. They don't know how likely it is that your project will be overloaded or stressed to the point where a capacitor is required, nor to the extent possible. So they leave that to you. Besides it'd cost them another $.02 to add it in 🙂
Sorry, I don't know anything about TMC2209s so I can't answer the rest of the questions you've posed.
I think... that will cover the Inquisition... for now.
I have to confess that I wasn't expecting the Spanish Inquisition 🙂 🙂
Anything seems possible when you don't know what you're talking about.
@will You were expecting some other inquisition?
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.
Nobody expects the Spanish Inquisition (It's from old Monty Python shows 🙂
Anything seems possible when you don't know what you're talking about.
@will Yes, another reminder of how slow and old my brain is getting. BIG fan, have most of their DVD's if not all. Also have Faulty Towers, and at one time had a towel and room key.
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.
3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, WiFi Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266...
Even usable on ESP-01S - Quickest Start Guide
This video is fanstastic, and so well put together. Thank you. IN the video there is a demonstration on ULN2003 and having two steppers perform rotations at different speeds and in different directions. I would like to perform the same with 2 NEMA 17's and A4988's. Any resources for something like this?
The following link will hopefully complement the dronebot video and it does show the A4988.
https://howtomechatronics.com/tutorials/arduino/stepper-motors-and-arduino-the-ultimate-guide/
The following link will hopefully complement the dronebot video and it does show the A4988.
https://howtomechatronics.com/tutorials/arduino/stepper-motors-and-arduino-the-ultimate-guide/
I noticed it had a TMC driver mentioned, but didn't go into any details.
3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, WiFi Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266...
Even usable on ESP-01S - Quickest Start Guide
I noticed it had a TMC driver mentioned, but didn't go into any details.
You didn't keep your finger on the scroll down bar long enough then 😎 The last part of the article shows using the TMC2208 driver. He also comments its a better driver than the other 2 but this comes with a bigger price tag.
I noticed it had a TMC driver mentioned, but didn't go into any details.
You didn't keep your finger on the scroll down bar long enough then 😎 The last part of the article shows using the TMC2208 driver. He also comments its a better driver than the other 2 but this comes with a bigger price tag.
I agree it is a good companion article to Bill's video with some good details on the fundamentals. I failed to be specific 😉. I was looking for using ESP/Arduino with the Serial communications interface and even more specifically, I want to be able to get the feedback...
StallGuard, CoolStep
3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, WiFi Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266...
Even usable on ESP-01S - Quickest Start Guide