Anda di halaman 1dari 5

TESTING STEPPER MOTORS OF A 3D DELTA

PRINTER
Author Andrea Missaglia1
1

Master of Science in Mechanical Engineering (MSME), Politecnico of Milan

How Stepper motors work


The stepper motors are brushless DC electric motors
that divides a full rotation into an equal number of steps.
A stepper motor converts electrical pulses into specific rotational movements. The movement created by each pulse
is precise and repeatable, which is why stepper motors are
so effective for positioning applications. They effectively
have multiple "toothed" electromagnets arranged around
a central gear-shaped piece of iron. The electromagnets
are energized by ana external driver circuit or a micro controller. There exist three main different types of stepper
motors:
1 Permanent magnet stepper
2 Hybrid synchronous stepper
3 Variable reluctance stepper
The first type use a permantent magnet rotor and operate exploiting the attraction or repulsion between the
rotor and the stators electromagnets. The second type
are the so called "modern" steppers, having both permanent magnets and soft iron cores. The third one, instead,
is based on the minimum reluctance principle. Magnetic
reluctance, or magnetic resistance, is a concept used in
the analysis of magnetic circuits. A magnetic field causes
magnetic flux to follow the path of least magnetic reluctance. It is a scalar, extensive quantity, akin to electrical
resistance. The number of indipendent electromagnet is
equal to the number of phases of the motor. In figure 1 is
shown a two-phase variable reluctance stepper motor. It
is clear that the two pahses are phase A and pahse B.

motor. Various drive techniques have been developed to


better approximate a sinusoidal drive waveform: these are
half stepping and microstepping.

Phases
2
Steps/Revolution
200
Angle Resoution
1.8
Step Accuracy
5%
IP Rating
40
Operating Temp -20 to +40
Insulation Class
B
Stack
Single
Lenght
39.8
Rated current
1.8
Holding Torque
400
Rotor Inertia
57
Motor weight
0.28

Hardware Description
In a standard 3D delta printer there exist four stepper
motors. Each one is controlled by a single stepper motor driver who is connected to the common Ramp. The
ramp is superimposed to the Arduino Mega Board that
is in connection with respect the pc. In the figure 2 it
is schematised the hardware set-up previously described.
The power supply has been neglected from the rappresentation. The stepper motors SM1, SM2 and SM3 are used
to control the three vertical pulleys connected to the end
effector. The material is feeded to the end effector by the
last stepper motor SM4.

[n]
[step/360deg]
[deg/step]
[%]
[-]
[C]
[-]
[-]
[mm]
[A]
[mNm]
[gcm2]
[kg]

More information regarding steppers could be found at


[2].

A4988 Stepper Motor Driver Carrier


The Pololu stepper driver boards are made as pluggable
modules to a electronics motherboard. A good reason of
this design is, that it is easy to exchange the Pololu boards
when troubleshooting - or when a board has burned out.
Pololu driver is a nice design, but with one big shortcoming: it will run hot, and is difficult to cool because its so
small. In order to modify the temperature rise we have
to rotate clockwise the screw, located on the top side of
the driver, increasing the current and so the temperature
or counterclockwise reducing current and temperature. It
is based on DMOS Microstepping Driver A4988, that is a
complete microstepping motor driver with built-in translator for easy operation. It is designed to operate bipolar
stepper motor in full, half, quarter, eighth and sixteenth
-step modes, with an output drive capacity of up to 35
V and 2A. The dimension of the microstepping driver
are 5mm x 5mm x 0.9mm and have an exposed pad for
enhanced thermal dissipation.

Figure 2: Hardware set-up schematization

Now we analyze the peculiarity of each main components


of the hardware set-up.
Figure 3: A4988 Microstepping Driver
Figure 1: 2-phase-variable reluctance stpper motor
This is one of the most usual configuration and the way it
works is called two-pahse on because both pahses of the
motors are always energized. However, only the polarity of
one phase is switched at time. With two-phase on stepping the rotor aligns itself between the "average" north
and "avarage" south magnetic poles. Since both phases
are always on, this method gives about 40% more torque
than a one-phase on stepping. In an unipolar two-phase
stepper each phases need three leads. This mean that a
typical two-phase stepper needs six leads but, often, these
two phase commons are internally joined, so the motor has
only five leads. In a bipolar stepper the connection are directly four. A micro controller can be used to activate
the drive transistors in the right order, and this ease of
operation makes unipolar motors popular with hobbyists;
they are probably the cheapest way to get precise angular
movements. To make the motors shaft turns, the electromagnets are powered on in such a way the resultant of the
produced magnetic field is oriented in a specific direction.
This resultant attracts the gears teeth of the rotor until they aligns togheter. Rotating resultant magnetic field
determines the continuing rotor rotation. There are many
ways to supply electric power to each specific phase of the

