# Confused with DC motor equations when accelarating

## Main Question or Discussion Point

Hi everyone.

I'm trying to build a robotic "arm" to move an object along one axis, the idea is to put a dc motor connected to an H-brigde which is then controlled by a microcontroller, the dc-motor will be attached to the object I intend to move by a cable.

Since the objective of this is to position the object anywhere i want, i need to correctly calculate in the microcontroller the precise amount of time it should turn the motor on and then off. Also, the faster the object moves to the desired place the better so my idea is to turn on the motor until the object reaches "halfway" and then reverse the motor's polarity so it decelerates quickly until it gets there, and then shut it off.

Could you please help me come up with an equation like P(t) = ?, I mean the function that gives the position of the object as a function of the time the motor is on, supposing it is completely still in the beginning.

I can't really come up with this equation, i've seen this equation in another thread but i don't really get it :

V= R*i + K*w
Where
V is the terminal voltage applied to the motor
i is the armature current
w the rotational velocity in rad/s
K the motor backemf/torque constant
R the armature winding resistance

but if this is true then w = (V-R*i ) / K , and if R,K,V are constants then this function is positive at i=0 and becomes negative at some point, how can the angular velocity be positive when supplying no current and then start decelerating and eventually reverse speed if i becomes larger? where is my reasoning flawed? Is the "i" a function of something or a constant when motor is accelerating/decelerating?

Please help me, i would appreciate it very much, don't know anyone who knows enough physics to help me with this, and my physics are limited since I'm a software eng. student.

PS: I know that a stepper motor would be better for this, but I intend to keep the project as cheap as possible.

Again, thanks a lot for all help

Related Classical Physics News on Phys.org
http://en.wikipedia.org/wiki/Electric_motor#DC_motors
It will introduce you to DC motor behavior.
One thing you are missing is that a when motor turns, it behaves as a generator. For a direction of rotation, the polarity of the voltage generated is the same as the polarity needed to make the motor turn in this direction.
You will need a second equation for the acceleration:
[TEX]a=pI-q[/TEX]
I is the acceleration of the object,
I is the current
p is a number that takes into account the mass and moments of inertia of the moving parts. It depends on all the moving parts.
q is a number due to friction. In your case, you can assume that it is a constant. But the sign depends on the direction of movement. It is a braking acceleration.
You have not written about position sense or about feedback. You cannot hope to control the position without this. Errors cumulate and the position derives.
You cannot control "open-loop" a system. You need a least a cheap and simple potentiometer.

Integral
Staff Emeritus
Gold Member
What you need is called an encoder. A simple encoder can be made by attaching an opaque disk with a single hole in it to your motor shaft. Use a LED and a photo diode on opposite sides of the disk to count revolutions.

I think a simple "one hole" encoder will pose too much problems. It is not absolute (as most numeric encoders). There will be missed passages and it is blind to the direction of movement. I do not recommend it.
As I understand it is a software project. As most I/O cards have an analog input. It is easier to use a potentiometer. It gives an absolute (if not very precise) position and does not need an "origin search phase" at the beginning. But then, I do not sell potentiometers!

Maybe I didn't explained myself correctly when I said the object moves by a cable, basically what I meant was that the motor is connected to one of the pulleys in a conveyor belt and the object is attached to a point in the belt itself. Therefore the object is able to move both "left" and "right".

http://en.wikipedia.org/wiki/Electric_motor#DC_motors
It will introduce you to DC motor behavior.
(...)
You have not written about position sense or about feedback. You cannot hope to control the position without this. Errors cumulate and the position derives.
You cannot control "open-loop" a system. You need a least a cheap and simple potentiometer.
Well, maybe I'm being naive but that was exactly what I was hoping for, I know that errors accumulate but there could be a barrier at the referential origin and after a few moves it would just move the object as if it was going for a negative position but the barrier would effectively stop the object at 0 at the cost of some stress in the belt and motor.

What you need is called an encoder. A simple encoder can be made by attaching an opaque disk with a single hole in it to your motor shaft. Use a LED and a photo diode on opposite sides of the disk to count revolutions.
Yes,this came to my mind but discarded this idea from the very beginning to keep costs low. Costs as in time to build+money.

(...) As most I/O cards have an analog input. It is easier to use a potentiometer. It gives an absolute (if not very precise) position and does not need an "origin search phase" at the beginning. But then, I do not sell potentiometers!
If instead of a single hole encoder, it used as many holes as non-holes the "origin search phase" problem would be solved.
The potentiometer works too if i connect it to one of the ADC in the microcontroller.

