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 / 22122
     
   
Subject: 
Balancing robots
Newsgroups: 
lugnet.robotics
Date: 
Mon, 26 Jan 2004 22:58:12 GMT
Original-From: 
PeterBalch <peterbalch@NOSPAMcompuserve.com>
Viewed: 
998 times
  

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

   
         
     
Subject: 
Re: Balancing robots
Newsgroups: 
lugnet.robotics
Date: 
Tue, 27 Jan 2004 03:40:48 GMT
Original-From: 
Jim Choate <RAVAGE@nospamEINSTEIN.SSZ.COM>
Viewed: 
923 times
  

Hi Peter,

On Mon, 26 Jan 2004, PeterBalch wrote:

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.

To each their own. That they go round is called 'polar coordinates' if you
have problems translating it to cartesian. The result is the same either
way. The commutor is a (low) resistance. Now we could fall back on a
lumped-parameter model if you would like, that complicates the entire
model because we now have to model the inter-winding capacitance and
thermal effects. For this sort of application that is over-kill.

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 disagree with several points here, but see above.

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".

I've got a pile of books with clearer definitions. Start with Tocci (late
'70's). Try looking at some basic electronics books teaching basic 'network
theory' within the context of driving a RL(C) circuit with a square wave.
See what they call the response that happens on an L when the square wave
passes through its negative edge.

If you're going to make reference to books (guess you don't agree with
Agassi I see) you could at least provide the title. Science has -no- place
for a plea to authority, -especially- an anonymous one ;)

If you can't explain it in your own words it makes it hard to accept that
you actually understand what you're talking about, no? Do you know how
many times in history somebody has waved a book about and then been proven
wrong? It's not a reliable method to understanding nature, science really
isn't a political activity (or at least it shouldn't be). My personal
estimate is that given any book, at least 90% of its 'absolute' assertions
are probably wrong.

Agassi said to study nature not books, what he means is to -start- with
the books, not end with them. Don't trust them, prove them through
experience. As Asimov said, science isn't "Eureka" it's "That's funny...".

Strictly speaking 'back-EMF' is the resultant currents effect -any time-
an L is relaxed. We talk of 'generator current' and 'back-EMF' in the context
of a motor because it's usefull to differentiate that current from the driving
current. Now, if we move to a strictly 'component' model (ie we talk of
the behavior of the L and the forcing function only) we have two aspects;
forcing function and back-EMF (it is -not- a generator current because
there is no external forcing function [ie magnet coupled to shaft
rotation]). A back-EMF exists in -all- L's, whether they are in a motor or
not. It is -nothing- more than the recover of the energy stored in the B
field that wasn't used. Conservation of energy requires that energy goes
someplace. The L turns it into a current, which because all L's have R
in the real world means an induced voltage. That current is an 'induced
current' as well since it's the B that is causing the current. [1]

The fact you don't seem to understand the component behavior of L with
respect to 'back-EMF' or 'induced current' may be a part of why you find
motors so difficult. I can suggest several books if you'd like.

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.

How? Assertions require proof/demonstration.

The only way to measure the generator current when the motor is on is to
look at the current change with repect to what one would expect without
that effect present, and that requires a very stable voltage source.
Regular batteries or wall warts ain't gonna cut the mustard there, sorry.
What the generator current does is increase the impedence of the motor,
effectively making it require more energy than it 'should' (I -love- the
2nd Law!).

With it off the generator current you get won't be the same as when the
motor is on because you don't have the extra energy of the driving current
providing the torque to make the generator current. Not to mention it is
very small and very noisy (ie look at it on a scope some time). It also is
very sensitive to measurement device impedence (you can't measure
something without altering it, ever). The next suggestion that I'm sure at
least one of you will make is drive the motor mechanically and measure the
resultant, again the 2nd Law will bite you here as well. You'll have
mechanical loss in the linkage and that will slow the driving motor.
Because the generator current is so small this -will- be important.

Let's look at a actual robot moving across a smooth surface (let's
minimize that loss) and imagine that we cease driving one of the motors.
What is the result? The robot slows to that side, that causes a lateral
force on -both- motors that throws your whole little circus off as the
mechanical losses of those non-straight line forces come into play. This
will happen just as fast as you switch the motors on and off so there
isn't a way to out guess it by being faster than it is. The lateral forces
on the shaft bearing will become important, heat. Heat is a rendomizing
effect and increases the Z. This will reduce your current and to get the
same performance you'll need to increase your driving force.

One final comment, what one 'should' be able to do is often different than
what one can do in practice. It is always a good idea to keep that in
mind. I have a little mantra that I run on a loop in the back of my mind,
thanks to Heinz Pagel (RIP);

1st Law: You can't get ahead.

2nd Law: You can't break even.

3rd Law: You can't quit the game.

Ladies and Gentlemen, I'm done with this dicussion. You are welcome to
whatever opinion of the world you have or want.

Ta ta.


[1] You do realize that a magnetic field is nothing but a model? What we
actually have is photons bouncing from hither to yon and nothing more. An
electron picks up some energy and releases a photon (ie expanding magnetic
field), if something effects that electron or the photon effects some
other electron then we have a coupling. If the electron is not driven
continously then at some time t each individual electron will recover it's
emitted photon (ie collapsing magnetic field). To make reference to a
comment Einstein made about math and reality, don't confuse the name you
give something with that thing. And yes, if you want you can take the
proton/electron/neutron/photon model and turn it into quarks and photons
but it does nothing toward understanding the gross behavior of the
phenomenon. Sometimes the western reductionist approach isn't the right
one (e.g. emergent behavior and complexity theory).

