View Full Version : Control 4 stepper motors via PC
jonwalker
07-26-04, 02:23 PM
Hi All,
I need to control 4 stepper motors via the parallel port (RS232) of my PC. Each motor should be able to run independently, allowing my device to move on more than one axis at a time.
I was thinking of the IsoPod with 4 "NMIS-L-7040 stepper motor controller boards", one for each stepper motor. The PC would send commands to the IsoPod indicating which motor to control and how. The IsoPod in turn would relay the commands to the appropriate 7040.
Is there a major flaw in this thinking or is there a simpler way that I am missing?
Many thanks in advance.
Jon
- Jon Walker
nmitech
07-26-04, 03:02 PM
The peripherals, NMIS-L-xxxx cards are designed to stack on the NMIY-series, or NMIX-series, or NMIS-L-0021 MPU series. It does not compatibe with the 'Pod(TM).
RMDumse
07-26-04, 03:09 PM
The idea of controlling the four steppers from the IsoPod(TM) is still a good idea. Much of the logic done in the NMIS/L-7040 board can be done by the IsoPod(TM). It is however a programming project. OTOH, it's one I have been meaning to tackle as a appnote example. So it is possible we could work on it together.
jonwalker
07-26-04, 03:26 PM
Can the IsoPod directly control 4 stepper motors? If so, what would be the procedure (just roughly to give me an idea)?
Also, would the IsoPod be the best 'pod' for the task?
Thanks,
Jon
RMDumse
07-26-04, 03:36 PM
Well, some details from you would be nice. How big are these steppers? Are the motors bipolar or unipolar? What is the recommended drive voltage/current? Do you want whole stepping, or half stepping?
The difference between whole stepping and half stepping is whether we turn on only one phase at a time, in sequence (whole stepping); or if we turn on one phase, then the next phase, then turn off the first phase, then turn on the third phase, then turn off the second phase, etc (half stepping).
Electrically, basically, we'd buffer the outputs with level convertors to large FET's. If the windings are unipolar, We just switch the FET's on in sequence. If they're bipolar, we'll use H-bridges to drive the coils.
We'll probably use the GPIO to sequence the windings, and a PWM output per motor to do the chopping, to keep from over currenting the windings. (But a lot of the detail required for chopping will depend on how big the motors are and how much current and voltage we're talking about. Smaller motors don't require chopping.)
Driving steppers is one of those things that doesn't take much effort if the steppers are small and the speeds are slow, but approaches an "art" if the step speeds are high and the power requirements are high.
MReam85
04-27-07, 12:58 PM
I'm trying a similar project right now.
I have a pair of bipolar Airpax motors. They take 5 volts and .8 amps from what I've been able to find out. I'm hoping to be able to use them to drive a small robot, but am not sure exactly how the code would look to use the Isopod for this. If there are any examples of stepper code available, it'd be awesome if somebody could point me in the right direction.
Thanks!
There is a good resource describing stepper motors called Jones on Steppers (http://www.cs.uiowa.edu/~jones/step/types.html#bipolar) that I've linked to the specific place where bipolsr steppers are discussed. Essentially what is needed is a 2 h-bridges for each stepper, and based on the motor specifications posted, our NMIH-0010 should be able to control one stepper, 2 needed for 2 motors. This page (http://www.solarbotics.net/library/pieces/parts_mech_steppers.html) has a couple diagrams showing a couple possible sequencing diagrams for either type of stepper. Translating the 1st diagram to a program running the NMIH-0010 would involve first making the 1A input high, then low while making the 3A input high, then low while making the 2A high, then finally the 4A high, then low back to the 1A high again. This is just a simple single winding powering of the stepper, that powers one coil, then the other. I believe that one coil would be the Yellow and Black wires, with Red and Gray being the other, each connected to the M1A, M1B, and M2A, M2B respectively. Sequencing could be done either in a state machine or Forth words with delay loops to keep from outrunning the motor. Perhaps something like :
LOOPINDEX DELAY 100 DELAY END EEWORD
MACHINE STEP-SEQ EEWORD
ON-MACHINE STEP-SEQ
APPEND-STATE BEG-SEQ EEWORD
APPEND-STATE 1ST-COIL EEWORD
APPEND-STATE 2ND-COIL EEWORD
APPEND-STATE 1ST-BACK EEWORD
APPEND-STATE 2ND-BACK EEWORD
IN-STATE
BEG-SEQ
CONDITION
PA0 OFF
CAUSES
PWMA0 ON ( PWMA0 TO 1A ON NMIH-0010, M1A TO 1ST COIL
PWMA1 OFF ( PWMA1 TO 2A, M1B OUT TO 1ST COIL
PWMA2 OFF ( PWMA2 TO 3A, M2A OUT TO 2ND COIL
PWMA3 OFF ( PWMA3 TO 4A, M2B OUT TO 2ND COIL
THEN-STATE
1ST-COIL
TO-HAPPEN IN-EE
IN-STATE
1ST-COIL
CONDITION
DELAY COUNT
CAUSES
DELAY RESET
PWMA0 OFF
PWMA1 OFF
PWMA2 ON
PWMA3 OFF
THEN-STATE
2ND-COIL
TO-HAPPEN IN-EE
.... continue on to reverse 1st coil by turning on PWMA2 with others off, stop and reverse 2nd coil by turning on PWMA3, then back to 1st coil. The delay is set to 50 steps per second to hopefully allow the stepper to start and not lose steps. Quicker staps can be done with a shorter DELAY number. Other things to consider might be ramping up or down the step speed, and applying PWM to limit current if needed rather than simply switching each coil directly on.
If using Forth words, a much longer delay might be needed.
Sequencing for the other type of bipolar stepper driving would only change the commands a little.
First might be :
PWMA0 ON ( BEGINNING ONLY
PWMA1 OFF
PWMA2 OFF
PWMA3 OFF
then:
PWMA0 ON
PWMA1 OFF
PWMA2 ON
PWMA3 OFF
then:
PWMA0 OFF
PWMA1 ON
PWMA2 ON
PWMA3 OFF
then:
PWMA0 OFF
PWMA1 ON
PWMA2 OFF
PWMA3 ON
with a different start cycle this time :
PWMA0 ON
PWMA1 OFF
PWMA2 OFF
PWMA3 ON
then going back to the 2nd set above.
vBulletin v3.0.7, Copyright ©2000-2012, Jelsoft Enterprises Ltd.