dc motor control for a balancing platform (segway)

I have just bought an arduino microcontroller and as one of my first projekts I would like to make a small self balancing platform like
segway (but tiny one). There is a dc motorcontroller add on to arduino that lets me control two motors (a motor shield). It seems to me that the only thing you can control with any of the shelf controllers is motor speed. But if the platfor is a bit out of balance a would like to stter the motor torque to get it back in balance. Not the speed. The speed would naturally follow. Does that make sense? But how do you control the torque output of (any) dc (brushless?) motor?? Or am I way of here...
Boniq
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
On Wed, 26 Aug 2009 11:59:36 -0700, Boniq wrote:

A permanent-magnet motor delivers torque proportional to its armature current, and delivers a back-EMF proportional to its armature speed.
This is all complicated by cogging torque, and the fact that a brushless "DC" motor needs to be switched, but that's about it.
Controlling motors with a current drive is fairly common if you want the motor torque to be independent of speed -- and if you've spent $$$ for a motor with low or zero cogging torque. You may have to roll your own amplifier, though.
Having said all _that_ -- you may do better driving the motor voltage; driving it in constant current makes it into an integrator (from a low- pass filter), which slows down your system response anywhere from a bit to a lot depending on the relative dynamics of your motor and your system. On the other hand it can vastly simplify the problem of never, ever driving the motor over some current threshold. Six of one, half a dozen of the other...
Were I doing this with "toy" motors, I'd probably command the voltage to the motor, just because it'd make the drive electronics either. I'd let the motor current fall where it may, and not sweat things too much unless I constantly burnt out motors.
--
www.wescottdesign.com

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Thank you very much for valuable feedback :-) Its great to be able to aske people.
There seems to be something called a "torque motor" also that might be useful. Lets say if one stand still in a slope on a segway the motor must be able to produce constant torque even in it doesnt turn.
Boniq
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
A small segway type of robot. http://mydancebot.com /
Peter Nachtwey
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
There is currently a project running for a similar thing in the german Elektor (www.elektor.de) magazine. It's called "ElektorWheelie". I don't know whether this informations are available in other languages too, but maybe it will help you.
regards
Boniq schrieb:

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
On Sat, 29 Aug 2009 15:06:15 +0200, mike wrote: (top posting fixed)

There was one in Circuit Cellar last year, too.
The mechanism is easy, the control rule is moderately challenging to just get it standing up (you could do that without math), there's a lot of depth to the control problem (make it stand up in gusty winds, or when you're shooting ping-pong balls at it, etc), and it's impressive as all get out when it's done. What's not to like?
--
www.wescottdesign.com

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

If you can only control speed its not a servo controller. Drives giving you the abillity to control both speed and torque by giving of a setpoint of either are quite common in industrial applications. Traditional DC motors offer this abillity intrinsically.

The term "DC brushless motor" is a misnomer. They are in fact AC motors controlled via a variable frequency exciting the stator. The term is a marketing term designed to empahsise the lack of maintenance and performance equal to that of so called DC servos. The rotor is usually either a permanent magnet or a classic squirel cage induction motor for larger types.
They are really servo motors, the term servo is subjective but emphasizes that the motor is suitable for control of not only speed but rapid precise control of torque so that acceleration, speed and position can be controlled precisely and quickly.
If you have some angle measurement device, eg a encoder or resolver mounted on the permanent magnet rotor shaft that is aligned with its magnetic axis it possible to calcuate PWM (Pulse width modulation) derived set of sine waves in the three phses of a controller to produce a current in the stator of frequency equal to the rotation of the rotor but whose physical magnetic field is 90 degrees ahead of the magnetic axis of the rotor. The torque produced will then be proportional to the current. Today the parameters for the motor model required to calulate this angle is automatically tested and calculated via encoder angles and stator currents and an auto tune (ie measure rotor motor parameters as resentence and L with a DC decay test and maybe no load test) but when Felix Baschke of Siemens did it in the 1950s he used magnetic field sensors in the windings. (He only had analog computers)
Don't worory about the very complicated calculations, they are taken care of for you. A servo motor with its appropriate servo controller will give you at least two analog inputs as setpoints for you speed and torque. One will be a setpoint signal for speed (typcally 0-10 volt signal or rather -10 to +10v) that is proportional to desired speed (eg for a 1500rpm motor 10v = 1500 rpm, 5v = 750rpm, 1v 150rpm, - 5v = -750rpm)) the other 'setpoint inpput will give you say a -10 to +10V input for the torque of the motor.
Technically the torque loop works as a torque limiter. IE if you demand 750rpm of the motor but and allow it only 10% of its rated torque/current to avoid breaking a reel of cable you are winding this may mean that the motor never achieves 750 rpm due to the friction and back tension being to great. You will know this as the drive controller will give you actual speed and torque as feeback. This also works the other way around, if you allow a motor 100% of its torque but limit the speed to say 1% the speed loop will reduce torque so this speed is not exceded.
Basic servos allow you to control only speed and torque and usually set a ramp rate limit through another analog input (eg from 0 speed to 1500 rpm in 3 seconds, no more). So 3 analog inputs are typical though I must add the real industrial stuff tends to use field buses such as profibus, CAN-open and lately industrialised ethernet with special real time switches and routers (profinet)
Most modern sophisticated units also allow you to count pulse from the resolver/encorder (after zeroing on a limit switch say) and therefore control position as well and will allow you to tabulate 'cam profiles' in a sort of look up table so that you can produce say a 'flying shears' to slice carboard or sheet steel moving on a conveyor say or push something of. Of course you can do this with a higher controller as well. You won't need that for the 'segway' thoiugh.
DC motors are much easier to understand and from your point of view will work the same way: you can control speed, torque and limit acceleration. In a DC motor a magnetic field is produced in the 'stator' by either a permanent magnet or a field winding with a current. The rotor (also called the armature) windings are alternatly switched in and out of circuit by a rotating swich called a commutator. This is made up of copper segments on which ride graphite brushes. The switching is arranged to ensure that the magnetic field of the rotor(also called armature) is 90 degrees ahead of that of the magnetic field from the field winding/permanent magnet. Torque is entirely proportional to the armature current due to this. Back emf is entirely proportional to armature speed.
DC motor controllers have an inner PID loop to control current and therfore torque and an outer PID loop to control speed by controlling the current loop. You can 'limit' the maximum current demand and therfore torque demand by claming limits (via software or comparators) to the analog loop.
One subtley of DC motors is the 'compensating winding': this is a winding around the stator through which the armature current passes before going to the armature. It is set up in opposition to the armature mmf so that as the armature mmf interacts with the stator mmf and distorts the overall torque mmf from the 90 degree optimal.
A servo motor using induction motor is basically usally what is called a 'flux vector drive'. In this an algorithm based on a motor model tries to induce a mmf magnetic field in the rotor that is 90 degrees out of phase of that in the stator. This is quite difficult as the reactance of the motor varies not only with rotor rpm and excitation but also acceleration. The algoritm is often based on the clark park transformation and tries to reduce a two phase equivalent cicuit model where one phase (the direct current or magnetising current) represents the current through the non moving parts of the motor and the quadrature or torque producing current is that at producing a magnetic field 90 degrees ahead of the stator.
I would say it would be a little more difficult to produce a segway without motor torque control.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here. All logos and trade names are the property of their respective owners.