[2] You might also want to look into Josephson Junctions. Refering back to
my example of the PVC pipe and rings a JJ is nothing more than a ring with
a -very- small gap in it. So small in fact that if some electrons are
driven with enough energy they can 'tunnel' accross the junction and hence
we have a current when in a strictly classical sense shouldn't exist. You
might also find SQUIDs of some interest as well.

-- --

Open Forge, LLC  24/365 Onsite Support for PCs, Networks, & Game Consoles
512-695-4126 (Austin, Tx.)  help@open-forge.com  irc.open-forge.com

Hangar 18  Open Source Distributed Computing Using Plan 9 & Linux
512-451-7087  http://open-forge.org/hangar18  irc.open-forge.org

James Choate  512-451-7087  ravage@ssz.com  jchoate@open-forge.com

   
         
   
Subject: 
Re: Balancing robots
Newsgroups: 
lugnet.robotics
Date: 
Tue, 27 Jan 2004 05:32:11 GMT
Original-From: 
Gordon Elliott <GELLIOTT@nospamCSISC.CC>
Viewed: 
959 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

   
         
   
Subject: 
Re: Balancing robots
Newsgroups: 
lugnet.robotics
Date: 
Tue, 27 Jan 2004 19:06:31 GMT
Original-From: 
Scott Davis <rcx2man@hotmail%antispam%.com>
Viewed: 
935 times
  

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:
_______________________________________________
|_/____________________________________________\_|
_______________________________________________
|_\____________________________________________/_|

Where the rectangle is one of the studless beams.  You would want something
that was smooth so the ball wouldn't get stuck.

The / & \ are pieces of metal connected to a wire with the 2x2 connector cut
of one end and each wire is soldier to a metal piece.  You would not want
the metal pieces to be touching.  When the ball rolled so that it was in
contact with the metal pieces it would complete the circuit.  setting the
sensor port as a touch would work at monitoring if the ball was at either
end of the track.

If somebody wanted to get really creative you could put a resistor in the
circuit and be able to use one sensor port to monitor both ends of the
track.

If somebody does try this or has tried something like this please let me
know as I'm interested in how well this would work.

Thanks,
Scott

----- Original Message -----
From: "Gordon Elliott" <gelliott@csisc.cc>
To: <lego-robotics@crynwr.com>
Sent: Tuesday, January 27, 2004 12:32 AM
Subject: Re: Balancing robots


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




   
         
     
Subject: 
Re: Balancing robots
Newsgroups: 
lugnet.robotics
Date: 
Tue, 27 Jan 2004 19:14:01 GMT
Original-From: 
Jim Choate <RAVAGE@EINSTEIN.SSZ.avoidspamCOM>
Viewed: 
1060 times
  

Hi Scott,

That device is called a 'Tremble Switch'. It's a good start but I think
you'll find a 'pendulum' form is more effective. You can pick them up from
any pinball repair place, they're the thing that says 'Tilt'.

Most of these are binary but you can replace the (usually metallic) sensor
ring with a non-conductive material and then put contact on it (ie glue
copper strips) and you'll get not only front/back but whatever sort of
resolution you need.

On Tue, 27 Jan 2004, Scott Davis wrote:

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.

-- --

Open Forge, LLC  24/365 Onsite Support for PCs, Networks, & Game Consoles
512-695-4126 (Austin, Tx.)  help@open-forge.com  irc.open-forge.com

Hangar 18  Open Source Distributed Computing Using Plan 9 & Linux
512-451-7087  http://open-forge.org/hangar18  irc.open-forge.org

James Choate  512-451-7087  ravage@ssz.com  jchoate@open-forge.com

   
         
   
Subject: 
Re: Balancing robots
Newsgroups: 
lugnet.robotics
Date: 
Tue, 27 Jan 2004 19:48:52 GMT
Viewed: 
967 times
  

In lugnet.robotics, Scott Davis wrote:
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:
_______________________________________________
|_/____________________________________________\_|
_______________________________________________
|_\____________________________________________/_|

Where the rectangle is one of the studless beams.  You would want something
that was smooth so the ball wouldn't get stuck.

The / & \ are pieces of metal connected to a wire with the 2x2 connector cut
of one end and each wire is soldier to a metal piece.  You would not want
the metal pieces to be touching.  When the ball rolled so that it was in
contact with the metal pieces it would complete the circuit.  setting the
sensor port as a touch would work at monitoring if the ball was at either
end of the track.

If somebody wanted to get really creative you could put a resistor in the
circuit and be able to use one sensor port to monitor both ends of the
track.

If somebody does try this or has tried something like this please let me
know as I'm interested in how well this would work.

Scott,

I haven't tried that exact thing, but from the discussions I've had, I don't
think it would work very well.

The problem is that gravity is acting on the robot exactly the same as it's
acting on the ball.  The robot is not just tilting, but falling.  So, the ball
will fall at the same speed as the robot (and the sensor-track).

Meaning the ball will stay in the same place (relative to the robot) until an
external force (the floor) acts on one of them.  (trust me on this)  :)

Actually, there are some ways to make it work.  The above statement assumes the
sensor is mounted near the center of mass of the robot.  If you mount the sensor
very high, away from the center of the robot, the sensor track will travel
faster than the ball, so it will appear the robot is falling the other
direction.  (not good)

But if you put the sensor below the center of mass (or below the axle) the
sensor track will move slower (or the opposite direction) than the ball.

However, if the sensor is mounted near the axle, you also have to take into
account the forward/back acceleration of the motors.

It gets messy.

My suggestion: it could work, if mounted below the axle, but then you still have
other forces to consider.

Steve

 

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