1899Views10Replies

Author Options:

Computer Control Answered

I would like to know how to control the speed of a small DC motor via serial or USB. I have general electrical and programming knowledge, but I have no idea how I would do this. I have found http://www.lvr.com/usb.htm..

Any help?

Discussions

YES! People, I know these things, what I am asking is how to control these through the computer.

use an h-bridge if you want to control the direction of motor rotation. (see my furby hack instructable)

Yes, but,.. How would I do that? I mean, lots of searching only brings vague answers. Would it be too hard to control a serial motor with C++? My skills with that don't reach far beyond iostream.. Could game maker do it?

0
user
westfw

11 years ago

In general, the easiest way to control the speed of a DC motor is via Pulse Width Modulation. That mean instead of giving the DC motor actural DC power, you give it pulses of power inbetween "off" periods. The length of the ON time can be changed from nothing (for off) to all the time (for full speed); the frequency of the pulses should be such that it's "high" compared to brush commutation and such. Usually, you'd use a small microcontroller to read commands from your serial port (easy) or USB (significantly more difficult), and then have the micro control the power pulses, which would be applied to the motor via a power transistor. It MIGHT be possible to have a serial port control the power transistor directly, sending streamed data with a varying number of one and zero bits to implement the varying pulse widths (100 0000 is '@', 110 0000 is a quote, 111 0000 is 'p', 111 1000 is 't', 111 1100 is 'w', and so on.) You could arrange for nearly any computer (even WXP or unix) to output the appropriate character continuously. You can experiment with different PWM frequencies by changing the port speed. There are extra start and stop bits in there, but I'm not sure they'll matter. It would be an interesting experiment...

More on PWM's

I'd say you'd definitely have to go with serial port control. How? I don't have a clue.