View Spec Sheet
Transcription
View Spec Sheet
DIY KIT 94.STEPPER. MOTOR.DRIVER This circuit illustratesthe cornplex operationsthat can go on insidemodenrdedicatedintegratedcilcuits.The cilcuit usesa bi-directionaldigital rotary encoderfrorn Boum to step a unipolar stepper rnotor, one click on the encoder steps the stepper motor one step (or half a step as described belorv.) This discrete motion can of course then be gearedup or down to suit your particular purpose. The steppermotor is not supplied in the kit. Six wire unipolar stepper motors are readily obtainable for a couple of $US. The kit is not designedfor 4 wire, bipolar steppers. In this kit, we are using a preprograrnlned PIC rnicrocontroller (uC) and a dedicated stepping rnotor driver lC, UCN5804B to replace what would have fonnerly been a board full of discretegatessuch as AND, OR, NOT, etc. followed by a set of power transistors. The microcontroller The P1C16C54 microcontroller takes the input from a rnechanical encoder and converts it to two separate signals: pulse and direction. As the encoder is turned it generatestwo square waves which are in quadrature - 90 degrees apart. By doing a bit of rnathematical manipulation, the microcontroller then works out how far the encoderhas tumed and in what direction. Once the direction and magnitude of the rotation has been worked out in the uC, it is sent out as pulse and direction signals to pins 7 and 6, respectively of the UCN5804 steppermotor driver IC. The Driver The 5804 stepper driver is one of those marvellous devices that makes life so easy you wonder how you managed to get along without it. There was a very good atticle on stepping rnotors and the use of the 5804 in Electronics Australia Oct & Nov '94. The Links page of our website (http://www.kitsrus.com) lists several online sources of information about stepper motors. The driver will operatesix - wire motors at up to 35V and L25A. The step input is to pin 7 and direction goes to pin 6 ofthe 5804. Pins 9 and 10 on the PIC control one phase and half step operation, respectively. Pins I - 8 are the connections to the stepping motor. Five & eight wire steppers can be adapted to use this kit; see Kit 113 documentationwhich can downloaded from our website. Half step and single/double phase refer to rnethods of operating stepping motors. In one phase operation only one coil athactsthe rotor at a tirne. This is also referred to as wave drive. Alternately, two phasedrive energisestwo adjacentphasedin eachrotor detent position giving nuch better torque and speedcharacteristics. Half step operationis a cornbinationof one and two phase drives causing the rotor to take twice as many steps per revolution. For a more detailed explanation see the Allegro data sheet on the UCN5804 which can be got fionr Allegro (rvrvrv.allegronricro.com)or frorn our o\l,n rvebsite.Kit 113 also has a ntore detaileddiscussion.Tlre docurnentationfor Kit I l3 rna1,also be doii,nloadedliom our websiteat http://n'rvrv.kitsrus.com. Digital Contacting Rotary Encoder Also called Digital Panel Control, a Bit Switch, Grey switch or Digital Switch, rotary encodersprovide a pair of digital Grey-coded signals that allow a uC to detennine the speed & direction of the rotation of a shaft. (For exarnple,a computer mouse uses fwo digital encoders to track the x & y axis lnovements of a ball in it.) The PICl6Cxx Applications Handbook by Parallax has a section (Section 4) on the details of these encoders.The advantageof the encoderis that it permits the direct entry of digitised analog data into a digital circuit rvithout A/D conversion.The data sheet(zipped pdf file) of the ECWIJ Bourne digital contacting encoder used in this kit can be obtainedfrom outweb page at http:i/wrvw.kitsrus.com/soft.htmi The circuit There is surprisingly little to the circuit. The encoder input is to pins l7 and 18 of the rnicro and the pins are pulled high by R4 and R5 until grounded by the encoder. The supplied encoder is a 24 cycle type which will actually generate96 pulsesper revolution. The microcontroller is a PIC 16C54 and this is run using an RC oscillator as a clock input. The RC in quesiion is Cl and R3 and the values chosen give a clock speed of about 3 MHZ. Note that sirnply changing Ri will raise or lower the clock speedand consequentlyspeeduu or slotv down the motor. The source code is available for downloading frorn our website. Both the uC and the driver 5804 IC's run on 5V and this is provided by a standard78L05 regulator together with capacitorsC2 - C4. Interestingly, the driver actually runs on 5V despite the fact that the motor side can handle up to 35V. There is provision for continuous rotation ofthe stepping motor. Pin 11 of the PIC is pulled to ground by R6. Connecting this pin to 5V will result in the motor rotating at its rnaxirnum speed. It nray seem strangeto pull pins 1 ard2 of the uC up with Rl and R2, but there are good reasonsfor it. The software dependson thesepins being high as they are part of port a which is the encoder input port. They are not connected directly to the 5V rail for a rather subtle reason:the port assignmentsare all done in software so that the relevant pin can be input or output. The problem is that when there is a bit ofelectrical noise around the port assignrnentscan be corrupted resulting in, say, pin I trying to pull the supply rail down to ground. Exit one rnicroconfi'oller. DIY KIT 94.STEPPBRI\{OTORDRIVER Constltction and lesting The voltage regrlalor and chip socketsare installed and the circuit is pon'ered up. Check for correcl l'ollages at the pou'er suppll'pins of ihe micro and the dnver' hrt in all tie resistors and pot't'er it all trp again Check rhat all the pins that are pulled up are at 5V and all tltc pulled dorilt pius are al ground potential Note to add the Linlt required situated betueett the lrvo IC"s. The cncodel has lluee pins' The ccntcr pin is tlte carth pil. Use sonre lvire to collllect the 3 pius to the 3 pin ienninal block ou lhe PCB Il does not tnatter lvhich lvay around the X & Y terudnals are cotutected. There are tr,vo SPDT srvitches on the board to select lulf step and one/nvo phase. Conneclitlg pins 9 and l0 to G' ground. will give trvo phase drive. Note that corulectitlg both to +V turns offthe nrotor. PARTSLIST - Kit 94 . . I. . . . . ' . . . . . . I 7 8 L 0 r5e g u l a t o. .r. . , , . . . . , . . ......Q 1 6 C 5 , 1 - R C I P P. .I.C. . . . . . . . . . ..I.C. .1. . .. . . . ." " " ' " I u c N 5 8 0 , 1I C 9 . . . . . . ., . . . . . . I C 2 . . . . . . . .. .. .. .. .. .. . . . . . . . I 1 8p i nI C s o c k s. t. . . . . . . . . . ECWIJ. BourncRotaryencoder ,'..,'.2 SPDT su'itch,. 3 pole terntinalblock ........ 2 pole terminal bIock.... .... ........ 6 rrire harness/socket . . . . . . I. . Capacilors: I 5 p Fc e r a m i c ........ . . . . ' . . . . . C. 1. . .. . .. . . . " l 0 0 n F m o r r o . 2p"i t c h. . . . . . . C 2 C ' +. . .. . ' . ' C 3 . . . . ' . . . .. . . . l000uF/35V Resistors57o,carbonfiltn: Put in the driver IC aud solder up tlle stepping molor leads to finish the job. lf you are having lrouble identif ing the leads then get out yolu multiureter and set il to ohms. There should be livo sels of three leads' Solder one center lead to pin 2 ofthe 580'{ brouglrt out to Lhe 6-pin header and the other two leads A & B to pitts I and 3. the order is not ilnportant. The other ceuter lead then goes to pin 7 and the remaining leads C & D go to pins 6 aud 8. Softrvare The sonrce code for Kil 94. the dala sheet (pdf forntal) for lhe UCN5804 driver and the documentation for (giving more infontlation on nnipolar stepper Kitll3 nrotor connections & ballast resistors) is availabtc on the softrvare dou'nload page our rvebsile- http;//l<itsrus'com Yori should find that turning the encodef once *'ill rotate the motor twice for tlvo phase drive, assuming a 48 step motor. Connect the Continuous Rotation pads and the motor should sPin haPPilv. As the motor is spinning. trv varying the supplv voltage' This will make the motor nrn more roughly or smoolhly' Stepping tnotors are very sensitive to supplv voltage variatious. Try the same lhing while htnling the encoder" vou n'ill qtricklv get a feel for stepping motor quirks' If It Does Not Work First check that the SPDT svritches are not botlt in the +V position. That tums off the motor. Second check that the IC's are in the correct lvaY around Finally the problems must be the connection of the stepper lnotor to ih" Ita*ess. A detailed explauation of how to get the correct comections is given in Kit ll3 documentation Make sure lhe pins A B C D from the Stepper rnotor are nratched with the overlaY. The + conunon frotn each winding goes to pins 2 & 5 of the six-pin haruess' See the schematic for a detailed colurectioll pattem' A B + + C D Figure l. Six wire steppermotor. Five & eight wire rt"pp". motorscan be wired to tlris fonn to be usedwitlt Kir 94. PC PANALLEL PORT 'Jin +FV A R2 12K R? r" I = T r L--+ r* - I YIS 18Rsu -l----/\t\4------={ R8 YIS l sR su -}------ifz\,z\----.._-o OPTIOT{AL USE OF FONCING RESISTOR