To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.roboticsOpen lugnet.robotics in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / 22129
22128  |  22130
Subject: 
Re: Balancing robots
Newsgroups: 
lugnet.robotics
Date: 
Tue, 27 Jan 2004 05:32:11 GMT
Original-From: 
Gordon Elliott <gelliott@IHATESPAMcsisc.cc>
Viewed: 
960 times
  
Peter, take a look at these two papers.

The first is the web page on the H bridge concept, and the second is an
(oversimplified) description of an H bridge motor control.
http://www.dprg.org/tutorials/1998-04a/
http://www.drrobot.com/products/item_downloads/MDM5253_1.pdf (NOTE PDF file)
(These are very simple, not mathematical, but the problems need to be
understood intuitively first).

The first does not consider the PWM control, but shows the diodes that form
the protection circuit.

The second does not show that detail, but does give basic PWM inductive
waveform and control information on page 3.

And here I realize that a _bi-directional_ control would probably be as
suggested in the second paper. Though it is possible to use the combination
of turning on the low side transistors of both sides of the H bridge, and
also of turning off all the transistors, I doubt that occurs in the actual
motor controller in question. As the diagrams on page 3 show, the energy
from
considering the motor as an inductor is simply captured back into the power
supply in the opposite half cycle from the half cycle which delivers power
to the inductive load. And when the cycle is at about 50%, then the
triangular current waveform is half positive and half negative, so that
almost all of the energy delivered in one part of the cycle is recovered in
the next.

The real problem is that there is no OFF condition at all in the normal PWM
cycle. It can actually be considered as a DC drive with a weird triangular
current flow component due to the gross switching, with noise at the switch
edges.

To achieve full "off", one would have to give a special control cycle in
which all transistors were turned off. (And see that first web page for the
diode paths that would take over while inductive current is still flowing.)
Then wait for the current to actually drop to zero. This is different from
the normal PWM power cycling, which would (now that I see it) be on all the
time. The key point is that the "induced EMF" is present all the time and
the current flows in a triangular pattern because the voltage is constant
across the inductor in each fractional cycle. I suggested how one could turn
off one or the other leg of the H bridge (if that is possile) and wait for
the current to completely die off. Then take a voltage measurement on the
leg that is turned off (while setting the other leg driver to ground that
side of the motor). This would probably make a low buzz sound as the special
cycle was instituted.

Or one could measure the current with a resistor as Jim Choate suggested
many messages ago, and average that over cycles. An op amp circuit could do
that, and there are differential amplifiers available as a single chip that
can be placed across a current resistor to measure the differential current
while ignoring the common mode voltage (for the most part). (A problem there
is that either side of the motor is switching between positive and negative
power supply rails, so the circuit would have to take input levels that
exceed the rails. These devices do exist.)

Now I'm fairly certain of the following problems:

The measured EMF voltage (converted to an average current measurement across
the coil resistance) is only a very small fraction of the power supplied
full on or reverse current. This will make the measurement noisy.

There is no absolute position, only velocity measurement. You are using a
derivative as the measurement, not the linear state variable. That can cause
problems. As velocity approaches zero, errors increase as percentage of the
velocity (as the voltage or current errors are pretty much constant as
fraction of power supply voltage or maximum motor current). So in using this
in a balancing application, the best that would be hoped for is slow creep.
Some other feedback would have to correct for this as the errors cause the
robot to lean slightly into the error and thus continually "fall" and
correct by (probably somewhat erratic) low level motion.

As the robot is on different slopes, there will be a constant motor current
to compensate. Errors in the differential calculation (electronic, etc.)
will cause variation in the magnitude of the creep that is dependent on the
slope. On a flat floor, that would be minimal.

Of course there is the variation in the back-EMF with angles, but that will
average out over motion cycles. Remember that zero back EMF is zero motion,
no matter how the particular angle affects the multiplication factor (as sin
of angle until switched by commutator, and of course with noise for the
commutator switching). That is where averaging comes in.

BUT the circuit could be fairly simple. Measure average current with the
differential op amp system, and average some with a capacitor circuit before
A/D conversion (and to amplify).

Now the processor already knows a version of the average voltage applied to
the motor, as that is simply the power supply times the deviation from 50%,
wherein full on is positive full power supply, 50% is zero, and full off is
negative full power supply voltage. Measure the resistance of the motor, and
that is approximately the I/V relationship, where average V is the +/- power
supply scaled by duty factor that is output by the feedback program.

Furthermore one can observationally (experimentally) correct for the scale
factor by observing the measurement while manually locking or turning motor
with an external source. Also if there is any sort of position feedback from
another position sensor, that could be used in some sort of PID like system
to compensate, using the back-EMF only for dynamic balancing.

