Hello, Dejan Nedelkovski here from HowToMechatronics.com.
In this tutorial we will learn how to
control a stepper motor using the a 4988
stepper driver. The 4988 is a microchipping
driver for controlling bipolar stepper motors which is built-in
translator for easy operation. This means
that we can control the stepper motor with
just two pins from our controller, or one for 
controlling the rotation direction and
the other for controlling the steps. The
driver provides five different
resolutions: Full-step, half-step, quarter-step, eighth-step and sixteenth step. Also it has a potentiometer
for adjusting the current output, over-temperature
thermal shutdown
and cross-over current protection. Its
logic*  voltage is from 3 to 5.5 V
and the maximum current
per phase is 2 A if good additional cooling is provided or
1A continues current per phase without
heatsink or cooling. Now let's close look
at the pinout of the driver and hook it
up with the stepper motor and the controller.
So we will start with the two pins on the
bottom side for powering the driver, the VDD
and GND pins that we need to connect
them to power supply of 3 to
5.5 V and in our case that
will be our controller the Arduino board
which will provide that 5 V. The
following four pins are for connecting the motor.
The 1A and 1B pins will be connected to one coil
of the motor and 2A and 2B pins will be connected
to the other coil of the motor.  For powering
the motor we use the next two pins
GND and VMOT that we need to
connect them to power supply from 8
to 35 V and also we need to use a
decoupling capacitor with at least
47um farads for protecting
the driver board from voltage spikes.
The next to pins step and direction are the
pins that we actually use for
controlling the motor movements. The
direction pin controls the rotation direction
of the motor and we need to connect it
to one of the digital pins on our
controller or in our case I will connect it
to the pin number 4 of my Arduino
Board. With the STEP pin we control the
micro-steps of the motor and with each
pulse sent to this pin the motor moves one step. So that means that we don't need
any complex programming, phase-sequence tables,
frequency control lines or so on because the
built-in translator of the 4988 driver
takes care of everything. Here we also
need to mention that these two pins are
not pulled to any voltage internally so we
should not leave them floating in our
program. Next is the sleep pin and a
logic low puts the board in a sleep mode for
minimizing power consumption when the
motor is not in use.
Next the reset pins sets the translator to
a predefined home state. This home state
or home micro-step position can be seen
from these figures from the A4988 datasheet
So these are initial positions from
where the motor starts and they're
different depending on the micro-step
resolution. If the input state to this pin is a logic low
the step inputs will be ignored. The reset pin
is a floating pin
so if we don't have intention of controlling
it with our program we need to connect it
to the sleep pin in order to bring it
high and enable the board. The next three pins
MS1, MS2 and MS3 are for
selecting one of the five step resolutions
according to the following truth table. These pins have internal pull-down resistors so if
we leave them disconnected the board
will operate in Full step mode. The last one the
enabled for turning on or or fade
out goods so illogical I will keep the
output disabled ok so here's the
complete circuit schematic I will use
the driver in full mode so I will leave
the tree and has been disconnected
and just connect the direction and the
means of the driver to the peace number
three and four on the Arduino board in
israel the ground and five votes being
for powering the board also used 100
micro farad capacitor for the coupling
and votes one point five games
adapter for powering the motor NEMA 17
people are stepper motor wires ANC will
be connected to the beings 18 and one be
and he and the wires to be burned before
we connect tomorrow we should just the
current limit of the drivers so that we
are sure that the current currently meet
of the motor we can do that by adjusting
the reference using the consumer on the
board and considering this equation the
current limit equals three ref or the
reference will teach times do however d
secretion is not always correct there
are many different manufacturers of the
84098 driver here is a demonstration of
my keys adjusted for his humor and
measured
0.64% school teach so currently meet
should be that value of your points six
times two equals 1.2 now because I'm
using the driver and according to the
AAA 4988 data sheet in this mode winding
current who reach only seventy percent
of the currently meet the 1.2 ames times
0.70% 84 games in order to check these
uploaded simple called that since
continues logic high doorstep signal so
that we can better noticed the current
and connected my meter in serious with
one winding of the motor powered it up
what I got was 3.5 and which means that
the equation was incorrect for my case
anyway now we can continue and make
simple called that will put more in
motion here's the example called first
we define the shape and direction beings
Rockies their number three and four on
the board and step in and green and also
section we have to define them as an out
what's in the loop section first we will
set the direction being on a high state
that will enable them or move in a
particular direction now using these
four will make the motor make a full
cycle or addition as the driver is set
on our . more hours the promoter here's
1.8 degrees stepping go or two hundred
steps we need to send two hundred
policies into the tape to make one full
cycle rotation so the for loop
will hear two hundred iterations and
each time it will step in on high and
then lost eight passes between each
digital right we need two outs away from
them or actually depends after this full
cycle rotation we will make one second
delay then change the direction of
rotation by setting the European on a
low state now make to full cycle
rotations 400 iterations at the end
there is one more second delay and now
lets upload the court and see how it
will work
I made one more example for this
tutorial control the speed of the motor
using the potentiometer you can find the
source of this example on my official
website that's all thanks for watching
and for more tutorials visit my official
website how to measure next dot com