So now my question is this: do you think that it is feasible to do an open-loop system, that is, no feedback whatsoever on the motor's position to move the object from 0 to some point P even if I have to move the object back to origin (using the barrier scheme described) for every move?
The position tolerance on this is something like +-0.3mm.
I think that with a sufficiently correct model for the motor behavior, it is possible. Am I being too naive?

Thanks a lot

Today I cannot write in detail. I will explain things tomorrow. Would you please tell me:
- the maximum distance that the object must move.
But for now I can tell you that yes, you where naive to think that you can model such a system with so much precision.

Hi.

Maximum distance is ~1m.
Resolution of ADC = 10bits (maximum, I think it can be less but don't have time now to read the data sheet carefully).

The motor is suppose to operate at fixed 12V, don't know it's maximum torque since it was taken from old printer. I can however control it's velocity through PWM, don't intend to control it's velocity through varying voltage as it would lead to more complex hardware.

Thanks a lot

I'm afraid that you did not realize the difficulties of your choices.
As I wrote, the acceleration of your moving belt is of the form:
a = p * I – q
The term p accounts for the mass and moments of inertia. It will change if you change the mass of the object to be moved.
The term q accounts for the friction. There is friction in the motor, among other things due to brushes. There will be friction in all other moving parts. The problem with friction is that it is nor constant neither reproducible. It depends on all things and on the history of the rubbing of surfaces. It can even change if the mass of the object changes.
In conclusion, you cannot hope to model your system accurately.
You need a mean to know the position to implement a feedback.
I talked about a potentiometer because I think it was a software project and that the precision in the position was not a problem. With the value you gave +-0.3 mm over 1 meter I consider that the problem is not a software problem but a hardware one. The software problems are just kids' stuff compared to the mechanical problems at this level of precision.
To know the position withing 0.3 mm over 1 meter means a precision better than 1 in 3000.
This means that the reproducibility, the precision and the linearity of the position sensor must be better than this.
If you affix the position transducer to the motor axis you will have the clearance of the transmission mechanisms that will give a big difference between the real position and the value read by the transducer. Then whether you have a transmission mechanism without clearance (possible but very difficult to do) or you must have a transducer a meter long fixed alongside the belt. That is, something like a one meter long potentiometer.
With such a big distance I think that the only solution is to have a mechanism without clearance, or at least less than 0.3 mm.
But even then other problems rest. If the motor need less than 10 turns to do the 1 meter displacement, you can hope to adapt a 10 tour potentiometer. If not, the only solution is an incremental digital encoder.
Before talking about digital, let's say that to attain this precision the ADC must have a resolution of better than 3000 possibilities that is, at least 12 bits. And, as the last bit is most often than not meaningless, you probably need a resolution better than this. And linearity better than 0.03% and this is very expensive. Most microcontroller ADCs are just 8 bits.

Then let's talk about digital encoder. You must compute the number of bits per turn to have more than 3000 for the 1 meter course. You can try to do this with a simple encoder and pry over to do not miss counts and to count always in the good sense: add when advancing and subtract when going back.

I won't talk about static friction. That's enough for today.

In conclusion I think that your goals are far too optimistic and unfeasible quick and cheap.
I suggest that you multiply the asked precision by ten o 100: say 1 cm. If you succeed to have 1 cm, you can always invest to do a better servo.

Last edited:
AH! jesus! I was reading your reply thinking your calculations were wrong, I typo'd the tolerance, it's not 0.3mm but 3mm!! I'm really sorry, 0.3mm would be completely insane to do without feedback and proper hardware.

A 10bit ADC has more than enough resolution for 3mm tolerance. And it could be built with either a continuous potentiometer (if that exists) or a potentiometer alongside the moving axis. But, do you think that an equation for motor movement would still be too far from reality (for this 3mm tolerance) even considering friction indeterminism and all those factors?

Again, I'm really sorry for the typo, I would correct it but it seems the forum doesn't let me do it.

Last edited:
Well, it is better so. Nevertheless I think that even 3 mm will not hold in open loop. It depends on how much friction is there. If your motor and belt turn "as in a dream" when you push them, then maybe.

What I suggest is to test the reproducibility of your system prior to the exact determination of the model. Find a sequence of commands that makes the belt advance a short distance (say 10 cm) and stop. Find the symmetric command that makes it come back the same distance (and stop).
Then, make a series of commands to advance 7 or 8 times and the same number back. See how much you lose. If it is worth, repeat the same sequence several times.
I'm almost sure that this will not work, and that you will need a feedback system. If I am wrong, good for you.

If you need to model the motor and belt, let me know. Send a personal message. I have some ideas.

Hi,

yes, I will do that, put some linear equation for P(t) then try it out. haven't done it yet since I haven't built the belt and pulleys yet. I intend to do it next week since this week I'm really busy with college projects.

Thanks a lot for the help, I'll post here as soon as I have any news.