tepper Motors & Look Up Table Unipolar (5 lead) stepper motor from www.mpj.com. stepper motor is a digital motor with two phases and 4, 5, or 6 leads. These leads connect to two sets of electromagets. When current is applied to one set of leads, the permanent magnet on the motor aligns with the field created by the electromagnet (as is the left figure). When the other leads are energized, the motor rotates to line up with the next electromagnet. (In essence, a stepper motor is a 2-phase synchronous motor if you've had EE 331.) black black white 4-Lead (bipolar) 5-Lead (unipolar) 6-Lead (unipolar) In your lab kits is a 5-lead unipolar stepper motor. 1 February 5, 2018
green 134 Ohms red 134 Ohms black 134 Ohms brown 134 Ohms white To make the motor spin, Tie the black lead to ground. pply + to +24V to each lead in succession:,,,. The more the voltage, the more the current (and torque). ote that each phase needs positive and negative current to make the motor spin. Two ways to do this follow: 2 February 5, 2018
Method 1: Use the center tap and four P transistors: +12V a0 a1 a2 134 134 300 300 a0 a1 a2 +12V b1 b0 300 b0 b1 b2 134 134 300 b2 Each phase has a resistance of 134 Ohms to the center tap (black wire). If you connect a given end to ground, current will flow in that direction. The current you're trying to turn on and off is: max (I c ) = 12V 0.2V 134Ω max (I c ) = 88m To saturate a given transistor βi b > I c I b > 88m 100 = 0.88m The largest base resistor you can use is then R b < 0.7V 0.88m = 4.88kΩ The smallest is what the PI can output (25m) R b > 0.7V 25m = 172Ω The above circuit uses 300 Ohms as a bit of an overkill. 3 February 5, 2018
Method #2: Use an H-ridge 1k b e PP T1 PP T3 e b 1k c tepper Motor c 1k b c P T2 P T4 c b 1k e e For example, for the above voltages for (,,, ) Transistor T2 and T3 are off (there is no current through the diode, making Ib = 0) Transistor T1 and T4 are saturated This results in -4.6V being applied ot the stepper motor (assuming the transistors are saturated) If you switch the votlages for (,,, ), the +4.6V would be applied to the stepper motor. If you turn off all four transistors, then is applied to the stepper motor. Hence, with an H-bridge, you can one phase of a stepper motor. With two H-bridges, you can drive both phases. 4 February 5, 2018
L9110s H-rige search ebay using keywords rduino H-ridge Rather than building an H-bridge from scratch, your lab kits includes an L9110s H-bridge with the following specifications: Vcc: 2. < Vcc < 12V urrent: Up to 800m per channel Input Motor -1-1 0 0 0 1 +Vcc 1 0 +Vcc 1 1 Z Z onnect the stepper motor to the H-bridge as follows: green R0 () R2 () -1-1 G MOTOR green white red brown 5.. 12V Vcc MOTOR red black R1 () -1 brown R3 () -1 L9110s H-ridge white tepper Motor 5 February 5, 2018
To make the motor spin, apply the following voltages to the H-bridge. This is termed full-stepping. (R3) (R2) (R1) (R0) 0 0 0 1 0 0 1 0 0 1 0 0 1 0 0 0 repeat Each step the motor to rotate 3.6 degrees per step, or 100 steps per rotation. To make the motor spin the opposite direction, shift right instead. You can also do half-stepping with the following sequence: (R3) (R2) (R1) (R0) 0 0 0 1 0 0 1 1 0 0 1 0 0 1 1 0 0 1 0 0 1 1 0 0 1 0 0 0 1 0 0 1 repeat This causes the motor to rotate 1.8 degrees per step, or 200 steps per rotation. idelight: ote that with full-stepping, you're trying to approximate sin() and cos() with a 4-step square wave tep 0 tep 1 tep 2 tep 3 tep 0 tep 1 tep 2 tep 3 Vac sin() Vbd cos() Full-tepping pproximation to sin() and cos() 6 February 5, 2018
With half-stepping, you're approximating sin() and cos() with an 8-step square wave: 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 in() os() Essentially, a stepper motor is a 2-phase synchronous motor. If you approximate the sine waves with 4 or 8 steps, you get a stepper motor. oftware: Look Up Tables In, when you do a table read or write, such as TLE[3] = 12; what you are doing is Taking the address of the start of the variable, TLE Offsetting this address by 3, and Writing the number '12' to this address In assembler, you can do this with a subroutine. For full stepping: ; W stores a number 0..3 ; W PORT ; 0 0 0 0 1 0x01 ; 1 0 0 1 0 0x02 ; 2 0 1 0 0 0x04 ; 3 1 0 0 0 0x08 Fulltep: andlw 0x03 movwf TEMP incf TEMP,F retlw 0x01 retlw 0x02 retlw 0x04 retlw 0x08 7 February 5, 2018
For half-stepping: ; W stores a number 0..3 ; W PORT ; 0 0 0 0 1 0x01 ; 1 0 0 1 1 0x03 ; 2 0 0 1 0 0x02 ; 3 0 1 1 0 0x06 ; 4 0 1 0 0 0x04 ; 5 1 1 0 0 0x0 ; 6 1 0 0 0 0x08 ; 7 1 0 0 1 0x09 8 February 5, 2018
Halftep: andlw 0x07 movwf TEMP incf TEMP,F retlw 0x01 retlw 0x03 retlw 0x02 retlw 0x06 retlw 0x04 retlw 0x0 retlw 0x08 retlw 0x09 The main calling routine would then look something like the following: 9 February 5, 2018
; --- tepper.asm ---- #include <p18f4620.inc> ; --- Variables --- T0 EQU 1 T1 EQU 2 T2 EQU 3 GLE EQU 4 TEMP EQU 5 ; --- Main Routine --- org 0x800 call Init clrf TEP Loop: call tep call Table call Output movlw 250 call Wait_ms goto Loop ; PORT = TLE[TEP] ; each step is 250ms ; --- ubroutines --- tep: incf return GLE,F Table: movf GLE,W andlw 0x03 movwf TEMP incf TEMP,F retlw 0x01 retlw 0x02 retlw 0x04 retlw 0x08 ; full stepping Output movwf return PORT Init: clrf TRI ;PORT is output clrf TRI ;PORT is output clrf TRI ;PORT is output clrf TRI ;PORT is output clrf TRIE ;PORTE is output movlw 0x0F movwf O1 ;everyone is binary return 10 February 5, 2018
Wait_ms: movwf T2 W2: movlw 10 movwf T1 W1: movlw 100 movwf T0 W0: decfsz T0,F goto W0 decfsz goto decfsz goto T1,F W1 T2,F W2 return end 11 February 5, 2018
Microstepping: stepper motor is actually an synchronous machine: If you send a square wave to the motor, it jumps from one angle to another: it is operating as a stepper motor. For the motor above, it has 200 steps per rotation. If you send a sine wave to the motor, it smoothly moves from one angle to another: it is operating as an synchronous machine. For the motor above, it rotates once per 50 cycles: 200 steps revolution 1cycle 4steps = 50 cycles revolution If you apply a 60Hz sine wave to the above motor (sine on phase, cosine on phase ), it will spin at 60 cycle sec 1 revolution 50 cycles = 1.2 rps = 72 rpm For example, if you look at the voltage applied to phase, when using full stepping the voltage V looks like the blue line in the following figure (shown for two cycles): 1 0 0 0 V = 1 0 1 0 0 V = 0 0 0 1 0 V = -1 0 0 0 1 V = 0 repeat If you use a sine wave instead, you'll be able to position the motor inbetween steps. This is shown in the red line below: The other phase would be a cosine waveform, resulting in V = sin (φ) V = cos (φ) and φis the desired angle for the stepper motor. Each cycle (360 degrees) corresponds to one step. ignal sent to V when using full steps (blue line) or microstepping (red line). 12 February 5, 2018
V would be 90 degrees out of phase (cosine vs. sine). Linear ctuators: linear actuator is a stepper motor with a hollow shaft. If you put a screw into the motor and spin it, it moves the screw forward and backwards. (You can also do this my having the above motor drive a scew which moves a device forward and backwards as you rotate the motor.) E Motors L23GK (www.servosystems.com $200) For example, assume you have a stepper motor with 400 steps per rotation (half stepping) driving a 1/4 x 20 screw. The screw needs to rotate 20 times to move 1 inch (the 20 in the name). Each step moves the device 400 steps rotation 20 rotation inch = 8,000step/inch You can control the position of the stage to 0.125mil (0.003mm) (!) 13 February 5, 2018