EmbeddedRelated.com
Forums

Experience using shift registers for stepper motor control?

Started by edstewbob February 16, 2002
I need to control two bipolar steppers from one BX-24 connected to
two L293D 4 channel drivers. I wish to control the motor directly
but hate to give up 8 ports to do so, although this method is quite
fast and I have done this with one motor. Does anyone have any
experience using a 74HC59C shift register to do this? I think it
will work fine and only requires 3 BX-24 ports but I am concerned
about the potential slowness of the stepper versus manipulating the
AVR registers directly. I think that shifting the 8 bits used to
control the two motors into the shift register will slow down the
steppers significantly. The steppers I plan to use are 5 degrees
per step and I may need to use half-stepping so they could be even
slower.

Thanks,

Ed



I don't know how you planned to control the shift registers, but if
you use SPI, you can get the best possible speed, because data
shifting is all done in AVR hardware. Check out the files area for
my own software/hardware shift-register design. Maybe you can
optimise a bit on that as well.

Personally, I would find a stepper motor controller IC, hook it up
to the motor driver and use the BX-24 just as a clock source,
sending an exact number of pulses. (Actually this is a forthcoming
project for an industrial inkjet print head system ;o) )

What speed have you been able to obtain using one stepper motor? My
calculations have resulted in a max RPM for the 2 motors of just
96RPM at half step, using SPI at its maximum bit-rate of 1.85MHz...

Cheers!

Edwin

--- In basicx@y..., "edstewbob" <edstewbob@y...> wrote:
> I need to control two bipolar steppers from one BX-24 connected
to
> two L293D 4 channel drivers. I wish to control the motor directly
> but hate to give up 8 ports to do so, although this method is
quite
> fast and I have done this with one motor. Does anyone have any
> experience using a 74HC59C shift register to do this? I think it
> will work fine and only requires 3 BX-24 ports but I am concerned
> about the potential slowness of the stepper versus manipulating
the
> AVR registers directly. I think that shifting the 8 bits used to
> control the two motors into the shift register will slow down the
> steppers significantly. The steppers I plan to use are 5 degrees
> per step and I may need to use half-stepping so they could be even
> slower.
>
> Thanks,
>
> Ed





Edwin,

Thank you very much for your answer. I will look into using SPI.
For my application I am able to get about 120 RPM from a 400 step
per rotation motor at full step increments using 4 output ports
directly with the l293D. I also used the E-labs E1204 controller
with 3 BX-24 pins: PWM, forward/reverse, full/half step. My
application requires driving the motors with battery power so I wish
to optimize power consumption. With a more direct control of the
motor stator coils I can turn the coil power off when not required
and the holding torque of the motor maintains position. With an
external controller it seems to always maintain power to the coils
and the batteries drain down more quickly. If I can use SPI to
interface with the L293D then this will be a good solution.

Ed

--- In basicx@y..., "wolfchild76" <lulju@h...> wrote:
> I don't know how you planned to control the shift registers, but
if
> you use SPI, you can get the best possible speed, because data
> shifting is all done in AVR hardware. Check out the files area
for
> my own software/hardware shift-register design. Maybe you can
> optimise a bit on that as well.
>
> Personally, I would find a stepper motor controller IC, hook it up
> to the motor driver and use the BX-24 just as a clock source,
> sending an exact number of pulses. (Actually this is a
forthcoming
> project for an industrial inkjet print head system ;o) )
>
> What speed have you been able to obtain using one stepper motor?
My
> calculations have resulted in a max RPM for the 2 motors of just
> 96RPM at half step, using SPI at its maximum bit-rate of 1.85MHz...
>
> Cheers!
>
> Edwin
>
> --- In basicx@y..., "edstewbob" <edstewbob@y...> wrote:
> > I need to control two bipolar steppers from one BX-24 connected
> to
> > two L293D 4 channel drivers. I wish to control the motor
directly
> > but hate to give up 8 ports to do so, although this method is
> quite
> > fast and I have done this with one motor. Does anyone have any
> > experience using a 74HC59C shift register to do this? I think it
> > will work fine and only requires 3 BX-24 ports but I am
concerned
> > about the potential slowness of the stepper versus manipulating
> the
> > AVR registers directly. I think that shifting the 8 bits used
to
> > control the two motors into the shift register will slow down
the
> > steppers significantly. The steppers I plan to use are 5
degrees
> > per step and I may need to use half-stepping so they could be
even
> > slower.
> >
> > Thanks,
> >
> > Ed





Ed,

You can always disable the holding current by using ENABLE1 and
ENABLE2 on the L293D (pin 1 and pin 9 on the DIP version). Pulling
one of these pins LOW will disable the coil current.

Maybe these 2 pins can be your friends if you cannot get up to speed
using SPI. This seems very much the case, as I had made a wrong
calculation of 96RPM maximum by assuming 144 steps per revolution,
instead of 400!

Edwin
--- In basicx@y..., "edstewbob" <edstewbob@y...> wrote:
> Edwin,
>
> Thank you very much for your answer. I will look into using SPI.
> For my application I am able to get about 120 RPM from a 400 step
> per rotation motor at full step increments using 4 output ports
> directly with the l293D. I also used the E-labs E1204 controller
> with 3 BX-24 pins: PWM, forward/reverse, full/half step. My
> application requires driving the motors with battery power so I
wish
> to optimize power consumption. With a more direct control of the
> motor stator coils I can turn the coil power off when not required
> and the holding torque of the motor maintains position. With an
> external controller it seems to always maintain power to the coils
> and the batteries drain down more quickly. If I can use SPI to
> interface with the L293D then this will be a good solution.