Stepper motor - NEMA 17


Into an Anycubic - 3D delta printer there are four twophases-variable-reluctance stepper motors. The size of
the frontal area is NEMA 17 (defined bye the US National
Electrical Manufacturers Association). This parameter is
related to the size of the "face" of the motor and not to the
lenght. So, in this case the frontal area is a 1.7x1.7mm.
The shaft of the motor is a 5mm and the number of
cables is four. This means that the motor is a bipolar
motor and need a specific driver able to generate a microstepping control. Microstepping is a way of increasing
the number of steps by sending a sine/cosine waveform to
the coils inside the stepper motor. In most cases, micro
stepping allows stepper motors to run smoother and more
accurately. Stepper motors do not offer as much torque
or holding force as comparable DC servo motors or DC
gear motors.
Their advantage over these motors is one of positional
control. Whereas DC motors require a closed loop feedback mechanism, as well as support circuitry to drive
them, a stepper motor has positional control by its nature of rotation via fractional increments.

Homework
Table 1: Characteristics
of the stepper motor

The microstep resolution is set by the combined effect of


the MSx inputs as shown in table 2. In the 3D delta printer
application the microstepping resolution of sixteenth step
given by the input combination of MS1, MS2, MS3 set
on H. The MS1 and MS3 pins have a 100k pull-down
resistance and the MS2 pin has a 50k pull-down resistance.
Table 2: Microstepping Resolution Truth Table
MS1
L
H
L
H
H

MS2 MS3 Microstep Resolution


L
L Full Step
L
L Half Step
H
L Quarter Step
H
L Eighth Step
H
H Sixteenth Step

Excitation Mode
2 Phase
1-2 Phase
W1-2 Phase
2W1-Phase
4W1-2 Phase

The step size specification (1.8 or 200 steps per revolution) is the full steps, but a microstepping driver such
as the A4988 allows higher resolutions by allowing intermediate step locations, which are achieved by energizing
the coils with intermediate current levels. For instance,
driving a motor in Sixteenth-Step mode will give the 200step-per-revolution motor 3200 microsteps per revolution
by using sixteenth different current levels. More information regarding drivers could be found at [1] and [?].

TESTING STEPPER MOTORS OF A 3D DELTA


PRINTER
Author Andrea Missaglia1
1

Master of Science in Mechanical Engineering (MSME), Politecnico of Milan

Ramps 1.4
Ramps 1.4, also known as RepRap Arduino Mega Pololu
Shield, is designed for Arduino MEGA. This complex electronic board is capable to allocate multiple electronic connections and functions. In figure 4 are shown the main
connections that we have to use in our application.
The four blue boxes rappresent the A4988 stepper drivers
locations. The boxes are marked with the relative stepper motor ID-code. For example, the stepper motor that
control the movement along the axis-1 is drived by the
A4988-SM1, instead the A4988-EXR is associated with
the extruder stepper motor. Each driver produces an output signal for its relative motor. Each output signals is
sent to the stepper through the use of four wires that
are put in evidence by means of rounded-blue-rectangles.
The four wires that connect every single motors are colored red, blue, green, black in sequence. Reversing the
color sequence, the stepper will run on the contrary.
In each driver we can seen the pins denominated MS1,
MS2 and MS3. Using jumpers we have to realize a certain logic set up of these pins. Using binary logic and
three state variable we can achieve nine different combination but we can seen from table 2 taht the motor driver
allows only five different combinations of the microstep
resolution. We set the three pins to logical state High
in order to achieve tha highest resolution. The type of
driver define an upper constraint to the maximum resolution achievable. So, our maximum resolution using this
pin configuration, these motors and these drivers is:
Res = 200x16 = 3200st/rev

(1)

Using the same motors, the same pin connections but a


different drivrs we could achieve higher reslution up to
25600 st/rev. For, example the DRV8825 is capable to
perform 1/32 microstepping instead 1/16.

Figure 4: Hardware set-up schematization


In the top-right of the image 4 we could see three differents small white blue rectangles. Each one is associated
with a mechanical end stop. They are very simple device

with two wires: the first is labeled with S for the signal
and the second is labeled with GND for the ground connection. In the Marlin firmware they are tipically set to
NO (normally open). It is possible to use M119 to check
your endstops status.
Example M119 Returns the current state of the configured ES1, ES2, ES3 endstops. Takes into account any
inverted endstop settings, so one can confirm that the
machine is interpreting the endstops correctly.
Example If X1 = ES1 M119 X1 1 This will invert end
stop X1 (Inverted means switch is connected in Normally
Open state (NO) and viceversa)
In the red-box there are two pins of the thermistor. In
this application we use 100k thermistor (best choice for
EPCOS 100k (4.7k pullup)). More information regarding
the thermistor and ramps1.4 could be found looking at [5]
and [4], respectively.

