Feedback control for PWM

Thread Starter

blueboy

Joined Oct 31, 2009
10
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.



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?
 

Wendy

Joined Mar 24, 2008
23,429
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
 

Thread Starter

blueboy

Joined Oct 31, 2009
10
I'm not sure why you would use a DC motor to perform such a task.
Why not a servomotor instead?
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.
 

strantor

Joined Oct 3, 2010
6,798
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.
 

strantor

Joined Oct 3, 2010
6,798
The motor operates at 70 rpm with pretty decent torque.
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.
 

Thread Starter

blueboy

Joined Oct 31, 2009
10
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.
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.
 

GetDeviceInfo

Joined Jun 7, 2009
2,196
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:

THE_RB

Joined Feb 11, 2008
5,438
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.
 

Thread Starter

blueboy

Joined Oct 31, 2009
10
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.
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.
 

SgtWookie

Joined Jul 17, 2007
22,230
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:

strantor

Joined Oct 3, 2010
6,798
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.
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.
 

Thread Starter

blueboy

Joined Oct 31, 2009
10
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.



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.
 

strantor

Joined Oct 3, 2010
6,798
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.
 

Thread Starter

blueboy

Joined Oct 31, 2009
10
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.
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:
Top