You should be able to use an L293D for your stepper and decrease your component count (L293's have built in diodes). That would make it a PIC and an L293D. Cost might drive your decision since the L293 is probably going to cost a dollar or two more than the PIC. Dan -----Original Message----- From: Mark Willis To: PICLIST@MITVMA.MIT.EDU Date: Sunday, August 15, 1999 9:35 AM Subject: Re: [OT] Driving a Stepper >Thomas McGahee wrote: >> >> Mark, > >Wow, good tutorial here! Thanks! > >> The TEAC Floppy typically uses a 5 wire stepper motor. One of the >> wires is a COMMON which is tied to one side of each of the four >> unipolar coils. You can easily determine which wire is the COMMON >> by using an ohmmeter. There will be only one wire that will measure >> the same value with respect to all the other four wires. > >OK, so this one's not split into 2 pairs of windings. Good data. > >> Connect the COMMON to +12v. Arbitrarily label one of the wires . >> Connect to ground. At this point the stepper motor will lock >> into a fixed detent position. One at a time short each of the other >> wires to ground. You will find that one wire makes the shaft move >> clockwise a small amount, and one wire makes the shaft move counter- >> clockwise by the SAME amount. Label the wire that caused the shaft to >> rotate CW . Label the wire that made the shaft rotate CCW . >> Label the remaining wire . >> >> The stepper motor will rotate full-step CW if the sequence is thus: >> A B C D A B C D A B C D etc. >> >> The stepper motor will rotate full-step CCW if the sequence is thus: >> A D C B A D C B A D C B etc. >> >> The stepper motor will rotate half-step CW if the sequence is thus: >> A AB B BC C CD D DA A AB B BC C CD D DA etc. >> >> The stepper motor will rotate half-step CCW if the sequence is thus: >> A AD D DC C CB B BA A AD D DC C CB B BA etc. > >Given the 5 wires (instead of 6), I remembered all that, summat vaguely >but well enough as I've been watching the discussions in here. There's >another rotation scheme used sometimes: > >The stepper motor will rotate full-step CW if the sequence is thus: >AB BC CD DA AB BC CD DA AB BC CD DA etc. > >similar possibility for CCW. > >> A diode should be connected across each coil winding. The Anodes >> all connect to the Common wire, and the Cathodes connect to A B C >> and D. >> >> The diode will supress high voltage spikes when the coil is >> switched from it's ON to it's OFF state. > >AKA inductive kicks, yep. OK, makes sense. > >> You can drive the windings to ground via a grounded HexFet, or even >> a decent bipolar transistor such as a Motorola MPS6566. The transistor >> must be capable of handling the current through the winding, which >> can be computed using Ohm's Law: I=E/R where R is the DC resistance >> of the coil. > >Logic-level hexfet'd be a good idea here, too, want to make sure you >saturate the FET (Or transistor.) > >> The transistor or HexFet is used as a switch. When it is OFF >> the voltage across it is +12v and the current is zero. When it is >> fully ON, the current will be from a few hundred milliamps to >> perhaps an amp or so (depending on the stepper motor), and the >> voltage across the switching device will be only a few tenths >> of a volt. In either case the POWER dissipation of the device >> can be kept quite low so long as the switching device is driven >> *hard*. > > Would not need a protection diode across a transistor, either, as >that's already across the coil winding instead - OK, sounds good. >(Hexfet's have their own protection diode, o'course.) > >> The maximum speed at which the typical floppy stepper motor can >> be stepped is between 200 and 300 steps per second. As the speed >> increases, torque will decrease until finally the motor becomes >> erratic and loses synch. > >OK, good info there, that knocks steppers out of the running for one >project (I need a known speed motor control to spin a little cylinder or >disk at a very high, controlled speed, for playing with a Nipkow >heads-up display design for wearable computers. Need something like a >30+ Hz refresh rate for that, want some other motor then (1200 >steps per second's pushing these more than they'll run at, IOW) Well, >still many other projects! > >> It is possible to increase the speed significantly by using >> a chopper mode with feedback which keeps the ON current constant. >> In this case the compliance voltage is raised to over 24 volts. >> However, such techniques are normally reserved for driving >> large high power stepper motors. It would be over-kill to do >> this with a floppy stepper motor. > >Hmmm. Makes sense, unless size & weight constraints made it necessary. > >> As to driving the stepper motor via a PIC, it is ridiculously >> easy. You assign four I/O pins to drive the ABCD driver >> transistors. If using full-step mode, you can simply shift 2 >> bits left or right in a register and then copy the least >> significant 4 bits to the I/O pins. Initial "seed" value would >> be binary 00010001. Just make sure that when you shift the carry >> value is properly set up based whether you are shifting left >> or right. > >Knew that, it's the speed & wiring I needed refreshing on - good to be >thorough, though! Could also do a 2-wire interface through a shift >register, etc., if interface pins are low (12C508A etc.) > >> I have to go right now, but if anyone has any further questions, >> ask away. As usual, this is only ONE of MANY POSSIBLE ways to >> do things. If you have a preferred method of doing this, share >> it with the rest of us. >> >> Fr. Tom McGahee > >Good thorough info. These are strongest when static, was the major >thing I needed to remember here Thanks! > > Mark