Motor Control from a PC


Thread Starter

David Jordan

Hi folks,

I need some of your help, I have to design a 6V DC motor control, and I have to control it from the PC, I have to control both velocity and position. does someone have an idea or anything that could help? I´d really aprecciate it.

First you need some way of generating an analog voltage from the PC. I would suggest the LabJack U12 - this is a low cost analog I/O device that has 2 analog outputs. see "": . Then you need a motor driver. I have used the L272 power op-amp from ST - their datasheet has examples of servo motor drivers.

If you would like more info regarding PC and motor control or examples of using the L272 please email [email protected].
for controling the dc motor you must do these items
1-with the instrumentation devices like an (osiloscope with memory) calulate the transfer function of motor with step response.
*notice that step 1 is nesesary for optimum conrol
2-for connecting the motor to the computer you need and I/O interface for ISA bus you can buy this card or you can make it (ref to ibm 286 technical reference
3-for driving the motor you need a full bridge transistor array with 4 bjt

if you want more information please mail me to
[email protected]
The best solution is to replace the motor by a stepper or a servo. If the load is variable then you should use a servo motor.

If you don't whant to use a stepper or a servo (use a simple DC motor), then you should implement a H-Bridge with an encoder or other count device. Check some of my work in:


in the Darkcut section about a CNC cutting machine were I used a DC motor with a H-Bridge and sensors from a mouse.

Mike Fillian

Depending on the criticality of your application, you may also need to incorporate feedback to control speed. In that case, consider a PID algorithm using a pulse feedback from your motor. Output from your PID algorithm can be a variable voltage or PWM (Pulse Width Modulated)pulse. Position, direction, and speed can be derived from a quadrature encoder.

I don't want this to be a commercial for NI, look at your options carefully to select the right solution for you. We, as well as many other manufacturers, make products for measuring speed and position. We also have software (LabVIEW) for generating PID controls on a PC. Another option for you would be to obtain a discrete PID controller (there are many manufacturers). The vendor you choose may depend on your application. Also consider that motors create noise, so you should condition your inputs. There are tutorials on the website (NI Developer Zone, search on LS7804)that show how to hook up a quadrature encoder to an LS7804 for conditioning. Once again, this information is not only available at the NI website, it is just the one for which I am most familiar.

If cost is a major factor, look at Joe Jasniewski's website:
He has an excellent article on controlling fan speed that may be give you some good ideas.

This is a long answer, but these are some of the things for you to consider.

Mike Fillian
National Instruments