Академический Документы
Профессиональный Документы
Культура Документы
You can see in the example, when coil "A" is energized, A north-south polarity
is generated at "A+A\" as shown in the figure above and magnetic shaft
automatically align itself according to the poles generated. When the next
coil is energized the shaft again align itself and take a step. Hence the
working pricipal.
We have seen that to make the stepper motor work, we need to energize coil
in a sqeuence. The explaination and generation of the sequence is explaind
in the next section of the tutorial.
[lightbox=l293d-stepper-big.gif|Stepper
stepper
motor
motor
interfacing
using L293D|
connections]
[/lightbox]
Please click on the image to enlarge it
As you see in the circuit above the four pins "Controller pin 1",2,3 and 4 will
control the motion and direction of the stepper motor according to the step
sequece
programmed
in
the
controller.
connections]
[/lightbox]
Please click on the image to enlarge it
As already discussed in case of L293D, Here in this circuit too the four pins
"Controller pin 1",2,3 and 4 will control the motion and direction of the
stepper motor according to the step sequece sent by the controller.
2-wire connection for Unipolar Stepper Motor
We have seen the generally used 4-wire connection method for interfacing
unipolar stepper motor, but we can simplify the design to make controller
use less pins with the help of 2-wire connection method. The circuit for 2-wire
connection is shown below.
Unipolar Stepper Motor connection|stepper motor connections
As we have studied that, Bi-polar stepper motors has 2 different coils. The
step sequence for Bipolar stepper motor is same as that of unipolar stepper
motors. The driving circuit for this require an H-Bridge as it allows the
polarity of the power applied to be controlled independently. This can be
done as shown in the figure below:
Bipolar Stepper Motor connection
Now we have seen the methods for connecting stepper motors with your
microcontroller. So keeping these circuits in mind,we will now look at the
programming of microcontroller to control stepper motors. This is discussed
in the next section of the tutorial
org 0H
stepper equ P1
main:
mov stepper,
acall delay
mov stepper,
acall delay
mov stepper,
acall delay
mov stepper,
acall delay
sjmp main
#0CH
#06H
#03H
#09H
delay:
mov r7,#4
wait2:
mov r6,#0FFH
wait1:
mov r5,#0FFH
wait:
djnz r5,wait
djnz r6,wait1
djnz r7,wait2
ret
end
The working of the above code can be seen in the demo animation below.
#08H
#0CH
#04H
#06H
#02H
#03H
#01H
#09H
The working of the above code can be seen in the demo animation below.
#03H
#01H
#00H
#02H
The working of the above code can be seen in the demo animation below.
full and half stepping in real time via a switch on the UCN 5804 (or you may have the PIC
control it), as well as reverse direction. A pinout for the UCN804 is shown in Figure 8.
Figure 8
The schematic we will build to use this chip is shown in Figure 9. Since we are using a 5V
stepper motor, we will be powering the UCN 5804 with a 9V wall transformer. You cannot use
6V, due to the draw of the motor. The UCN 5804 can support voltages up to 35V.
Figure 9
Notice in the schematic that two resistors, rx and ry, do not have an assigned value. This is
because our motor draws only 100 mA, well under the chip's supported 1,250 mA. However, if
you were to use a motor that draws the maximum or above, then you would need to use rx and ry
to get the amperage under 1,250 mA. For example, a 24V motor with a phase resistance of 15
ohms would draw 1,600 mA (24/15 = 1.6). In this case, you should use _at least_ a 5 ohm
resistor for both rx and ry, which would bring the current down to 1.2 A.
Since the input of the UCN 5804 is CMOS and TTL compatible, we can connect the outputs
from the PIC directly into the UCN 5804. Two outputs are needed; one to control the step input
(pin 11), and one to control the output enable (pin 15) which enables the stepper motor while
high and disables the stepper motor while low.
Pins 9 and 10 control the stepping method (half or full steps). Pin 14 controls the step direction.
Both of these controls can be manipulated by the PIC, but it is easier to control them directly
through the use of jumpers acting as switches.
All the program has to do, is output a pulse and set the output enable low. This can be
accomplished with a very simple program such as the following:
Listing 3
End Listing 3
Notice that I added an extra step; taking the defined "delay" value and multiplying it by 1,000.
This is necessary because the pulsout command requires a pulsewidth in micro-seconds, not
milli-seconds. You can make the code even smaller by removing lines 1, 3, and 4 and replacing
"delay" in line 5 with a set number in microseconds. However, I prefer to the method shown in
the listing, because it makes it easier to change the delay parameter in the more familiar
milliseconds without having to convert it to microseconds.