How to control the stepper


Stepper motors, due to their unique design, can be controlled to a high degree of accuracy without any feedback mechanisms. In order to control and test the four
steppers we have to write an Arduino "feed forward test
program". The Arduino AccelStepper library provides an
object-oriented interface for 2, 3 or 4 pin stepper motors.
The standard Arduino IDE includes the Stepper library
(download it at [6]) for stepper motors; It is perfectly
adequate for simple, single motor applications, but the
AccelStepper library have improved many skills like introducing supports acceleration and deceleration, multiple
simultaneous steppers, with independent concurrent stepping on each stepper. The version of the package can
be downloaded from [7]. The test code could be write
in many different ways; in this report we try to define a
test code in order to assets the correct functioning of the
overall system.
Another way to generate a proper code is to use the AccelStepper library. After have included this library into your
sketch we have to write it. So, the main sections of our
program will be:
1 include libraries
2 define stepper motors pins and motors
3 define stepper motors characteristics
4 define stepper motors movements
Looking at [4] there are the pins connections table related
to our four motors, where the prefix X stands for MS1, Y
stands for MS2, Z stands for MS3 and E stands for MS4.
Now we have to define the four different motors using the
function:
AccelStepper motor.name(motor.type,
motor.step-pin, motor.dir-pin);
Once we have identified all the four motors into the pro-

Homework

gram we have to set the main characteristics of the law


of motion like the max speed reached by the motor, the
constant acceleration used to reach that speed and the
enable pin. Tipically the enable pin allow the motor to
run when it is set to LOW value: there is a particular
function that invert the enable pins logic. We use the
following functions:
motor-name.setMaxSpeed(input1);
motor-name.setAcceleration(input2);
motor-name.setEnablePin(motor.enable-pin);
motor-name.setPinsInverted(false, false, true);
motor-name.enableOutputs();
[input1] Is the desired maximum speed in steps per second. Must be > 0. Speeds that exceed the maximum
speed supported by the processor may Result in non-linear
accelerations and decelerations. We sets the maximum
permitted speed. for example the run() function will accelerate up to the speed set by this function. Caution:
the maximum speed achievable depends on your processor and clock speed. [input2] The desired acceleration in
steps per second2. Must be > 0.0. This is an expensive
call since it requires a square root to be calculated. Dont
call more ofthen than needed.
Regarding the definition of the steppers movements we
use this simple functions:
motor-name.runToNewPosition(input3);
motor-name.moveTo(input4);
The first function moves the motor (with acceleration/deceleration) to the new target position and blocks until it is
at position. Dont use this in event loops, since it blocks.
Parameters [input3] The new target position. The second function set the target position. The run() function
will try to move the motor (at most one step per call)
from the current position to the target position set by
the most recent call to this function. Caution: moveTo()
also recalculates the speed for the next step. If you are
trying to use constant speed movements, you should call
setSpeed() after calling moveTo().
Parameters [input4] The desired absolute position. Negative is anticlockwise from the 0 position.

References
[1] https://www.pololu.com/product/1182
[2] http://reprap.org/wiki/Stepper_Motors
[3] http:
//reprap.org/wiki/Pololu_stepper_driver_board
[4] http://reprap.org/wiki/RAMPS_1.4
[5] http://media.digikey.com/pdf/Data%20Sheets/
Epcos%20PDFs/B57540.pdf
[6] http://arduino.cc/en/Reference/Stepper
[7] http://www.airspayce.com/mikem/arduino/
AccelStepper/AccelStepper-1.53.zip

1 First programs
Sketch 1: A flashing LED on a protoboard
#d e f i n e
#d e f i n e
#d e f i n e
#d e f i n e
#d e f i n e

X_STEP_PIN
X_DIR_PIN
X_ENABLE_PIN
X_MIN_PIN
X_MAX_PIN

54
55
38
3
2

#d e f i n e
#d e f i n e
#d e f i n e
#d e f i n e
#d e f i n e

Y_STEP_PIN
Y_DIR_PIN
Y_ENABLE_PIN
Y_MIN_PIN
Y_MAX_PIN

60
61
56
14
15

#d e f i n e
#d e f i n e
#d e f i n e
#d e f i n e
#d e f i n e

Z_STEP_PIN
Z_DIR_PIN
Z_ENABLE_PIN
Z_MIN_PIN
Z_MAX_PIN

46
48
62
18
19

#d e f i n e E_STEP_PIN
#d e f i n e E_DIR_PIN
#d e f i n e E_ENABLE_PIN

