Feedback control for PWM

Discussion in 'General Electronics Chat' started by blueboy, Jul 5, 2011.

  1. blueboy

    Thread Starter New Member

    Oct 31, 2009
    10
    0
    Apologies if this is the wrong forum for it.

    Messing around with circuits at the moment, using this PWM circuit from robotroom.com to control the position of the motor.

    [​IMG]

    I've hooked up the potentiometer of the PWM to the shaft of the motor as a form of control. Turn the shaft anti clockwise, the resistance of the pot changes, causing the motor to turn clockwise until the average voltage is to low to keep it turning.

    Want to add some feedback control through the form of an op amp as a differential amplifier, so that I can add a reference signal (step or ramp). So that I can cause the motor to stop at a value that isn't fully turned depending on the reference, or cause the motor to oscillate with the ramp input.

    I understand how the variable pulse is generated but the top voltage rail confuses me. Not sure how the transistor works and as such don't know where the reference voltage fits in or what to take as the feedback signal.

    Would it be right to replace the top rail with the output of the op amp, with the voltage output of the pot as the negative input to the op amp and the reference voltage as the positive input?
     
  2. blueboy

    Thread Starter New Member

    Oct 31, 2009
    10
    0
    Anyone????
     
  3. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    I'm not sure why you would use a DC motor to perform such a task.
    Why not a servomotor instead?
     
  4. Wendy

    Moderator

    Mar 24, 2008
    20,765
    2,536
    The scheme as you show it will control the speed of the motor, not its position. It is somewhat similar to this...

    555 PWM Oscillator

    There are other threads that describe how to control a servo, which sounds more like what you are after. Correct Wookie and me if we are wrong.

    555 Servo Controller
     
  5. blueboy

    Thread Starter New Member

    Oct 31, 2009
    10
    0
    Have done a bit of circuitry at university but very little experience with motors. Truth be told, I had no idea what the difference between a DC motor and servo motor was until I googled it moments ago.

    Either way, I'm doing this to learn at the moment. Just finished a semester on feedback control at university and wanted to make my own basic controllers using simple circuitry (op amps, RC components) and quickly found that controlling the position of a motor was a touch more complicated than connecting a potentiometer to a motor and feeding that through an op amp.

    Really keen on getting some position control with the DC motor (which appears to be a sort-of conversion to a servo, now that I've read up on it) and am curious if it's possible to do so with the circuit I've mentioned.

    Not using a 555 (at the moment I've got no ICs bar two inverters and 4 op amps). Using an inverter chip to control the oscillation of the PWM.

    As an example, if I apply a 0V reference signal, I want the motor to turn until the potentiometer is fully turned. If I apply a 3V reference, I want the motor to stop at an angle (say, 60 degrees), and if I physically rotate the shaft left or right, it'll go back to that equilibrium. For that, I'll need a feedback signal (presumably voltage across the potentiometer) and subtract that from the reference signal. So that when the potentiometer outputs 3V, the reference - output voltage is 0V, stopping the motor there.

    Just not sure what voltages I'd need or how to modify the circuit to achieve that, with the oscillating PWM and the transistor.
     
  6. strantor

    AAC Fanatic!

    Oct 3, 2010
    4,302
    1,988
    I think you would have a better chance at success if you used reduction gears(s). It's hard to control the position of a DC motor within 1 revolution (i.e. 0-360 degrees). Notice inside little RC servos, there is a little motor and a bunch of reduction gears for this reason.
     
  7. blueboy

    Thread Starter New Member

    Oct 31, 2009
    10
    0
    The motor operates at 70 rpm with pretty decent torque.
     
  8. strantor

    AAC Fanatic!

    Oct 3, 2010
    4,302
    1,988
    yeah, but try operating it 2/3 of a turn and all bets are off. That's the reason for the reduction gears; not necessarily to gain more torque (that is an added benefit, although you don't need it) but more to gain more precision. For example you want to move your shaft 2/3 of a turn; let's say you add 100:1 reduction gears (I know, that's really high, this is just an example). It is a lot easier to make your motor spin 66 turns +/- 1 turn than it is to make your motor shaft spin 240 degrees and stop within +/- .5 degrees. These DC motors aren't really precision devices. Stepper motors and servo motors offer more precision. Since adding reduction gears and all this sounds pretty much like reinventing the servo motor, I recommend going with what the other guys suggested and using a servo motor.
     
  9. blueboy

    Thread Starter New Member

    Oct 31, 2009
    10
    0
    Where's the fun in that? :p

    Not going to use it for anything, just trying out a few things with what I've got. Not after precision, so long as it roughly does what it's supposed to do. All about learning and gaining experience and there's a lot more learning to be had doing it myself than using a servo motor.
     
  10. GetDeviceInfo

    Senior Member

    Jun 7, 2009
    1,571
    230
    what your trying to do was in fact a very common arrangement in the older style pen chart recorders. The basic configuration was an amplifier driving a dc motor direct coupled to a feedback pot. The input signal fed one input of the amp while the feedback feed the other. The motor would then 'track' the input signal. PWM however was not typically employed, but there should be no reason why not. You will at some point probably want to traverse in the opposite direction. The pen charts I referred to would use a bipolar supply giving bidirectional tracking.
     
    Last edited: Jul 6, 2011
    blueboy likes this.
  11. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    I believe a motor with a pot connected to its shaft qualifies as a "servo" anyway. ;)

    It's a fun project, provided you are happy with 270' (or less) of rotation it might be useful, for something like camera pan-tilt or any similar real world use.
     
    blueboy likes this.
  12. blueboy

    Thread Starter New Member

    Oct 31, 2009
    10
    0
    Doesn't it inherently track in both directions? A reference voltage greater than the feedback would spin the motor one way, whereas a feedback greater than the reference would spin it the other way?

    Just to clarify, from the diagram I posted in the OP, the top rail would be the output of the op amps, the + input to the op amp would be my reference, the - input would be the voltage across the pot? Resistors chosen to give a scale factor that allows me to achieve a full range of motion.

    Shouldn't be too hard to implement and see if it works (will do so tomorrow, as it's 1am down here). Don't want to disagree with Bill, who's knowledge obviously eclipses mine, but from my understanding the circuit mentioned above should theoretically control the position, not the speed of the motor.
     
  13. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    My initial contention with using a plain DC motor would be the difficulty in trying to get any kind of angular precision. However, using PWM on an H-bridge configuration could make that workable.

    For starters, have a look at ST Microelectronics' datasheet for the L2720/L2722/L2724:
    http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/DATASHEET/CD00000055.pdf
    On the 5th page, there's a schematic for a bidirectional DC motor control with uP compatible inputs. This is a very easy way to make what amounts to an H-bridge from a couple of power opamps. The L2720/L2722/L2724 are low-dropout versions of the industry standard L272 power opamp. they are quite reasonable. Digikey has a Fairchild L272M for $0.66/ea when you buy 1. The L2722's run around $1.90/ea.
     
    Last edited: Nov 15, 2011
  14. strantor

    AAC Fanatic!

    Oct 3, 2010
    4,302
    1,988
    Well I can agree with that; I am actually curious now if you can make it work. GetDeviceInfo has lended (lent?) it some credit and if you already have the stuff, go for it. Keep us (me) posted; I really would like to know how it turns out.
     
  15. blueboy

    Thread Starter New Member

    Oct 31, 2009
    10
    0
    Ok, this is my circuit as is at the moment. Sorry for the very poor schematic, couldn't find the IC or transistor in Pspice.

    [​IMG]

    Not quite working. When using my 12V, 70rpm motor with 3V input, I only get a maximum of 0.5V and 20mA across at the motor. Does the circuit make sense?

    The diff amplifier has a gain of 2, using a 741 op amp. Using the 74HC14 inverter, but have a 40106 if that'll help.

    When I hook up my 4.5V hobby motor, I get no voltage across it at all and I've no idea why.
     
  16. strantor

    AAC Fanatic!

    Oct 3, 2010
    4,302
    1,988
    the power opamp wookie suggested has an output current of 1A, which might be enough to move your little hobby motor. the one you are using has an output of 40mA. You are going to need a lot more current to run a DC motor. you probably get no voltage across the motor because when it's stationary, it's almost a direct short.
     
  17. blueboy

    Thread Starter New Member

    Oct 31, 2009
    10
    0
    Thought the op amp might be the issue. Should have done more reading on op amps before going out and buying the only one I'd heard of at uni. Ah well, looks like yet another visit to Jaycar. :(

    Would the 3V also be a limiting factor wrt to the 12V motor?
     
    Last edited: Jul 7, 2011
Loading...