And don't get thrown off the track with terminology. There are both
inductive EMF voltages (as derivative of current), and generator induced EMF
voltages (as segmented sine function of derivative of motor angle, which is
the rotational speed, with noise at commutator crossing). The inductive EMF
voltages can get converted to current. The back-EMF voltages then reduce
that current. And they all zig-zag in triangular waveform with generator
effect induced back-EMF as an additive superposition on the triangle wave
(with noise at commutation). Averaging helps all of these, but adds terms to
the feedback dynamics.

Also you won't get any absolute motor angles out of this, so there is little
point in trying to compensate. Let averaging take care of this also. All it
does is to make for a time-varying feedback factor that varies within a
certain range. As long as the system is stable at all factors in the range,
it will be a stable system. And there will be noise induced instability of
small magnitude that will cause the system to jiggle, which will actually
cause the feedback variations to go through the various phases, and that
should cause the averaging over those phases to help with the larger
picture.

The problem is definitely on the edge, and ability to compensate for the
noise will make the difference in whether the back-EMF measurement is
usable. There your point is on the mark, that only someone's experiment will
really answer the question.

-- Gordon


----- Original Message -----
From: "PeterBalch" <PeterBalch@compuserve.com>
Cc: "[unknown]" <lego-robotics@crynwr.com>
Sent: Monday, January 26, 2004 4:58 PM
Subject: Balancing robots


Hi Gordon and Jim

Motors really are tricky things.

Oh dear, I seem to have stirred up a hornet's nest.

I too have built magnetometers and they are far easier to understand and
model. The problem with motors is that they go round - and they have a
commutator.

As they go round, the torque produced varies depending on which coils are
currently connected via the commutator and what angle they are at relative
to the stator  magnets. The magnetic field is nothing like the nice
straight lines shown in a physics textbook (so "sin(theta)" is worth next
to nothing). The back EMF depends on the which coils are currently
connected via the commutator and what angle they are at.

I got down at a range of textbooks from my bookshelf and "back emf" for
motors is defined as "the induced EMF due to the generator principle" (from
a book of 1907; a 1992 book gives much the same definition).

The same books talk about the EMF due to the collapse (or build-up) of the
magnetic field in a coil. They refer to it as the "induced EMF".

Measuring the "back EMF" to estimate the speed of rotation of a PWM
controlled motor ought to work both when the motor is "on" and when it's
"off". My questions were: how reliable is it as a way of estimating speed
and what's the best way to measure it.

Let's say I measure the EMF at the motor terminals with an op-amp (the
motor is in an H-bridge so I need to do a subtraction).

Measuring it when the PWM is in its "off" phase may be easier: You don't
have to worry about the drive current and the internal resistance of the
motor. But the transients due to "induced EMF" can be huge. Certainly big
enough to saturate the op-amp inputs.

Measuring "back EMF" when the PWM is in its "on" phase means that the
transients from the interaction of the PWM and the inductors are smaller
(because the transistors are on). But there will still be large transients
when the commutator connects and disconnects coils.

I would have to subtract a voltage which depends on the current and the
internal resistance. (Which a few extra resistors and the op-amp can do.)
Of course, the internal resistance of the motor is also affected by the
commutation.

My guess is that any voltage I try to measure will be bouncing around all
over the place. The ADC on my chip will have to measure it at some fixed
time (or times) in the PWM cycle. When is best? If the PWM period is long
then I can wait for the "induced EMF" to die down before I measuring the
"back EMF". But in practice, the PWM period will probably be so short that
I've got to put up with "induced EMF".

If I just put a capacitor in the feedback of the op-amp will that average
out all these effects? In theory, yes. In practice, the "induced EMF" may
well saturate the op-amp so the "average" is no longer valid.

My belief is that - like many problems in electrical engineering (rather
than physics or electronics) - you just can't tell until you've tried it. I
was hoping tha someone had tried it and would say: "here's a circuit that
worked for me and the results were accurate to 10%" or "I messed about for
a month and eventually gave up".

Peter



Message has 1 Reply:
  Re: Balancing robots
 
Just a thought. What if you were to set up a track for a steel ball to roll on and have some sort of sensor at the end that would tell the rcx that the robot is falling forwards/backwards. something like so: ___...___ |_/___...___\_| ___...___ (...) (20 years ago, 27-Jan-04, to lugnet.robotics)

Message is in Reply To:
  Balancing robots
 
Hi Gordon and Jim Motors really are tricky things. Oh dear, I seem to have stirred up a hornet's nest. I too have built magnetometers and they are far easier to understand and model. The problem with motors is that they go round - and they have a (...) (20 years ago, 26-Jan-04, to lugnet.robotics)

6 Messages in This Thread:



Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR