From: fredm@media.mit.edu (Fred G Martin)
Newsgroups: comp.robotics,comp.realtime
Subject: Re: Miniboard 2.0 - I need to support LOTS of motors..
Date: 2 Sep 92 04:58:03 GMT
Distribution: na
Organization: MIT Media Laboratory

In article <1992Sep2.001302.3074@PacBell.COM> tlhouns@ns.pacbell.com
(Lee Hounshell) writes:

> The robotics application I'm constructing (which will probably be
> using the miniboard) needs to control a lot of motors.  I'll only need
> one speed, however.  I'll also need forward/backward control.  I'm
> thinking of a modification add-on board that will permit each of the
> miniboard's 4 motor ports to control 16!!!  motors (for a total of 64
> motors per miniboard). I would appreciate any net
> feedback/comments/suggestions/etc.. that anyone may have.

Wow!  That's a lot of motors!  Pray tell what ever for, I am
curious...

> At the moment, each of the motors uses a "control" register to control that
> motor's direction and speed.  The register is divided in half.. 4 bits to
> control forward direction/speed and 4 bits for backward direction/speed.
> This gives us 16 speeds forward and 16 speeds backward.

If you're referring to the Mini Board design, this isn't right.  The
Mini Board uses the 6811 Port B register to control the motor chips.
The four upper bits are used for on/off control and the four lower
bits are used for direction control.

The speed control is purely a software thing.

> The miniboard actually sends current (or no current) to the motor in pulses..
> If you think of a "time segment" as being divided into 16 units, then the
> motor will receive power (or not receive power) for each of the 16
> units.

Right, this is how it works; it's known as "pulse width modulation."
The PWM routines I wrote for the Mini Board switch on and off at a 1
Khz rate.

I have two suggestions for how to control lots of motors from Mini
Boards: 

(1) Build 16 Mini Boards and use the SPI (serial peripheral interface,
or network for short) system to tie them together.  Implement a
network protocol so that one board is a master and can send commands
to the 15 others.  Use this board's serial line to connect to your
Sparc; it receives serial line commands from the Sparc and acts as a
"repeater," sending the command over the SPI network to all the
other boards.

OK, it's a bit wasteful of 6811's, but it's a nice modular solution,
and requires zero new hardware design.

(2) Use shift-register chips hooked up to the SPI port.  When you
write a byte to the 6811's SPI register, it gets shifted out of the
6811 and into your bank of shift registers.  

	+---------+
	|  SPI OUT|--->[shift reg 0]--->[SR 1]--->[SR 2]---+
	| 6811    |					   |
	|         |		   			   |
	|   SPI IN|<---[SR 15]-------< .... <-----[SR 3]<--+
	+---------+

If you use 16 shift register ICs, each one eight bits wide, then you
have 128 bits of output.  If you shift 16 bytes from the 6811, the
resulting bitstream exactly fills your bank of shift registers.

Two motor chips can hook up to each shift register in the fashion
implemented on the Mini Board:  four bits direction and four bits
on/off (you need 4/6 of an inverter chip to get the direction lines
wired right, as done by the M.B.).

Sooo, after wiring this whole thing up, you would write 16 bytes out
the SPI port, and they'd get shifted through the whole bank of shift
registers.  When you stop shifting, the motor bits settle down, and
you've just issued a new set of commands to all your motors.

It's true that while the bits are making their way through the shift
register bank, each shift register output bit would be vacillating
between 1's and 0's as per the current state of the bit stream.  But,
since the 6811 can clock the bits at 1Mhz, and you're shifting only
128 bits per motor bank update, you only have 128/1000000 sec ~=
1/8000 of a second of motor control indecisiveness, which is small
enough of a pertubation that your DC motors won't even notice.

	- Fred

P.S.  I think the shift register chip you want for this deal is the
74HC194, but my memory could be wrong.
Newsgroups: comp.robotics