How To Control A Stepper Motor With Arduino Motor Shield Rev3
How To Control A Stepper Motor With Arduino Motor Shield Rev3
Makerguides.com
In this tutorial, you will learn how to control a stepper motor with the Arduino Motor
Shield Rev3 (https://www.amazon.com/Arduino-A000079-Motor-Shield-
12V/dp/B0084ZQF3O/ref=as_li_ss_tl?
dchild=1&keywords=arduino+motor+shield+rev3&qid=1591346314&sr=8-
https://www.makerguides.com/arduino-motor-shield-stepper-motor-tutorial/ 1/33
3/28/2021 Stepper with Arduino Motor Shield Rev3 Tutorial (4 Examples)
3&linkCode=ll1&tag=makerguides-
20&linkId=ecf158a90f472cf1aff6ffd372c9da84&language=en_US). I have included a
wiring diagram and many example codes.
First we take a look at an example that uses the Arduino Stepper library. This library is
great for basic stepper motor control but doesn’t have many extra features.
I highly recommend to also take a look at the example codes for the AccelStepper
library at the end of this tutorial. This library is fairly easy to use and can greatly improve
the performance of your hardware.
After each example, I break down the code into smaller section and explain how it works.
You should have no problems modifying the code to suit your needs, but if you have any
questions, just leave a comment below.
If you want to learn more about other (microstepping) drivers like the A4988
(https://amzn.to/2ZGp074), check out the articles below.
Supplies
Hardware components
https://www.makerguides.com/arduino-motor-shield-stepper-motor-tutorial/ 2/33
3/28/2021 Stepper with Arduino Motor Shield Rev3 Tutorial (4 Examples)
dchild=1&keywords=arduino+motor+shield+rev3&qid=159
(https://amzn.to/31alM8w)
3&linkCode=ll1&tag=makerguides-
20&linkId=ecf158a90f472cf1aff6ffd372c9da84&language=
In this tutorial I used a bipolar stepper motor with 4 wires. Try to nd a stepper motor
that can run at 5-12 V and doesn’t exceed the 2 A current limit. This one
(https://amzn.to/2A3tF3L) from Adafruit works great at 12 V and doesn’t draw too much
current (350 mA).
Software
https://www.makerguides.com/arduino-motor-shield-stepper-motor-tutorial/ 3/33
3/28/2021 Stepper with Arduino Motor Shield Rev3 Tutorial (4 Examples)
Makerguides.com is a participant in the Amazon Services LLC Associates Program, an af liate advertising program
designed to provide a means for sites to earn advertising fees by advertising and linking to products on
Amazon.com.
One thing that is very important to remember is that the L298 is a constant voltage
driver. This means that the current draw depends on the relationship between the
inductance and resistance (L/R) of the motor that you connect to it.
What this means for you, is that you need to be careful when selecting the stepper motor
and power supply to use with this shield. Not all stepper motors will work! The shield’s
operating voltage is between 5 and 12 volts. Since the shield can supply a maximum of 2
amperes per channel, you need to nd a stepper motor that can be used in this voltage
range and doesn’t exceed the maximum current rating. The motor I used for this tutorial
draws around 1A at 5V. I also found this stepper motor from Adafruit that works great at
12V (https://amzn.to/31bbsxa) and only draws 350mA.
If the motor you want to drive doesn’t work with this shield, I recommend using a
chopper drive instead. I wrote tutorials for the A4988
(https://www.makerguides.com/a4988-stepper-motor-driver-arduino-
https://www.makerguides.com/arduino-motor-shield-stepper-motor-tutorial/ 4/33
3/28/2021 Stepper with Arduino Motor Shield Rev3 Tutorial (4 Examples)
tutorial/) and DRV8825 (https://www.makerguides.com/drv8825-stepper-motor-driver-
arduino-tutorial/) driver that work great with many stepper motors.
Operating voltage 5 V to 12 V
motor
power supply)
(https://www.amazon.com/Arduino-
A000079-Motor-Shield-
12V/dp/B0084ZQF3O/ref=as_li_ss_tl?
dchild=1&keywords=arduino+motor+shiel
d+rev3&qid=1591346314&sr=8-
3&linkCode=ll1&tag=makerguides-
20&linkId=ecf158a90f472cf1aff6ffd372c
9da84&language=en_US)
For more information you can check out the datasheets here.
https://www.makerguides.com/arduino-motor-shield-stepper-motor-tutorial/ 5/33
3/28/2021 Stepper with Arduino Motor Shield Rev3 Tutorial (4 Examples)
L298 Datasheet
PWM D3 D11
Brake D9 D8
Current sensing A0 A1
https://www.makerguides.com/arduino-motor-shield-stepper-motor-tutorial/ 6/33
3/28/2021 Stepper with Arduino Motor Shield Rev3 Tutorial (4 Examples)
Wiring diagram for Arduino Motor Shield Rev3 with stepper motor.
Vin 5 – 12 V
https://www.makerguides.com/arduino-motor-shield-stepper-motor-tutorial/ 7/33
3/28/2021 Stepper with Arduino Motor Shield Rev3 Tutorial (4 Examples)
Warning
It is possible to directly power the shield from the Arduino, but this is not recommended.
When the stepper motor draws too much current, you can damage both the shield and
the Arduino. I therefore recommend to use an external power supply for the motors.
To do this you have to cut the Vin Connect jumper on the back of the shield. After doing
this you can power the Arduino separately with a USB cable or via the 5.5 mm DC power
jack.
https://www.makerguides.com/arduino-motor-shield-stepper-motor-tutorial/ 8/33
3/28/2021 Stepper with Arduino Motor Shield Rev3 Tutorial (4 Examples)
If you can not nd the datasheet of your stepper motor, it can be dif cult to gure out
which color wire goes where. I use the following trick to determine how to connect 4 wire
bipolar stepper motors:
The only thing you need to identify is the two pairs of wires which are connected to the
two coils of the motor. The wires from one coil get connected to A- and A+ and the other
to B- and B+, the polarity doesn’t matter.
To nd the two wires from one coil, do the following with the motor disconnected:
1. Try to spin the shaft of the stepper motor by hand and notice how hard it is to turn.
2. Now pick a random pair of wires from the motor and touch the bare ends together.
3. Next, while holding the ends together, try to spin the shaft of the stepper motor
again.
If you feel a lot of resistance, you have found a pair of wires from the same coil. If you can
still spin the shaft freely, try another pair of wires. Now connect the two coils to the pins
shown in the wiring diagram above.
(If it is still unclear, please leave a comment below, more info can also be found on
the RepRap.org wiki (https://reprap.org/wiki/Stepper_wiring))
This example uses the Stepper.h library, which should come pre-installed with the
Arduino IDE. This sketch turns the stepper motor 1 revolution in one direction, pauses,
and then turns 1 revolution in the other direction.
https://www.makerguides.com/arduino-motor-shield-stepper-motor-tutorial/ 9/33
3/28/2021 Stepper with Arduino Motor Shield Rev3 Tutorial (4 Examples)
1. /* Example sketch to control a stepper motor with Arduino Motor Shield Rev3, Arduino UNO
and Stepper.h library. More info: https://www.makerguides.com */
2.
3. // Include the Stepper library:
4. #include <Stepper.h>
5.
6. // Define number of steps per revolution:
7. const int stepsPerRevolution = 200;
8.
9. // Give the motor control pins names:
10. #define pwmA 3
11. #define pwmB 11
12. #define brakeA 9
13. #define brakeB 8
14. #define dirA 12
15. #define dirB 13
16.
17. // Initialize the stepper library on the motor shield:
18. Stepper myStepper = Stepper(stepsPerRevolution, dirA, dirB);
19.
20. void setup() {
21. // Set the PWM and brake pins so that the direction pins can be used to control the
motor:
22. pinMode(pwmA, OUTPUT);
23. pinMode(pwmB, OUTPUT);
24. pinMode(brakeA, OUTPUT);
25. pinMode(brakeB, OUTPUT);
26.
27. digitalWrite(pwmA, HIGH);
28. digitalWrite(pwmB, HIGH);
29. digitalWrite(brakeA, LOW);
30. digitalWrite(brakeB, LOW);
31.
32. // Set the motor speed (RPMs):
33. myStepper.setSpeed(60);
34. }
35.
36.
37. void loop() {
38. // Step one revolution in one direction:
39. myStepper.step(200);
40.
41. delay(2000);
42.
43. //Step on revolution in the other direction:
44. myStepper.step(-200);
45.
46. delay(2000);
47. }
Code explanation:
https://www.makerguides.com/arduino-motor-shield-stepper-motor-tutorial/ 10/33
3/28/2021 Stepper with Arduino Motor Shield Rev3 Tutorial (4 Examples)
The sketch starts by including the Stepper.h Arduino library. More information about this
library can be found on the Arduino website
(https://www.arduino.cc/en/Reference/Stepper).
Next I de ned how many steps the motor takes to rotate 1 revolution. In this example we
will be using the motor in full-step mode. This means it takes 200 steps to rotate 360
degrees. You can change this value if you want if you are using a different type of stepper
motor or setup.
After this, we de ne the motor connections (see speci cations and wiring diagram
above).
The statement #define is used to give a name to a constant value. The compiler will
replace any references to this constant with the de ned value when the program is
compiled. So everywhere you mention pwmA , the compiler will replace it with the value 3
when the program is compiled.
Next, you need to create a new instance of the Stepper class, which represents a
particular stepper motor connected to the Arduino. For this we use the
function Stepper(steps, pin1, pin2) where steps is the number of steps per
revolution and pin1 and pin2 are the pins used to drive the stepper motor. In our case this
are dirA and dirB.
https://www.makerguides.com/arduino-motor-shield-stepper-motor-tutorial/ 11/33
3/28/2021 Stepper with Arduino Motor Shield Rev3 Tutorial (4 Examples)
In this case I called the stepper motor ‘myStepper’ but you can use other names as well,
like ‘z_motor’ or ‘liftmotor’ etc. Stepper liftmotor = Stepper(stepsPerRevolution,
dirA, dirB); .
In the setup, we start by setting the brake and PWM pins as output with the
function pinMode() . The PWM pins need to be set HIGH and the brake pins LOW with
the function digitalWrite() .
1. // Set the PWM and brake pins so that the direction pins can be used to control the
motor:
2. pinMode(pwmA, OUTPUT);
3. pinMode(pwmB, OUTPUT);
4. pinMode(brakeA, OUTPUT);
5. pinMode(brakeB, OUTPUT);
6.
7. digitalWrite(pwmA, HIGH);
8. digitalWrite(pwmB, HIGH);
9. digitalWrite(brakeA, LOW);
10. digitalWrite(brakeB, LOW);
You can set the speed of the motor in rpm with the function setSpeed(rpm) . I set it to
60, so we should see 1 revolution per second.
In the loop section of code, we simply call the step(steps) function which turns the
motor a speci c number of steps at a speed determined by the setSpeed(rpm) function.
Passing a negative number to this function reverses the spinning direction of the motor.
1. void loop() {
2. // Step one revolution in one direction:
3. myStepper.step(200);
4.
5. delay(2000);
6.
7. //Step on revolution in the other direction:
8. myStepper.step(-200);
9.
10. delay(2000);
11. }
Note that the step(steps) function is blocking, this means it will wait until the motor
has nished moving to pass control to the next line in your sketch.
https://www.makerguides.com/arduino-motor-shield-stepper-motor-tutorial/ 12/33
3/28/2021 Stepper with Arduino Motor Shield Rev3 Tutorial (4 Examples)
The AccelStepper library written by Mike McCauley is an awesome library to use for your
project. One of the advantages is that it supports acceleration and deceleration, but it has
a lot of other nice functions too.
AccelStepper-1.59.zip
You can install the library by going to Sketch > Include Library > Add .ZIP Library… in the
Arduino IDE.
Another option is to navigate to Tools > Manage Libraries… or type Ctrl + Shift + I on
Windows. The Library Manager will open and update the list of installed libraries.
https://www.makerguides.com/arduino-motor-shield-stepper-motor-tutorial/ 13/33
3/28/2021 Stepper with Arduino Motor Shield Rev3 Tutorial (4 Examples)
You can search for ‘accelstepper‘ and look for the library by Mike McCauley. Select the
latest version and then click Install.
https://www.makerguides.com/arduino-motor-shield-stepper-motor-tutorial/ 14/33
3/28/2021 Stepper with Arduino Motor Shield Rev3 Tutorial (4 Examples)
The following sketch can be used to run one or more stepper motors continuously at a
constant speed. (No acceleration or deceleration is used).
You can copy the code by clicking on the button in the top right corner of the code eld.
https://www.makerguides.com/arduino-motor-shield-stepper-motor-tutorial/ 15/33
3/28/2021 Stepper with Arduino Motor Shield Rev3 Tutorial (4 Examples)
1. /* Example sketch to control a stepper motor with Arduino Motor Shield Rev3, Arduino UNO
and AccelStepper.h library: continuous rotation. More info: https://www.makerguides.com */
2.
3. // Include the AccelStepper library:
4. #include <AccelStepper.h>
5.
6. // Define number of steps per revolution:
7. const int stepsPerRevolution = 200;
8.
9. // Give the motor control pins names:
10. #define pwmA 3
11. #define pwmB 11
12. #define brakeA 9
13. #define brakeB 8
14. #define dirA 12
15. #define dirB 13
16.
17. // Define the AccelStepper interface type:
18. #define MotorInterfaceType 2
19.
20. // Create a new instance of the AccelStepper class:
21. AccelStepper stepper = AccelStepper(MotorInterfaceType, dirA, dirB);
22.
23. void setup() {
24. // Set the PWM and brake pins so that the direction pins can be used to control the
motor:
25. pinMode(pwmA, OUTPUT);
26. pinMode(pwmB, OUTPUT);
27. pinMode(brakeA, OUTPUT);
28. pinMode(brakeB, OUTPUT);
29.
30. digitalWrite(pwmA, HIGH);
31. digitalWrite(pwmB, HIGH);
32. digitalWrite(brakeA, LOW);
33. digitalWrite(brakeB, LOW);
34.
35. // Set the maximum steps per second:
36. stepper.setMaxSpeed(600);
37. }
38.
39. void loop() {
40. // Set the speed of the motor in steps per second:
41. stepper.setSpeed(500);
42. // Step the motor with constant speed as set by setSpeed():
43. stepper.runSpeed();
44. }
https://www.makerguides.com/arduino-motor-shield-stepper-motor-tutorial/ 16/33
3/28/2021 Stepper with Arduino Motor Shield Rev3 Tutorial (4 Examples)
After specifying the connections like before, we need to de ne the motor interface type
for the AccelStepper library. In this case we will be driving the stepper motor in full step
mode, with two wires, so we set the mode to 2. You can nd the other interface
types here
(https://www.airspayce.com/mikem/arduino/AccelStepper/classAccelStepper.html#a608b
2395b64ac15451d16d0371fe13ce).
Next, you need to create a new instance of the AccelStepper class with the appropriate
motor interface type and connections.
In this case I called the stepper motor ‘stepper’ but you can use other names as well, like
‘z_motor’ or ‘liftmotor’ etc. AccelStepper liftmotor =
AccelStepper(MotorInterfaceType, dirA, dirB); .
The setup section of the code is mostly the same as the previous example, but I also
de ned the maximum speed in steps/second. Speeds of more than 1000 steps per
second can be unreliable, so I set it to 600 (you will have to experiment to see what the
maximum speed is for your setup). Note that I specify the name of the stepper motor
(‘stepper’), for which I want to de ne the maximum speed.
In the loop section, we rst set the speed that we want the motor to run at with the
function setSpeed() . (you can also place this in the setup section of the code).
The function stepper.runSpeed() polls the motor and when a step is due it executes 1
step. This depends on the set speed and the time since the last step. If you want to
change the direction of the motor, you can set a negative
speed: stepper.setSpeed(-400); turns the motor the other way.
https://www.makerguides.com/arduino-motor-shield-stepper-motor-tutorial/ 17/33
3/28/2021 Stepper with Arduino Motor Shield Rev3 Tutorial (4 Examples)
In this case, the stepper motor turns 1 revolution clockwise with 400 steps/sec, then
turns 1 revolution counterclockwise at 200 steps/sec, and lastly turns 3 revolutions
clockwise at 600 steps/sec.
1. /* Example sketch to control a stepper motor with Arduino Motor Shield Rev3, Arduino UNO
and AccelStepper.h library: number of steps or revolutions. More info:
https://www.makerguides.com */
2.
3. // Include the AccelStepper library:
4. #include <AccelStepper.h>
5.
6. // Define number of steps per revolution:
7. const int stepsPerRevolution = 200;
8.
9. // Give the motor control pins names:
10. #define pwmA 3
11. #define pwmB 11
12. #define brakeA 9
13. #define brakeB 8
14. #define dirA 12
15. #define dirB 13
16.
17. // Define the AccelStepper interface type:
18. #define MotorInterfaceType 2
19.
20. // Create a new instance of the AccelStepper class:
21. AccelStepper stepper = AccelStepper(MotorInterfaceType, dirA, dirB);
22.
23. void setup() {
24. // Set the PWM and brake pins so that the direction pins can be used to control the
motor:
25. pinMode(pwmA, OUTPUT);
26. pinMode(pwmB, OUTPUT);
27. pinMode(brakeA, OUTPUT);
28. pinMode(brakeB, OUTPUT);
29.
https://www.makerguides.com/arduino-motor-shield-stepper-motor-tutorial/ 18/33
3/28/2021 Stepper with Arduino Motor Shield Rev3 Tutorial (4 Examples)
Code explanation:
The rst part of the code up to the loop() section is exactly the same as in the previous
example.
https://www.makerguides.com/arduino-motor-shield-stepper-motor-tutorial/ 19/33
3/28/2021 Stepper with Arduino Motor Shield Rev3 Tutorial (4 Examples)
Next we make use of the while loop. A while loop will loop continuously, and in nitely,
until the expression inside the parenthesis, () becomes false. So in this case I check if the
current position of the stepper motor is not equal to 200 steps (!= means: is not equal to).
While this is not the case, we run the stepper motor at a constant speed as set
by setSpeed() .
43. // Run the motor forward at 400 steps/second until the motor reaches 200 steps (1
revolution):
44. while (stepper.currentPosition() != 200) {
45. stepper.setSpeed(400);
46. stepper.runSpeed();
47. }
In the rest of the loop, we do exactly the same, just with a different speed and target
position.
With the following sketch you can add acceleration and deceleration to the movements
of the stepper motor, without any complicated coding. The rst section of this sketch is
the same as in example 1, but the setup and the loop are different.
The motor will run ve revolutions back and forth with a speed of 200 steps per second
and an acceleration of 50 steps/second2.
1. /* Example sketch to control a stepper motor with Arduino Motor Shield Rev3, Arduino UNO
https://www.makerguides.com/arduino-motor-shield-stepper-motor-tutorial/ 20/33
3/28/2021 Stepper with Arduino Motor Shield Rev3 Tutorial (4 Examples)
https://www.makerguides.com/arduino-motor-shield-stepper-motor-tutorial/ 21/33
3/28/2021 Stepper with Arduino Motor Shield Rev3 Tutorial (4 Examples)
55. }
In the loop section of the code, I used a different way to let the motor rotate a prede ned
number of steps. First I set the target position with the function moveTo() . Next, we
simply use the function runToPosition() to let the motor run to the target position with
the set speed and acceleration. The motor will decelerate before reaching the target
position.
Finally, we set the new target position back to the 0, so that we return to the origin.
Conclusion
In this article, I have shown you how you can control a stepper motor with the Arduino
Motor Shield Rev3. We have looked at 4 examples, using both the Stepper and
AccelStepper library. I hope you found it useful and informative. If you did, please share it
with a friend that also likes electronics!
I would love to know what projects you plan on building (or have already built) with this
Arduino Motor Shield. If you have any questions, suggestions, or if you think that things
are missing in this tutorial, please leave a comment down below.
https://www.makerguides.com/arduino-motor-shield-stepper-motor-tutorial/ 22/33
3/28/2021 Stepper with Arduino Motor Shield Rev3 Tutorial (4 Examples)
Beginner
2
SHARES
The complete guide for DS18B20 digital temperature sensors with Arduino
(https://www.makerguides.com/ds18b20-arduino-tutorial/)
Comments
https://www.makerguides.com/arduino-motor-shield-stepper-motor-tutorial/ 23/33
3/28/2021 Stepper with Arduino Motor Shield Rev3 Tutorial (4 Examples)
through the Arduino Motor Shield rev 3 board by powering it separately; in the
Arduino Uno board I loaded the rst sketch that you indicated for the alternate
rotation provided in the Stepper library. h. Everything works perfectly, but now the
most interesting process will come: to rotate the motor alternately every 30
minutes.
… to be continued
Thank you
PB
Reply
Felicia says
October 13, 2020 at 10:40 pm (https://www.makerguides.com/arduino-motor-
shield-stepper-motor-tutorial/#comment-4170)
Thank you for the tutorial! Any suggestions for connecting the wires to the motor
shield? currently trying to connect my motor shield to a power source and the wires
keep falling out. Thanks!
Reply
Hi Felicia,
I usually install wire ferrules on the end of stranded wires when I need to
connect them to screw terminals (you can see this in the intro image). You can
buy a set including the crimping tool for ~25 USD on Amazon, e.g.
https://amzn.to/3ds9S0S (https://amzn.to/3ds9S0S).
https://www.makerguides.com/arduino-motor-shield-stepper-motor-tutorial/ 24/33
3/28/2021 Stepper with Arduino Motor Shield Rev3 Tutorial (4 Examples)
You could also install male Dupont connectors or solder some breadboard
jumper cables to the end of your wires.
Benne
Reply
Felicia says
October 15, 2020 at 10:45 pm (https://www.makerguides.com/arduino-
motor-shield-stepper-motor-tutorial/#comment-4197)
Thank you for the response Benne! I also gured out that tightening the
screws on the terminal will keep the wire in place, if that’s helpful to
anyone else!
Reply
Felix says
July 14, 2020 at 10:41 am (https://www.makerguides.com/arduino-motor-shield-
stepper-motor-tutorial/#comment-3243)
Dear Benne, Thanks you for this guide! I tried to use the Arduino Motorshield Rev3
with a Nema17 Pancake Motor, but it overheats after the rst turn. My powersupply
tells me it pulls 4.5Amps. I used A4988 where I can adjust the Vref and it works
great.
Is there a way to adjust Vref on the Arduini shield? Or somehow limit the Amps the
shield delievers? Your help is greatly appreciated, I am looking far and wide for an
answer to this…
Felix
https://www.makerguides.com/arduino-motor-shield-stepper-motor-tutorial/ 25/33
3/28/2021 Stepper with Arduino Motor Shield Rev3 Tutorial (4 Examples)
Reply
Hi Felix,
Unfortunately, this is not possible. I would try to use a power supply with a
lower voltage which will reduce the current draw of the motor (you can also
check the datasheet for the voltage rating of the stepper motor). I think the
lowest voltage that you can use with the shield is 5 V.
The motor still might draw too much current, in which case your only option is
to use a different motor. Adafruit sells a NEMA 17 that works at 12 V and only
draws 350 mA (https://amzn.to/2WiLCqw), but I don’t have a good source for
pancake-style motors at the moment.
Benne
Reply
Hey, this a great, well-presented tutorial. Just wondering if you think it would be
possible to us the rev3 motor shield to control the acceleration/deceleration of two
stepper motors. Any information on this would be greatly appreciated.
Reply
https://www.makerguides.com/arduino-motor-shield-stepper-motor-tutorial/ 26/33
3/28/2021 Stepper with Arduino Motor Shield Rev3 Tutorial (4 Examples)
Hi Jonathan,
Unfortunately, this is not possible. Both outputs of the shield (A and B) are
needed to control one stepper motor. You could use an L293D motor shield
(https://amzn.to/2nvWbrV) (which has 4 outputs, so you can control 2 stepper
motors). Alternatively, you could use a CNC shield (https://amzn.to/2m0ka1M)
with A4899, DRV8825, or TMC2208 drivers. I have already written tutorials
for the A4988 and DRV8825 and a tutorial for Trinamic drivers will be posted
soon.
Benne
Reply
Taylor says
March 24, 2020 at 8:09 pm (https://www.makerguides.com/arduino-
motor-shield-stepper-motor-tutorial/#comment-2159)
Love your tutorials! Glad I have found them! I have some spare parts
(RAMPS 1.4 and 4xTMC2208) from a 3D printer that I would love to
repurpose into something like a motorized camera slider. Looking forward
to your upcoming tutorials.
Reply
https://www.makerguides.com/arduino-motor-shield-stepper-motor-tutorial/ 27/33
3/28/2021 Stepper with Arduino Motor Shield Rev3 Tutorial (4 Examples)
Trackbacks
TB6600 Stepper Motor Driver with Arduino Tutorial (3 Examples)
(https://www.makerguides.com/tb6600-stepper-motor-driver-arduino-tutorial/) says:
October 6, 2019 at 11:21 am (https://www.makerguides.com/arduino-motor-shield-
stepper-motor-tutorial/#comment-762)
[…] How to control a Stepper Motor with Arduino Motor Shield Rev3 […]
https://www.makerguides.com/arduino-motor-shield-stepper-motor-tutorial/ 28/33
3/28/2021 Stepper with Arduino Motor Shield Rev3 Tutorial (4 Examples)
(https://www.makerguides.com/max7219-led-dot-matrix-display-arduino-tutorial/)
https://www.makerguides.com/arduino-motor-shield-stepper-motor-tutorial/ 29/33
3/28/2021 Stepper with Arduino Motor Shield Rev3 Tutorial (4 Examples)
(https://www.makerguides.com/drv8825-stepper-motor-driver-arduino-tutorial/)
https://www.makerguides.com/arduino-motor-shield-stepper-motor-tutorial/ 30/33
3/28/2021 Stepper with Arduino Motor Shield Rev3 Tutorial (4 Examples)
(https://www.makerguides.com/dht11-dht22-arduino-tutorial/)
https://www.makerguides.com/arduino-motor-shield-stepper-motor-tutorial/ 31/33
3/28/2021 Stepper with Arduino Motor Shield Rev3 Tutorial (4 Examples)
https://www.makerguides.com/arduino-motor-shield-stepper-motor-tutorial/ 32/33
3/28/2021 Stepper with Arduino Motor Shield Rev3 Tutorial (4 Examples)
https://www.makerguides.com/arduino-motor-shield-stepper-motor-tutorial/ 33/33