To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.handyboardOpen lugnet.robotics.handyboard in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / Handy Board / 1425
1424  |  1426
Special: 
[DAT] (requires LDraw-compatible viewer)
Subject: 
Stepper Motors driving
Newsgroups: 
lugnet.robotics.handyboard
Date: 
Tue, 21 Jan 1997 15:39:54 GMT
Original-From: 
Peter Harrison <PETER.HARRISON@CANNOCKstopspammers.AC.UK>
Viewed: 
1228 times
  
Hi - I am new to this list but the archive indicates some
interest in driving stepper motors on the HB so here is my
little bit:

If we have a typical four coil, unipolar stepper such as those found
in disk drives, they will have connections something like this:

           X
           Ý
     +---+-+-+---+
     Ý   Ý   Ý   Ý
     3   3   3   3
     3   3   3   3
     3   3   3   3
     Ý   Ý   Ý   Ý
     A   B   C   D

Mine have six wires since A & B are connected to a third wire as are
C & D. No matter, the wires can be arranged like those above.

Now a simple stepping sequence will energise the coils in the following
sequences:

        Forward  Reverse
         A.C.      A.C.
         .BC.      A..D
         .B.D      .B.D
         A..D      .BC.

Now these are really simple patterns and do not provide half stepping
- this is left as an exercise for the reader :)

Notice that out of the pair A & B, only one is ever on at a time. The
same is true of C & D. (this holds even when half stepping)

The standard motor outputs on the Handy Board are connected to H-Bridges
a characteristic of which is that if one side of the bridge is sinking
current then the other side is sourcing it.

We just need to connect coils A & B to the power pins of one port and
coils C & D to the power pins of a second port. The common connection
can go to ground or the motor supply positive. In the first case, if
you turn the motors off both LEDs for the channel will light. In the
second case, turning the motors off will extinguish the LEDs. Take
your pick.

If you get the connections in the wrong order then the motor will not
rotate. Swapping A with B or C with D will just make the motor rotate
the other way.

A second stepper could be connected to the remaining two motor channels.

The following rough and ready code illustrates one way to test the results.

void step(void)
    {
    long delay;
    while (!stop_button())
        {
        delay = (long)knob();
        /* if (delay < 1L) delay = 1L;*/
        printf("%d\n",delay);
        msleep(delay);  fd(2); fd(3);
        msleep(delay);  bk(2); fd(3);
        msleep(delay);  bk(2); bk(3);
        msleep(delay);  fd(2); bk(3);
    }
    ao();
}

A better solution might use tables of values for the motor ports and
poke them directly to the motor out port at 0x7000. The top four bits
enable the channel and the bottom four bits set the direction. The code
(to dignify it beyond reality) shown above works with the PWM stuff
running since the default set by fd() and bk() is maximum speed.

This probably is very mucky stuff if you know what you are doing but
it works for me, took an hour or so to figure out and I shall tidy it
at my own pace.

Thanks for reading this far. If you have any comments or suggestions
I would be glad to hear them.


Pete Harrison
Cannock Chase Technical College
The Green
Cannock
Staffs
WS11 1UE
England

21 Jan 1997

----------------------
Peter Harrison
Peter.Harrison@cannock.ac.uk



1 Message in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR