PC motor controller

J

Jon G.

Guest
You can build a cheap 8-bit 255 speed DC motor speed controller
from the parallel port of a PC.

PC Parallel Port Pinouts

(i) denotes an input signal to the computer.
(o) denotes an output signal.

:------:------------:---------------------------------:
| Pin | Signal | Description |
:------:------------:---------------------------------:
| 1 | -STROBE | (o) data valid |
| 2 | DATA 0 | (o) |
| 3 | DATA 1 | (o) |
| 4 | DATA 2 | (o) |
| 5 | DATA 3 | (o) |
| 6 | DATA 4 | (o) |
| 7 | DATA 5 | (o) |
| 8 | DATA 6 | (o) |
| 9 | DATA 7 | (o) |
| 10 | -ACK | (i) Printer is ready to receive |
| 11 | BUSY | (i) Printer cannot receive data |
| 12 | PAPER OUT | (i) |
| 13 | SELECT | (i) HIGH = printer is on line |
| 14 | -AUTO FEED | (o) LOW -> CR + LF |
| 15 | -ERROR | (i) Paper out or Off line |
| 16 | -INIT | (o) |
| 17 | -SEL INPUT | (o) |
| 18 | GROUND 0 | DATA 0 |
| 19 | GROUND 1 | DATA 1 |
| 20 | GROUND 2 | DATA 2 |
| 21 | GROUND 3 | DATA 3 |
| 22 | GROUND 4 | DATA 4 |
| 23 | GROUND 5 | DATA 5 |
| 24 | GROUND 6 | DATA 6 |
| 25 | GROUND 7 | DATA 7 |
:------:------------:---------------------------------:

Pins 2 through 9 with respective ground pins 18 through 25
supply the 8 coils of 8 reed relays. Each of the 8 relays can
then handle higher currents in 8 separate isolated circuits.
Each parallel circuit has different resistors R1 through R8 in
series with the motor, slowing it down or speeding it up. The
DATA outputs can be programmed to turn off and on through the PC
via the parallel port.

for instance,

76543210 DATA
---------
00000000 OFF
00000001 R1 dP

00000010 R2 .
00000011 1/(1/R1+1/R2) .
00000100 R3 .
00000101 1/(1/R3+1/R1)
00000110 1/(1/R3+1/R2) .
00000111 1/(1/R3+1/R2+1/R1)
00001000 R4 .
.
.. .
.. .
11111110 1/(1/R1+1/R2+1/R3+1/R4+1/R5+1/R6) .
11111111 1/(1/R1+1/R2+1/R3+1/R4+1/R5+1/R6+1/R7) 254dP MAX

Suppose the resistors are 1/4 Watt, and that the supply is 3V at
300mA

V=IR I=V/R P=IV P=(V^2)/R R=(V^2)/P R=9/.25 = 36 ohm

36 ohm = bottom value, highest speed, full 300mA

Maximum output power = (3V)*(300mA)=0.9 Watt

Let
V^2=(3V)^2=9

Suppose I want the minimum current going to the motor be enough
to keep it from stalling under load, or about 10mA. This
corresponds to 3V(0.01A)= 0.03 Watts. The resistor would have a
value of V/I = 3/.010 = 300 ohms

The range of resistance values is between 36 ohms and 300 ohms,
corresponding to a power of 0.9 watt to 0.03 watt respectively.
Since 8 bits allow for 254 combinations,

(0.03-0.9)/254 = -0.00345 = power increment = dP

dR = R^2(0.00345/9)

S1 = 300 ohm
S2 = 300 - 300^2(0.00345/9)= 266 ohm
S3 = 266 - 266^2(0.00345/9)= 239 ohm
S4 = 239 - 239^2(0.00345/9)= 217 ohm
..
..
..
S254 = 36 ohm

Derive equation of exponential increase in power with decrease
in resistance

P = (V^2)/R
P = 9/R

dP/dR = cP = 9c/R

dP = 9c/R dR

P = 9c ln R + D

R = e^[(P-D)/(9c)]

(300-36)=e[(.03-.9)/(9c)]
ln 264 = -0.0967/c
c = -0.0173

.03-.9 n
---------* ---- = 0.0221
9(-.0173) 254

---------------------------
Rn = 36 ohm + e^(0.0221*n) n=1,2,3,4,..,254
---------------------------

where equal factors of n produce equivalent increments of power.
Suppose such a factor of n is 36 :

254/7 ~ 36

n Rn = 36+e^(0.0221*n)
1*36= 36 37 ohms
2*36= 72 41
3*36=108 46
4*36=144 60
5*36=180 89
6*36=216 154
7*36=252 298

If R7,R6,R5,R4,R3,R2,R1 are 37,41,46,60,89,154,298 ohms
respectively, then all other parallel combinations can be found
and placed in chronological order.

76543210 DATA
---------
00000000 OFF
00000001 R1 298 ohms
00000010 R2 154 ohms
00000011 1/(1/R1+1/R2) 102 ohms
00000100 R3 89 ohms
00000101 1/(1/R3+1/R1) 69 ohms
00000110 1/(1/R3+1/R2) 56 ohms
00000111 1/(1/R3+1/R2+1/R1) 47 ohms
00001000 R4 60 ohms
..
..
..
11111110 1/(1/R2+1/R3+1/R4+1/R5+1/R6+1/R7) 9 ohms
11111111 1/(1/R1+1/R2+1/R3+1/R4+1/R5+1/R6+1/R7) 9 ohms

As more power is provided to the motor, the .00345 watt
increment of power diminishes. At lower speeds the intervals of
resistance are greater. I = V/R = 3V/9ohm = 333mA, the
approximate 300mA of the power supply.

*******
3-bit DAC power = 30 to 900 mW at resistances 300 to 36 ohm

000 OFF
001 R1
010 R2
011 1/(1/R1+1/R2)
100 R3
101 1/(1/R1+1/R3)
110 1/(1/R2+1/R3)
111 1/(1/R1+1/R2+1/R3)

.03-.9 n
---------* ---- = 0.798 n
9(-.0173) 7

---------------------------
Rn = 36 ohm + e^(0.798*n)
---------------------------

ideal actual
n 36+e^(0.798*n)
001 R1 7 302 ohms 302 ohms
010 R2 6 156 156
011 1/(1/R1+1/R2) 5 90 102
100 R3 4 60 60
101 1/(1/R1+1/R3) 3 46 50
110 1/(1/R2+1/R3) 2 40 43
111 1/(1/R1+1/R2+1/R3) 1 38 38

Thus a 7-speed motor controller, that is, if the power the motor
uses has anything to do with its speed. Under load it turns
slower and uses more juice.

++++
 
On Wed, 06 Apr 2005 21:15:42 +0000, Jon G. wrote:

You can build a cheap 8-bit 255 speed DC motor speed controller
from the parallel port of a PC.
You can also get a single line of the parallel port to output PWM
directly, giving you an 11 (or 12 -- can't quite remember) channel
controller at the expense of consuming a lot of resources, since you'll
have trouble getting the required resolution from the OS if your PWM
generating program doesn't simply sit there chewing up CPU cycles.

The response time is somewhat slower (though OK for a motor controller).
You can easily get a parallel port based DAC to exced 1MHz.

-Ed

--
(You can't go wrong with psycho-rats.) (er258)(@)(eng.cam)(.ac.uk)

/d{def}def/f{/Times findfont s scalefont setfont}d/s{10}d/r{roll}d f 5/m
{moveto}d -1 r 230 350 m 0 1 179{1 index show 88 rotate 4 mul 0 rmoveto}
for /s 15 d f pop 240 420 m 0 1 3 { 4 2 1 r sub -1 r show } for showpage
 

Welcome to EDABoard.com

Sponsor

Back
Top