PID - DC Motor Position Control

Discussion in 'The Projects Forum' started by Mazaag, Mar 14, 2007.

  1. Mazaag

    Thread Starter Senior Member

    Oct 23, 2004
    255
    0
    Hey guys..

    I wanted to control the Position of a DC motor using a PID controller that I would implement in MATLAB. I have a DAQ which I can use to interface the position feedback input from the DC motor, as well as any analog outputs....


    At first, I thought that i would use the output of the software PID Controller (which represents voltage) and output a voltage with that value directly from the DAQ. However, the amount of current that this DAQ can source is approx 5mA , which isn't enough at all to drive the DC motor.

    So the question is, what can I use to be able to implement such a controller ? I know that I need amplifiers to be able to source such current, but I have no idea as to what kind of amplifier ( MOSFET ? OPAMP? etc.. ) .. and assuming I would use a MOSFET amplifier, what should the output of my software controller be? analog voltage ?or do i need to somehow convert it to pulses? liek would it be pulse width modulation ? or do I use an OPAMP with the appropriate Supply Voltages and simply amplify the analog DAQ output of the PID controller ?

    I hope you guys can help me, I've been scratching my head for quite a while now...

    Thanks Guys
    Mazaag
     
  2. thingmaker3

    Retired Moderator

    May 16, 2005
    5,072
    6
    How much current does the DC motor require?

    Also: By "position," are you wanting to control the angle to which the motor shaft itself turns? Or are you using a worm or screw that must be positioned by your DAQ feedback?
     
  3. Mazaag

    Thread Starter Senior Member

    Oct 23, 2004
    255
    0
    I picked up this motor from a surplus store, so i'm not quite sure exactly how much motor current it needs. But i did try plugging it to a 9v battery and it ran pretty well.. I will be squeezing out maximum torque out of this motor, so i'm assuming that it will be wanting atleast stall current, so with a measured armature resistance of 0.9 ohms (worse case), that makes Ia = 10A

    And yes, by position i mean the angle of the shaft. Ideally, I will set a reference point on the software controller, and the controller will then adjust the motor's shaft to that set point, using position feedback from a sensor.
     
  4. thingmaker3

    Retired Moderator

    May 16, 2005
    5,072
    6
    You'll want something with a current gain of 2000. (10A/5mA=2000) I'd go with a MOSFET solution (current gain increasing without bound). Any MOSFET that can handle 120% or more of the voltage and current will work. You've got thousands to choose from. (I'd go with the cheapest one that works.)

    You'll want your motor to turn one way if the angle isn't high enough and the other way if the angle is too high. I'd use an "H-bridge." If you use the forum search function, you'll find several threads about the H-bridge that may be helpful.
     
  5. Mazaag

    Thread Starter Senior Member

    Oct 23, 2004
    255
    0
    Would an H-bridge work really with my software based PID controller ? like... will it be able to control the angle of the shaft precisly ? do'nt forget that the PID outputs an ANALOG signal...

    and if so, do you know of any commercial h-bridge circuits that I could use?

    Thank you
     
  6. thingmaker3

    Retired Moderator

    May 16, 2005
    5,072
    6
    You'ld need a comparator, I admit. And some additional circuitry to turn the comparator o/p into steering signals.

    Does your PID give both positive and negative o/p? Or is it a single polarity voltage based on angle?


    I've run across one or two commercial H-bridges (monolithic chips) in my web-wanderings, but have not looked very closely at them. Another forum member may have better input on commercially available H-bridges.
     
  7. Mazaag

    Thread Starter Senior Member

    Oct 23, 2004
    255
    0
    Could you elaborate more on the using of a comparator and steering the output?

    The daq is capable of outputing a signal from -10 to 10 volts, but with only a max of 5mA. The voltage output will be from the output of the controller, and will work to mimize the error between both the set point and the feedback signal recieved from the sensors ( all done in the software).
     
  8. thingmaker3

    Retired Moderator

    May 16, 2005
    5,072
    6
    The comparator would compare your DAQ signal with ground. It would provide positive o/p if the motor needed to turn one way and negative o/p if the motor needed to turn the other way. This o/p would need to be converted to control signals for the H-bridge; It would need to be converted to steering signals. ("Steering signals" is probably the wrong term, but it is one I learned a long time ago and still cling to.)

    If you want to go with software instead, then some other solution would be required.
     
  9. n9352527

    AAC Fanatic!

    Oct 14, 2005
    1,198
    4
    Or consider converting your analogue control signal to PWM. PWM reduces power dissipated on the bridge, gives better starting, stopping and torque characteristics.
     
  10. Mazaag

    Thread Starter Senior Member

    Oct 23, 2004
    255
    0
    So does the H-bridge require PWM ? and if so , how can i convert the analog voltage to a PWM signal ? will I control the duty cycle % by using the analog voltage ? ( like normalize the voltage and use that to represent the duty cycle of a pulse train with a certain frequency? )
     
  11. kubeek

    AAC Fanatic!

    Sep 20, 2005
    4,670
    804
    How precise should the shaft positioning be?
     
  12. n9352527

    AAC Fanatic!

    Oct 14, 2005
    1,198
    4
    Yes, you got the idea. You need a PWM controller. Use your analogue control signal as the feedback voltage control.
     
  13. Mazaag

    Thread Starter Senior Member

    Oct 23, 2004
    255
    0
    The shaft positioning doesn't have to be that exact, like say +/- 5 degrees.
     
Loading...