26
28
24

#d e f i n e Q_STEP_PIN
#d e f i n e Q_DIR_PIN
#d e f i n e Q_ENABLE_PIN

36
34
30

#d e f i n e SDPOWER
#d e f i n e SDSS
#d e f i n e LED_PIN

1
53
13

#d e f i n e FAN_PIN

#d e f i n e PS_ON_PIN
#d e f i n e KILL_PIN

12
1

#d e f i n e
#d e f i n e
#d e f i n e
#d e f i n e

10
8
13
14

HEATER_0_PIN
HEATER_1_PIN
TEMP_0_PIN
TEMP_1_PIN

// ANALOG NUMBERING
// ANALOG NUMBERING

void setup ( ) {
pinMode (FAN_PIN , OUTPUT) ;
pinMode (HEATER_0_PIN , OUTPUT) ;
pinMode (HEATER_1_PIN , OUTPUT) ;
pinMode (LED_PIN , OUTPUT) ;
pinMode (X_STEP_PIN
pinMode (X_DIR_PIN

, OUTPUT) ;
, OUTPUT) ;

pinMode (X_ENABLE_PIN

, OUTPUT) ;

pinMode (Y_STEP_PIN , OUTPUT) ;


pinMode (Y_DIR_PIN
, OUTPUT) ;
pinMode (Y_ENABLE_PIN
, OUTPUT) ;
pinMode (Z_STEP_PIN , OUTPUT) ;
pinMode (Z_DIR_PIN
, OUTPUT) ;
pinMode (Z_ENABLE_PIN
, OUTPUT) ;
pinMode (E_STEP_PIN , OUTPUT) ;
pinMode (E_DIR_PIN
, OUTPUT) ;
pinMode (E_ENABLE_PIN
, OUTPUT) ;
pinMode (Q_STEP_PIN , OUTPUT) ;
pinMode (Q_DIR_PIN
, OUTPUT) ;
pinMode (Q_ENABLE_PIN
, OUTPUT) ;
d i g i t a l W r i t e (X_ENABLE_PIN
d i g i t a l W r i t e (Y_ENABLE_PIN
d i g i t a l W r i t e (Z_ENABLE_PIN
d i g i t a l W r i t e (E_ENABLE_PIN
d i g i t a l W r i t e (Q_ENABLE_PIN
}

,
,
,
,
,

LOW) ;
LOW) ;
LOW) ;
LOW) ;
LOW) ;

void loop ( ) {
i f ( m i l l i s ( ) <5 0 0 )
d i g i t a l W r i t e (LED_PIN, HIGH) ;
i f ( m i l l i s ( ) <5 0 0 ) {
d i g i t a l W r i t e (HEATER_0_PIN , HIGH) ;
d i g i t a l W r i t e (HEATER_1_PIN , HIGH) ;
d i g i t a l W r i t e (FAN_PIN, HIGH) ;
}
i f ( m i l l i s ( ) <2 0 0 0 ) {
d i g i t a l W r i t e (X_DIR_PIN
, HIGH) ;
d i g i t a l W r i t e (Y_DIR_PIN
, HIGH) ;
d i g i t a l W r i t e (Z_DIR_PIN
, HIGH) ;
d i g i t a l W r i t e (E_DIR_PIN
, HIGH) ;
d i g i t a l W r i t e (Q_DIR_PIN
, HIGH) ;
}
else {
d i g i t a l W r i t e (X_DIR_PIN
, LOW) ;
d i g i t a l W r i t e (Y_DIR_PIN
, LOW) ;
d i g i t a l W r i t e (Z_DIR_PIN
, LOW) ;
d i g i t a l W r i t e (E_DIR_PIN
, LOW) ;
d i g i t a l W r i t e (Q_DIR_PIN
, LOW) ;
}
d i g i t a l W r i t e (X_STEP_PIN
d i g i t a l W r i t e (Y_STEP_PIN

, HIGH) ;
, HIGH) ;

d i g i t a l W r i t e (Z_STEP_PIN
d i g i t a l W r i t e (E_STEP_PIN
d i g i t a l W r i t e (Q_STEP_PIN
i f ( m i l l i s ( ) > 4000 ) {
d i g i t a l W r i t e (X_STEP_PIN
d i g i t a l W r i t e (Y_STEP_PIN
d i g i t a l W r i t e (Z_STEP_PIN
d i g i t a l W r i t e (E_STEP_PIN
d i g i t a l W r i t e (Q_STEP_PIN
}
}

, HIGH) ;
, HIGH) ;
, HIGH) ;
,
,
,
,
,

LOW) ;
LOW) ;
LOW) ;
LOW) ;
LOW) ;

Anda mungkin juga menyukai