Reducing number of pins needed to control stepper?

Hi,

Is there anyway to reduce the number of pins from an Arduino to control a stepper motor?

I'm using the 28BYJ-48 and ULN2003 drivers and currently that takes up 4 Arduino pins to control. In the final project I will have 4x motors (taking 16 pins up) and 6 switches for various things such as limit switches (taking up another 6x pins). So that's 22x pins which is more than an Uno has available.

Is my only option to use another driver board (like the EasyDriver) that supports I2C or has anyone else got any suggestions on how I can reduce the number of pins needed to control the steppers?

I was thinking shift registers but I couldn't get my head around how I would be able to incorporate them.

Appreciate any suggestions! Thanks

Use several separate stepper drivers, on their own boards. For regular stepper motors, they’re dirt cheap, and/or easily built from Arduinos and transistors.

I’m making my own Arduino based driver right now for hard drive motors. If you go this DIY route, you can just use the API example stepper functions and code.

Like you’ve seen, steppers need at least 4 wires, 2 for each phase.

Stepper drivers only need 2 pins, STEP and DIR.

STEP is a pulse saying to move one step.
DIR is CW/CCW high or low.
Easy. It needs to be attached to common ground too, but that doesn’t take a pin.
Also, you’d give the right power for the motor, switched by transistors or your motor driver IC.

Look at how CNC stuff like GRBL works. 2 pins per motor.

The attached o’scope picture is the ideal waveform on both pins.
The green square wave tells it to step each time the state goes HIGH.
The red line is HIGH or LOW to indicate CW or CCW.

The other picture is my testing board on the white breadboard, and the green one is the organized version. It doesn’t have all the wires attached yet.

You may (will) want protection diodes and/or capacitors to keep your transistors safe.

I hope this helps.

I remember seeing on this forum (been quite a while), a poster used a Tiny85 to step the inputs to the ULN2003 and the 2 left over pins for the direction and step pins but haven't been able to find it, sorry.

AhHa! Found 1: http://forum.arduino.cc/index.php?topic=247660.0

The 28BYJ-48 motors can be used as bipolar steppers with a standard bipolar stepper driver, with STEP and DIR pins. Example modifications here (note: it is actually not necessary to cut the common lead as shown).

Most drivers offer an ENABLE or SELECT pin, so you can make the STEP and DIR Arduino outputs common to all drivers.

You would then need a separate Arduino output pin for each driver ENABLE or SELECT input. Four motors = 6 Arduino output pins.

You can also common the direction pins since it is only sampled on the positive-edge of the step pin, so long as you only step one motor at a time this should work, 4 step pins, 1 direction pin, ground.