Tag: Circuit
Stepper Motor Driver – Shift Register
by aburks on Jul.06, 2010, under RobOrchestra, Robotics Club, Vibratron
The Problem
I need to be able to turn 30 identical stepper motors on and off individually. I can only afford to have one unique wire going to each stepper unit because I only have ~40 digital outputs to work with. I can afford to have a few common outputs that are jumped from board to board. basically I need to turn four inputs that go in a pattern into one input.
The four lines on the motor driver (H-Bridge) basically take turns going high when I want the motor to turn. When I want it to stand still, only one of the lines should be high. This is called “wave driving” a stepper motor. Here is what happens when a bipolar stepper motor is wave driven.
t=0: A=1 B=0 C=0 D=0
t=1: A=0 B=1 C=0 D=0
t=2: A=0 B=0 C=1 D=0
t=3: A=0 B=0 C=0 D=1
t=4=0
The Solution
A Serial in Parallel out (SIPO) Shift Register does basically exactly what I’m looking for. If I have one common clock (a line that goes high every 1/4 step) and connect the 4th output to the data input, then the four parallel outputs will shift through my 4 states like a champ. The only catch is that I need to seed the circuit with the initial “1″ so that the “1″ can move along the shift register.
Luckily, because a shift register is just 4 flip-flops lined up in a row, I could build my own shift register out of flip flops, and access the set/reset abilities of the individual flip-flops. So in the final setup, I had a single clock coming from the Arduino (pulsing at 100ms intervals) which controlled the speed of the motor, and a “stop” pin coming from the Arduino to control whether or not the motor was turning.
The “stop” pin was tied to the reset pin on the first flip-flop and the set pins on the other 3. This means that when the “stop” pin was driven low, it would force the shift register into the “1-0-0-0″ state, and when it was released the “1″ would shift sequentially at the speed of the clock to drive the motor. Here is a view of the protoboard layout (the center IC is the motor driver, and the other two each contain two flip-flops):
Pros
This is a huge improvement over controlling all 120 lines individually. An Arduino mega can easily output a single clock and 30 control lines. The cost of each circuit is about $4 in parts (three Integrated Circuits, or ICs), more if you PCB it. It works, and it lets you do a powered brake as well.
Cons
The two IC’s with flip-flops are about $2.50 0f the total parts cost. For this price ($2.50×30=$75) it would technically be cheaper to buy some other board that can take serial from the Arduino and control the 120 outputs. Also, the wiring is a bit complex and uninsulated because each flip-flop’s output feeds into the next one’s input.



