Shop OBEX P1 Docs P2 Docs Learn Events
How to control torque of a stepper motor dynamically — Parallax Forums

How to control torque of a stepper motor dynamically

I'm working on creating a sim racing wheel as a little side project of mine, and I've been looking into using a stepper motor as the motor that will generate force feedback. I'm looking to control the torque dynamically for this stepper as it's crucial to do so for a sim racing wheel. I'd like to point out that I am not looking for accuracy specifically from the stepper as I'll also be using an optical encoder. So far from my research torque is heavily related to current when working with steppers so the end goal will probably be varying that using a mosfet and a pwm signal. I'm locked in my house from the whole Covid-19 deal and I have a nema 32 stepper along with a DM860T driver and everything to assemble a circuit. What do you think?

Comments

  • I would ditch the stepper in favor of a regular DC motor and run a PID loop. Limiting the PID output will limit the motor torque. You already have the encoder.
  • Stepper motor is good for making a step and then holding it. No need for an encoder as the motor makes one step in that direction.

    Mike
  • The DM860T will control the current. Set the dip switch to match your motors rated current. Current = torque, if you want less torque then less current. If the motor is rated for 2 amps then set the dip switch for 2 amps. If you want to loose torque then run at a higher clock speed (rpm). If the clock speed is too high then you will loose all torque and the motor will not rotate.
  • I didn't know stepper motors were used for force feedback but apparently steppers are used on several commercial driving simulation wheels.
    I found a few open source projects related to your question.
    Here's an article about Open FFBoard.
    And here's a project called SmoothStep.
    I hope you keep us posted on your efforts.
  • @"Duane Degn"

    Hi Duane, was there any mention of variable torque, though because I didn't see it.

    With a closed loop servo motor, it's easy to dynamically limit the motor torque, simply by limiting the motor command.

    AKA: soft servo.
  • iseries wrote: »
    Stepper motor is good for making a step and then holding it. No need for an encoder as the motor makes one step in that direction.

    Mike

    My personal philosophy is that; if it's not monitored via some form of feedback, it's not controlled.
  • ercoerco Posts: 20,254
    Mickster wrote: »
    My personal philosophy is that; if it's not monitored via some form of feedback, it's not controlled.

    Agreed. There's no way to know if the user (driver) held the wheel tight enough to make the stepper miss a few tics.

    Intuitively, seems like using a DC motor would be easier to manage, especially if you're just starting up, Elnino2002.

  • Mickster wrote: »
    was there any mention of variable torque, though because I didn't see it.

    I looked a bit closer at both projects and only found references to torque control in the second project's code. I'm pretty sure both projects use encoders for closed loop control.

    I don't see a purpose to force feedback without some sort of variable torque. If they don't have this, it's got to be because they're still learning how to do this sort of stuff. I don't know how to use variable torque with steppers so I don't intend any disrespect towards them for not knowing how to do it yet.

    I was just surprised to learn people were trying force feedback with steppers at all. As you and erco suggest, I'd think a DC motor with encoders is the way to do this. If I remember correctly, DC motors have a lot of torque when not moving and steppers have most of their torque while moving. A stepper seems like an odd choice but I know steppers are being used successfully in high end commercial force feedback wheels.
  • @"Duane Degn"
    I don't see a purpose to force feedback without some sort of variable torque. If they don't have this, it's got to be because they're still learning how to do this sort of stuff. I don't know how to use variable torque with steppers so I don't intend any disrespect towards them for not knowing how to do it yet.

    Ditto

    I vaguely remember an arcade game that would kick back but it was abrupt, no sponginess that I could detect.

  • ErNaErNa Posts: 1,742
    edited 2020-04-12 20:06
    To understand the problem you have to understand the solution. A stepper motor is not a "normal" motor, where current creates torque. In a stepper motor current only creates the ability to create torque. Seems strange? Compare it to a permanent magnet. The moment a permanent magnet has attracted a piece of iron, there is no force. Because the force of the magneto action on the iron is exactly opposite to the force the iron pushed against the magnet. The integral force is zero. A Stepper motor can be seen as an arrangement of switchable permanent magnets. The moment one magnet is activated, a piece of iron is attracted, in this case: the rotor. This attraction is called torque. The moment the iron is in proximity to the magnet torque is no longer created. That is: if a step is completed, there is not torque, no matter how mighty the permanent magnet is! But the moment you move the rotor from this position, a back driving force is created. This force now is proportional to the strength of the magnet.
    So the question you raised must be modified: how to select the current needed for a stepper motor to create the required torque. This answer is: there is no simple solution in case the motor is running and there is no solution in case the motor is at standstill. For further reading: https://www.trinamic.com/technology/adv-technologies/
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2020-04-12 20:36
    ErnNa wrote:
    The moment the iron is in proximity to the magnet torque is no longer created. That is: if a step is completed, there is not torque.
    But when a stepper motor is running, no steps are truly completed; otherwise the motion would not be smooth but jerky. What really happens is that the next step is activated before the current step has completed. So there is always torque acting on the rotor while the motor is running. The trick in driving the motor is to keep the torque constant.

    -Phil
  • ErNaErNa Posts: 1,742
    edited 2020-04-12 21:42
    A Running Stepper motor is no stepper😊 If a stepper is at standstill, the torque generated is proportional to the deviation of the rotor to the neutral position. That is: Torque = constant times angle. This is the equation of a harmonic oscillator. In reality this system is damped, so the oscillation comes to an end after some time. But that means: if the motor is running, creating torque, and the "position" of the virtual magnet is not synchronized perfectly to the movement of the rotor, there is always a variation in torque, what means some kind of vibration. What indeed is the reason for the noise of a stepper. If you were able to run the stepper at the maximum torque point you could set the current to the lowest value needed. But that would mean about 200 steps of resolution in position detection for every single full step. So your driver must be also able to do granular microstepping and the current/torque factor of the motor must be constant. The last is connected to the design of the motor and contradicts the original design goal of a stepper: to move in discrete steps. We now have 3-Phase stepper design motors that can be driven in a control loop. Those motors combine the features of a PMSM-motor (control) and those of the stepper (high torque density at low speed). Those motors need high resolution incremental encoders to run. Sensorless mode at very low speed is according to my knowledge not possible.
  • Here's another project using a stepper motor for force feedback. I didn't see a direct reference to variable torque but I don't see much of a point in doing something like this without have variable torque.

    I watched an overview of force feedback steering wheels on YouTube. The presenter stated some of the high end units used stepper motors.

    I haven't spent a lot of time looking for stepper direct drive steering wheels but so far I haven't found commercial direct drive units which use stepper motors.

    As ErNa mentioned, brushless motors are being used for this purpose. Here's one example of a brushless direct drive force feedback steering wheel.

    Based on the little I've learned so far, I'd say using a stepper motor for force feedback is a challenging task.
  • A while ago I spent some time interfacing P1 with a stepper motor, using the Powerstep1 chip. It has sophisticated current control, and I imagine that could be used to limit the torque of each step or microstep, thereby limiting the stepping torque. Anyway, the datasheet is quite a good read to understand these motors.
  • MicksterMickster Posts: 2,611
    edited 2020-04-13 15:04
    @"Duane Degn"
    As ErNa mentioned, brushless motors are being used for this purpose. Here's one example of a brushless direct drive force feedback steering wheel.

    At first glance, all they appear to have done is take a standard, off-the-shelf, integrated BLM/drive and hyped it up. They have listed standard features as if they were something special.

    Edit:
    "Torque reconstruction processing": P Term
    "Static force reduction": I Term
    "Natural Damping, Inertia and Friction filters": D Term
    "Ultra low latency mode": 1/2/4/8 KHz servo loop?
    "Torque slew rate adjustment": PID output limit


    These things are cool and are a part of my master-plan to almost completely eliminate machine wiring.

    @Erlend
    to limit the torque of each step or microstep

    Makes sense but against an opposing force, the "driver", wouldn't the motor lose steps and therefore position? Would probably need some form of position feedback.



  • kwinnkwinn Posts: 8,697
    edited 2020-04-13 15:01
    If you want to control the torque and speed of a stepper and have the resulting motion be smooth you really need a drive circuit similar to that of a VFD. One type of optical spectrometer I worked with had a single phototube and secondary slit that moved along an arc shaped track to scan a range of wavelengths. The stepper motor that moved the carriage was driven by two out of phase sinusoidal inputs.

    Edit-

    Control the voltage and current and you control the torque. Control the frequency and you control the speed.
  • @Erlend
    to limit the torque of each step or microstep

    Makes sense but against an opposing force, the "driver", wouldn't the motor lose steps and therefore position? Would probably need some form of position feedback.


    This particular chip detects lost steps, but I agree, I would hesitate to rely on a stepper to always be at the intended position.
  • ErNaErNa Posts: 1,742
    Whenever you lose a step, it's already to late. Every motor for a given current in a given rotor position creates a well determined torque. A current is determined by two values: the amplitude and the phase. With a normal stepper motor this current is represented by two independent current components that have different values at a given moment. If you see these two current components as the X and Y coordinate of a vector, they represent the amplitude and phase of the driving current. BUT: in this model you assume that there is a strict correspondense between the values of the current components and the amplitude and direction of a generated magnetic field. But this is not the case in a real world.
    A stepper motor both is simple and creates a relatively high torque due to the high pole count. If you like to have a closed-loop controlled high torque drive you can run a stepper with position feedback, but that means you have to use a very precise incremental encoder and the system will become rather expensive.
    But what is needed here is for sure only an adjustable current of the stepper driver, what can easily be done whenever the current needed is known from experience
  • ercoerco Posts: 20,254
    I don't think you even need encoders for the simplest DC motor solution. Just a low gear ratio between the steering shaft and a high-torque motor. No voltage = motor easily backdriven. Low voltage=low torque, high voltage=high torque. H-bridge handles the deets.
Sign In or Register to comment.